if ($envelop->status == "Ok") { sleep(5); //Add uploaded document to envelope $addDocument = $signatureApi->AddSignatureEnvelopeDocument($clientId, $envelop->result->envelope->id, $guid, null, true); if ($addDocument->status == "Ok") { //Get role list for curent user $recipient = $signatureApi->GetRolesList($clientId); if ($recipient->status == "Ok") { //Get id of role which can sign for ($i = 0; $i < count($recipient->result->roles); $i++) { if ($recipient->result->roles[$i]->name == "Signer") { $roleId = $recipient->result->roles[$i]->id; } } //Add recipient to envelope $addRecipient = $signatureApi->AddSignatureEnvelopeRecipient($clientId, $envelop->result->envelope->id, $email, $name, $lastName, $roleId, null); if ($addRecipient->status == "Ok") { //Get recipient id $getRecipient = $signatureApi->GetSignatureEnvelopeRecipients($clientId, $envelop->result->envelope->id); if ($getRecipient->status == "Ok") { $recipientId = $getRecipient->result->recipients[0]->id; $getDocuments = $signatureApi->GetSignatureEnvelopeDocuments($clientId, $envelop->result->envelope->id); if ($getDocuments->status == "Ok") { $webHook = new WebhookInfo(); if ($callbackUrl != "") { $webHook->callbackUrl = $callbackUrl; } else { $webHook->callbackUrl = ""; } $send = $signatureApi->SignatureEnvelopeSend($clientId, $envelop->result->envelope->id, $webHook); if ($send->status == "Ok") {
//Create envilope using user id and entered by user name $envelop = $signature->CreateSignatureEnvelope($clientId, $name, null, null, $guid); if ($envelop->status == "Ok") { try { //Get role list for current user $recipient = $signature->GetRolesList($clientId); if ($recipient->status == "Ok") { //Get id of role which can sign for ($i = 0; $i < count($recipient->result->roles); $i++) { if ($recipient->result->roles[$i]->name == "Signer") { $roleId = $recipient->result->roles[$i]->id; } } try { //Add recipient to envelope $addRecipient = $signature->AddSignatureEnvelopeRecipient($clientId, $envelop->result->envelope->id, $firstEmail, $firstName, $lastName, $roleId, null); if ($addRecipient->status == "Ok") { //Add second recipient to envelope $addSecondRecipient = $signature->AddSignatureEnvelopeRecipient($clientId, $envelop->result->envelope->id, $secondEmail, $secondName, $lastName . "2", $roleId, null); if ($addSecondRecipient->status == "Ok") { try { //Get document from envelop $getDocuments = $signature->GetSignatureEnvelopeDocuments($clientId, $envelop->result->envelope->id); if ($getDocuments->status == "Ok") { try { //Create signature field $signFieldEnvelopSettings = new SignatureEnvelopeFieldSettingsInfo(); $signFieldEnvelopSettings->locationX = "0.15"; $signFieldEnvelopSettings->locationY = "0.23"; $signFieldEnvelopSettings->locationWidth = "150"; $signFieldEnvelopSettings->locationHeight = "50";