Created
February 16, 2018 05:03
-
-
Save DSDevCenter/1f4459bf648647cf5818f9ecc9c923a1 to your computer and use it in GitHub Desktop.
DocuSign SOAP API - Create Envelope example in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the recipient | |
$rcp1 = new Recipient();// First recipient to put in recipient array | |
$rcp1->UserName = "John Doe"; | |
$rcp1->Email = $Recipient1Email; | |
$rcp1->Type = RecipientTypeCode::Signer; | |
$rcp1->ID = "1"; | |
$rcp1->RoutingOrder = 1; | |
$rcp1->RequireIDLookup = FALSE; | |
// Specify captive info to embed the recipient | |
$captiveInfo = new RecipientCaptiveInfo(); | |
$captiveInfo->ClientUserId = "User4521"; | |
$rcp1->CaptiveInfo = $captiveInfo; | |
// Create the envelope contents | |
$env = new Envelope(); | |
$env->AccountId = $accountID; // Note: GUID should be used here rather than email | |
$env->Subject = "Email Subject"; | |
$env->EmailBlurb = "Sample email message"; | |
$env->Recipients = array($rcp1); | |
// Attach the document | |
$doc = new Document(); | |
$doc->ID = "1"; | |
$doc->Name = "Picture PDF"; | |
$doc->PDFBytes = file_get_contents("docs/picturePdf.pdf"); | |
$env->Documents = array($doc); | |
// Create a new signature tab | |
$tab = new Tab(); | |
$tab->DocumentID = "1"; | |
$tab->RecipientID = "1"; | |
$tab->Type = TabTypeCode::SignHere; | |
$tab->PageNumber = "1"; | |
$tab->XPosition = "100"; | |
$tab->YPosition = "150"; | |
$env->Tabs = array($tab); | |
// Create and send the envelope | |
$createAndSendEnvelopeparams = new CreateEnvelope(); | |
$createAndSendEnvelopeparams->Envelope = $env; | |
$response = $api->CreateAndSendEnvelope($createAndSendEnvelopeparams); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment