Remove signature fields displayed on sign page using DocuSign eSignature API

22 views Asked by At

I created signature url via eSignature REST API by creating Envelope. This is example of code:

    public function makeSignlinkTest($docusign_parameters){
        
        $config = new Configuration();
        $apiClient = new ApiClient($config);
        $this->apiClient = $apiClient;
        $this->config = $config;
        $apiClient->getOAuth()->setOAuthBasePath($docusign_parameters['authwebserver']);
        $privateKey = file_get_contents($docusign_parameters['private_key_path'], true);
        $jwt_scope =  "signature impersonation"; 

        $result = $apiClient->requestJWTUserToken(
        $aud = $docusign_parameters['client_id'],
        $aud = $docusign_parameters['user_id'],
        $aud = $privateKey,
        $aud = $jwt_scope
        );

        $access_token = $result[0]->getAccessToken();
        
        $uinfo = $apiClient->getUserInfo($access_token);
        $accs = $uinfo[0]->getAccounts();
        $acc_id = '';
        $acc_base_path = '';
        foreach($accs as $ac){
            
            $acc_id = $ac->getAccountId();
            $acc_base_path = $ac->getBaseUri();
            
        }

        
        $args = [];
        $args['envelope_args'] = ['signer_email' => $this->user_data['user_email'],'signer_name' => $this->user_data['user_name'],
            'signer_client_id' => $this->user_data['user_client_id']];
        $args['account_id'] = $docusign_parameters['api_account_id'];//API Account ID
        $demoPath = $this->file_data['file_dirname'];//
        $pdfFile = $this->file_data['file_name'].'.'.$this->file_data['file_extension'];//
        $envelope_definition = $this->makeEnvelope($args["envelope_args"], $demoPath, $pdfFile);
        $apiClient->getOAuth()->setOAuthBasePath($acc_base_path.'/restapi');//'account-d.docusign.com'
        $apiClient->getOAuth()->setBasePath($acc_base_path.'/restapi');//'demo.docusign.net'
        $config->setHost($acc_base_path.'/restapi');//https://demo.docusign.net/restapi
        $envelope_api = new EnvelopesApi($apiClient);
        # Call Envelopes::create API method
        # Exceptions will be caught by the calling function
        try {
            $envelopeSummary = $envelope_api->createEnvelope($args['account_id'], $envelope_definition);
            
        } catch (ApiException $e) {
            $rb = $e->getResponseBody();
            $msg = $rb->message;
            return $msg;
        }
        $envelope_id = $envelopeSummary->getEnvelopeId();
        $rec_req = new RecipientViewRequest(
                    [
                        'authentication_method' => 'None',
                        'client_user_id' => $this->user_data['user_client_id'],
                        'recipient_id' => $this->user_data['user_id'].'',
                        'return_url' => $this->docusign_parameters['redirect_uri'].'&state='.$this->file_hash,
                        'user_name' => $this->user_data['user_name'],
                        'email' => $this->user_data['user_email']
                    ]
                );

        $view_url = $envelope_api->createRecipientView($acc_id, $envelope_id,$rec_req);
        $sign_url = '';
        if(is_object($view_url) && method_exists($view_url, 'getUrl') ){
            $sign_url = $view_url->getUrl();
        }
        return $sign_url;
}

It generates Envelope and then signature link, but if to click on it then on signature page it displays many unnecessary fields like: Text, checkbox, Title, Name etc. When user selects checkbox and put it on the document then it allows to click Finish button and redirects to my website with event == signing_complete. It is not as I am expecting. I would like to leave only Signature field and to remove others link checkbox, initial, text etc. How to achieve this?

enter image description here

1

There are 1 answers

1
Inbar Gazit On

So, if I understand your requirement, you want your end-user to only sign using signature field (tab) but you don't want to place it for them, you want them to drag and drop the tab where they choose to put it?

That exact scenario cannot be done in DocuSign today as far as I know. You have these options:

  1. You can place the signature field yourself in code by adding a tab element to the envelope. User will not see the entire toolbar you showed here, they will sign in the location you set for them.

  2. This one is a lot harder for you to code, but you can build UI to allow a user to drag-drop an element into a document. That UI you build yourself, nothing to do with DocuSign. You then use the information (X,Y coordinates) to tell DocuSign where to put the sign tab. So basically you do this first, and then do the same as #1 above. This way you have full control over the UI that is used to place the signature tab (sometimes we call this "the tagger").

The code for # 1 is :

$sign_here = new SignHere(['document_id' => '1', 'page_number' => '1',
                                      'x_position' => '191',
                                      'y_position' => '148'
                                  ]);
$signer->setTabs(new Tabs(['sign_here_tabs' => [$sign_here]       ]));