Setting the recipient email address dynamically - docusignapi

I am trying to integrate docusign api into my application using rest.I have used Request signature on document function form docusign APIWalkthrough.You can also refer the link http://iodocs.docusign.com/APIWalkthrough/requestSignatureFromDocument. I am trying to add the recipient address into the email field.but i am getting an error like the following.
/accountId = 657326 baseUrl = https://demo.docusign.net/restapi/v2/accounts/657326 error calling webservice, status is:400 error text is --> { "errorCode": "INVALID_USERNAME_FOR_RECIPIENT", "message": "The user name for the recipient is invalid. The user name is invalid for recipient email somangshu.drocker#gmail.com" }/
The code for the above method is as follows.
$email=VA_Logic_Session::getInstanceform()->emailaddress1;(this value is passed dynamically or to say its specified by the user)
$data = array (
"emailSubject" => "Sample Document",
"documents" => array( array( "documentId" => "1", "name" => $documentName)),
"recipients" => array( "signers" => array(
array( "email" => $email,(this variable is declared above with recipient email address spcified by te user)
"name" => $recipientName,
"recipientId" => "1",
"tabs" => array(
"signHereTabs" => array(
array( "xPosition" => "515",
"yPosition" => "279",
"documentId" => "1",
"pageNumber" => "2" )
))
))
),
"status" => "sent"
);
Also how do i point to the last page of any pdf. I could find the tab "pagenumber" as shown above. But what is the parameter to be passed there.
i am not able to figure out the problem hear.pls help

Whenever you receive the error INVALID_USERNAME_FOR_RECIPIENT check the actual values that are being set for the recipient's name. From our comments it seems that was indeed the problem in this case.
With regards to your page number question, there's no "last page" property so you need to know how many pages are in your document before you create the envelope to be able to assign to the last page. For instance, if you determine the document has 10 pages, then set to last page by doing:
"pageNumber": "10",
in your request body JSON (or XML).

Related

Font size not working with Docusign REST API in PHP

I am working with the Docusign REST API in PHP to send a signing documents. Everything is working fine except the font size of the text.
For font size of 32, I have tried something like
"font_size" => "size32", but cannot get it to work.
How do I get the font size to work?
"textTabs" => array(
array(
"tabLabel" => "Name",
"value" => "Nancy Moore",
"font_size" => "size64",
)
),
"numberTabs" => array(
array(
"tabLabel" => "Contact",
"value" => "123456",
"font_size" => "size32",
)
)
For Curl Rest API, the font size parameters differs from that PHP SDK of Docusign (font_size) hence the line of code below solve the issue.
"fontSize": "Size32",

Why is it an error to use "token_xxxx" not associated with a Customer object for payment?

In the following PHP code, token_xxxx is associated with the Customer object
\Stripe\Stripe::setApiKey("sk_test_xxxx");
\Stripe\Customer::create([
"description" => "hoge",
"source" => "tok_amex"
]);
In the PHP code below, "token_xxxx" not associated with the Customer object is used for payment
\Stripe\Stripe::setApiKey('sk_test_xxxx');
$charge = \Stripe\Charge::create([
"amount" => 888,
"currency" => "USD",
"customer" => "cus_xxxx",
'source' => 'tok_visa',
]);
・An error occurred
Customer cus_xxxx does not have a linked source with ID tok_xxxx

Docusing error with Attaching through REST API documentBase64 - even for the small file

I have a Issue with docusign attachment through REST API. It was perfectly worked previously but the following error message coming,
{
"errorCode": "UNABLE_TO_CONVERT_DOCUMENT",
"message": "System was unable to convert this document to a PDF. Unab (truncated...)
If you can please help me on this
Bellow is the code segment which I'm using for attach image file to the docusign.
if(isset($this->attachments['NIC_Rear']))
{
array_push($dataArray['compositeTemplates'],
[
'inlineTemplates' => array(
[
'sequence' => '3',
'recipients' => array(
'signers' => array([
'email' => $this->issuerEmail,
'name' => $this->issuerName,
'recipientId' => '1',
'roleName' => $this->roleName,
'tabs' => $this->tabs,
])
)
]
),
'document' => array('documentId' => '3',
'name' => 'Attachment11',
'fileExtension' => get_file_extension_from_file($this->attachments['NIC_Rear']),
'width' => 100,
'height' => 100,
'documentBase64' => isset($this->attachments['NIC_Rear']) ? base64_encode($this->attachments['NIC_Rear']) : '',
),
]
);
}
This error you're getting:
{ "errorCode": "UNABLE_TO_CONVERT_DOCUMENT", "message": "System was unable to convert this document to a PDF. Unab (truncated...)
is indicative of any situation where the bits being passed to the DocuSign system cannot be converted into a flat pdf file representing the document.
It could be that it's not any document format that is supported, the document is password locked, empty or have any invalid macros or other bad stuff in it. Can you try a simple text document first just to isolate the issue?

Pass data to a groupLabel

I can pass data to text labels but can't workout how to include data needs mapping to a Radio group. I think I need to create a separate array for Group Labels but can't find any help on this.
Below is a snippet of my code which works fine except my attempt to pass a value to my first_life_title radio group.
I tried both groupName and tabLabel for the radio group.
array(
"email" => $toemail,
"name" => $recipientName,
"roleName" => $templateRoleName,
"tabs" => array(
"textTabs" => array (
array (
"tabLabel" => "firstlife",
"value" => $name
),
array (
"groupName" => "first_life_title",
"value" => $title
),
Jon
In the code you posted, you're specifying the Radio Group tabs within the textTabs array -- you should instead specify radioGroupTabs as a peer of the textTabs array. Here's the JSON that shows the correct structure -- notice that the radioGroupTabs array contains a groupName property as well as a radios property (which is itself an array, containing a single object to specify the radio button to select):
"textTabs": [
{
"value": "sample string 11",
"tabLabel": "sample string 19"
}
],
"radioGroupTabs": [
{
"groupName": "NAME_OF_RADIO_GROUP",
"radios": [
{
"value": "VALUE_OF_RADIO_BUTTON_TO_SELECT",
"selected": "true"
}
]
}
]

Docusign API - prefilling tab values on envelope created from template

I was able to successfully generate and send an envelope from template using the Docusign API. The only problem is that the tab values and not pre-populating as expected (they remain blank). Here is the relevant code based on DocuSign-REST-API-Webinar-April2013:
/////////////////////////////////////////////
// STEP 2 - Create an envelope
////////////////////////////////////////////
$data = array(
"accountId" => $accountId,
"emailSubject" => "DocuSign API - Signature Request from Template",
"templateId" => $templateId,
"templateRoles" => array(
array(
"email" => $email,
"name" => $recipientName,
"inPersonSignerName" => "Some Customer",
"roleName" => "Customer",
"routingOrder" => 2,
"tabs" => array(
"textTabs" => array(
array(
"tabLabel"=> "mmr",
"value" => "29.95"
)
)
)
),
array(
"email" => $email,
"name" => $recipientName,
"inPersonSignerName" => "Some Tech",
"roleName" => "Tech",
"routingOrder" => 1,
"tabs" => array(
"textTabs" => array (
array (
"tabLabel" => "\\*state",
"value" => "North Carolina"),
array (
"tabLabel" => "\\*city",
"value" => "Raleigh")
)
)
)
),
"status" => "sent");
All my searches for answers on support forums, documentation, etc seem to point to what I have. I have double-checked the tabLabels and they are correct and assigned to the correct role. The template contains three roles - Tech (Sign In Person), Customer (Sign In Person), Data Entry (Receive a Copy).
Can anybody spot the problem? I also tried with just "tabLabel" => "state" and "tabLabel" => "city" (i.e. without the wildcard) but same problem. Let me know if you need more info. Thanks!
Have you verified in the template that the tags are assigned to the expected recipient? Based on your code above, it looks like the tag labeled "mmr" should be assigned to the Customer role and the tags labeled "state" and "city" are assigned to the Tech. Is that correct?

Resources