【发布时间】:2015-07-31 20:06:06
【问题描述】:
我是 DocuSign 的新手,并尝试使用本地文档而不是模板的嵌入式签名。我正在使用 PHP 和沙盒开发人员帐户。我能够成功协商第一部分(登录 API)和第二部分(创建和发送信封),但第三部分(请求签名 URL)失败并出现 UNKNOWN_ENVELOPE_RECIPIENT 错误代码。
我使用的代码如下所示(敏感信息已编辑):
$integratorKey = "XXX-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
$accountEmail = "daryl@xxxxx.com";
$accountPassword = "xxxxxxxxxxx";
$recipientName = "Recipient Name";
$recipientEmail = "recipient@xxxxxxxx.com";
$documentName = "DocumentName.pdf";
$clientUserId = "1234";
// Construct the authentication header:
$header = "<DocuSignCredentials><Username>" . $accountEmail . "</Username><Password>" . $accountPassword . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";
// Skipping code for parts one and two as they work fine.
// By this point I have the value of EnvelopId in $envelopeId
// STEP 3 - Get the Embedded Singing View
$data = array(
"returnUrl" => "http://unform.com/",
"authenticationMethod" => "None",
"email" => $accountEmail,
"userName" => $recipientName,
"clientUserId" => $clientUserId
);
$data_string = json_encode($data);
$curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/recipient" );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"X-DocuSign-Authentication: $header" )
);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
在这些调用之后,$status = 400 我得到的完整的 $json_response 是:
{ "errorCode": "UNKNOWN_ENVELOPE_RECIPIENT", "message": "您识别的收件人不是指定信封的有效收件人。" }
我确实定义了 clientUserId,并且 $recipientName 与步骤 2 中签名者数组中使用的相同,但是字段名称不同,即步骤 2 的签名者数组中的“name”=>“$recipientName”和“ userName" => 第 3 步中的 $recipientName。
为了完整起见,这里是第二步中使用的数据数组:
$data = array(
"accountId" => $accountId,
"emailSubject" => "DocuSign API Sample - Please Sign This Document!",
"documents" => array(
array(
"documentId" => "1",
"name" => "$documentName"
),
),
"recipients" => array(
"signers" => array(
array(
"email" => "$accountEmail",
"name" => "$recipientName",
"recipientId" => "1",
"tabs" => array(
"signHereTabs" => array(
array(
"xPosition" => "100",
"yPosition" => "150",
"documentId" => "1",
"pageNumber" => "1"
)
)
),
"routingOrder" => "1",
"recipientId" => "1",
"clientUserId" => $clientUserId,
"name" => "Daryl Williams",
"email" => "daryl@weblane.com"
),
),
),
"status" => "sent"
);
任何帮助将不胜感激。如果我可以提供任何进一步的细节,请告诉我。
谢谢,
达里尔
【问题讨论】:
标签: docusignapi