1
votes

I am using https://github.com/docusign/eg-01-php-jwt example to send envelope via email. But using this example i am not able to find any way of Embedded signing. I want to use embedded signing via that example.

I have used send envelope method to send email with attachment to sign the document

 try {
            print("\nSending an envelope...\n");
            $sendHandler = new SendEnvelope($apiClient);
           // $result = $sendHandler->send();
           /*To use sponsor email address in mail */
            $result = $sendHandler->send($uemail,$uname);

            printf("\nEnvelope status: %s. Envelope ID: %s\n", $result->getStatus(), $result->getEnvelopeId());

            print("\nList envelopes in the account...");
            $listEnvelopesHandler= new ListEnvelopes($apiClient);
            $envelopesList = $listEnvelopesHandler->listEnvelopes();
            $envelopes = $envelopesList->getEnvelopes();

            if(!is_null($envelopesList)  && count($envelopes) > 2) {
                printf("\nResults for %d envelopes were returned. Showing the first two:\n", count($envelopes));
                $envelopesList->setEnvelopes(array($envelopes[0],$envelopes[1]));
            } else {
                printf("\nResults for %d envelopes were returned:\n", count($envelopes));
            }
            # $envelopesList is an object that implements ArrayAccess. Convert to a regular array:
            $results = json_decode((string)$envelopesList, true);
            # pretty print it:
            print (json_encode($results, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
        } catch (Exception $e) {
            print ("\n\nException!\n");
            print ($e->getMessage());

            if ($e instanceof DocuSign\eSign\ApiException) {
                print ("\nAPI error information: \n");
                print ($e->getResponseObject());
            }


        }
        print("\nDone.\n");                             
1
@InbarGazit .....................Gurpreet Singh Matharu

1 Answers

0
votes

What you need is to set the signer_client_id of your recipient. Look in this PHP code - https://github.com/docusign/eg-03-php-auth-code-grant/blob/master/src/EG001EmbeddedSigning.php for how to do this and move it to your code.

The relevant line is line #44:

'signer_client_id' => $this->signer_client_id,