First signer will be redirected (api.php) to the DocuSign signing process or it returns the uri to start the process (lib.php).
An example usage of the lib.php can be found in the example.lib.php.
- Create and Login to you DocuSign admin Account.
- Open AdminPanel
- Create an API under "Integrations" Store the RSA private and public key in a secret and safe place!
- The APIs
Integration keyis theDS_CLIENT_ID - Grab your DS_IMPERSONATED_USER_GUID from "Users" and edit a user. The GUID is shown as
User name - To add
Redirect URIs|Return URLsopen the API and check theAdditional settingsarea ;)
Requirements: PHP v5.4 or later + composer
- Download files
- install composer
curl -sS https://getcomposer.org/installer | php - simply install vendors with
php composer.phar install - Check
example.envand create a new.envfile and paste the content of the example and fill in the valid values, if .env not supported, just useds_config.ini - run the
example.lib.phpor start a php server and call theapi.php
DS_CLIENT_ID- INTEGRATION_KEY # (Go To DocuSign Admin Panel - Integrations - Api And Keys - Add Api and copy integration key)DS_AUTH_SERVER- default: "https://account-d.docusign.com"DS_IMPERSONATED_USER_GUID- USER_ACCOUNT_GUID # (Admin Panel - Users - select user - User name), If the user is not already allowed to use the API, open:https://account-d.docusign.com/oauth/auth?response_type=token&scope=signature%20impersonation&client_id={the client id}&redirect_uri={a valid return url}DS_TARGET_ACCOUNT_ID- defaultFALSE(not needed?)DS_PRIVATE_KEY_FILE- defaultFALSE- we have inline pricate key hereDS_PRIVATE_KEY- RSA private key string you get from docsign during API setup
-
POST to
api.php -
form data:
pdf_base64_content- pdf file as base64 stringpdf_title- The title of the pdf filereturn_url- return url defined in docsign admin panel - redirected to after successful signingname[] | name- name array of signer full names (index should be match email)email[] | email- email array of signer emails (index should be match name)page- page where the sign field should be added in the documentpos_y[]&pos_x[]- x and y values where the sign fields should be presentedemail_subject- the email subject used when sending sign email
-
redirects to DocuSign and starts signing process for the first
nameandemail! -
sends signing mails to all other names and mails
-
for production:
- cors is disabled per default
- enable it by setting the allowed hosts in
api.php:
// header("Access-Control-Allow-Origin: HOSTS");
header("Access-Control-Allow-Origin: *");
- provides the
createEnvelopsAndGetViewUrifunction - accepts a params object:
pdf_base64_content- pdf file as base64 stringpdf_title- The title of the pdf filereturn_url- return url defined in docsign admin panel - redirected to after successful signingname[] | name- name array of signer full names (index should be match email)email[] | email- email array of signer emails (index should be match name)page- page where the sign field should be added in the documentpos_y&pos_x- x and y values where the sign field should be presentedemail_subject- the email subject used when sending sign email
- returns the URI to DocuSign to start the signing process for the first
nameandemail! - sends signing mails to all other names and mails