create package from already created template with sign field & assign to signer
Tuesday, August 7, 2018 at 02:56amHello,
I want to create a package from an already created template with sign field & assign to the signer and show in an iframe to sign the fields. I am using PHP. I tried using simple web application PHP code given in the forum. but not working.
Please help me with that.
Reply to: create package from already created template with sign field & assign to signer
Tuesday, August 7, 2018 at 06:24amReply to: create package from already created template with sign field & assign to signer
Wednesday, August 8, 2018 at 12:46am'Package created from template through REST API', 'description' => 'Package created with the eSignLive REST API', 'emailMessage' => 'This message should be delivered to all signers', 'autocomplete' => true, 'type' => 'PACKAGE', 'visibility' => 'ACCOUNT', 'due' => NULL, 'language' => 'en', 'status' => 'DRAFT', 'roles' => array ( 0 => array ( 'id' => $placeholderId, 'type' => 'SIGNER', 'signers' => array ( 0 => array ( 'id' => $placeholderId, 'firstName' => $firstName, 'lastName' => $lastName, 'email' => $email, ), ), 'name' => 'Signer', ), ), ); $packageJSON = json_encode($build); $packageId = json_decode($this->sendRequest($this->packageAppend . $templateId . '/clone', $packageJSON, NULL, 'application/json'), true); return $packageId; } //Send Package public function buildSend($packageId) { $build = array( 'status' => 'SENT' ); $sendJSON = json_encode($build); $this->sendRequest($this->packageAppend . $packageId['id'], $sendJSON, NULL, 'application/json'); return NULL; } //Sender signs consent and contract documents public function buildSign($packageId) { $build = array( 'documents' => array( array( 'id' => 'contract', 'name' => 'GRENKE Contract' ) ) ); $signJSON = json_encode($build); $signatureAppend = $this->packageAppend . $packageId['id'] . '/documents/signed_documents'; $this->sendRequest($signatureAppend, $signJSON, NULL, 'application/json'); return NULL; } //Get a session token public function buildToken($packageId,$placeholderId) { $build = array( 'packageId' => $packageId['id'], 'signerId' => $placeholderId ); $tokenJSON = json_encode($build); $token = json_decode($this->sendRequest($this->tokenAppend, $tokenJSON, NULL, 'application/json'), true); return $token; } //cURL function to send requests to eSignLive private function sendRequest($type, $json, $document, $contentType) { if (is_null($document) && is_null($contentType)) { $postfields = array( "payload" => $json ); } else if (is_null($document) && !is_null($contentType)) { $postfields = $json; } else { $postfields = $document; } $headerOptions = array( 'Authorization: Basic ' . $this->key, 'Accept: application/json,application/zip,text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' ); if (!is_null($contentType)) { $headerOptions[] = "Content-Type: $contentType"; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->url . $type); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); if (!is_null($postfields)) { curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); if (!is_array($postfields)) { $headerOptions[] = 'Content-Length: ' . strlen($postfields); } } curl_setopt($ch, CURLOPT_HTTPHEADER, $headerOptions); $response = curl_exec($ch); $err = curl_error($ch); curl_close($ch); if ($err) { return $err; } else { return $response; }; } } ?>Reply to: create package from already created template with sign field & assign to signer
Wednesday, August 8, 2018 at 05:31am"roles":[ { "id":"PlaceholderId1", "type":"SIGNER", "attachmentRequirements":[ { "description":"Please upload a scanned copy of your driver's license.", "required":false, "id":"attachment1", "status":"INCOMPLETE", "comment":"", "name":"Driver's license" } ], "signers":[ { "id":"PlaceholderId1", "firstName":"1.firstname", "lastName":"1.lastname", "email":"[email protected]" } ], "name":"Signer1" } ]The guidance for Attachment Feature is here. 2. And to redirect or to dispatch your request, you can take a look at the attachment code where some JS code is used to monitor the front-end events including "ESL:MESSAGE:SUCCESS:PACKAGE_OPT_OUT" and "ESL:MESSAGE:STARTED:DOCUMENT_ACCEPT", the document for this example is here. Hope this could help you! Duo