DocuSign Integration


Brief:

DocuSign provides electronic signature technology and Digital Transaction Management services for facilitating electronic exchanges of contracts and signed documents. DocuSign’s features include authentication services, user identity management and workflow automation. Signatures processed by DocuSign are comparable to traditional signatures based on the product's compliance with the ESIGN  Act as well as the European Union’s Directive 1999/93/EC on electronic signatures.

Need: 

Every business agreement requires to meet both parties physically and sign on the agreement paper. This agreement paper is a legally biding to both the parties for terms defined in the document. Consider a case where both the parties are in 2 different reagions, East Cost and West cost. In this case it becomes diffecult to meet at one place sometimes. Also it is a costly. Another example, suppose you have a website and you have users across the country. In this case we can use DocuSign API. We can send the document to the recepient over email. That link redirects the user to DocuSign website where he/she can sign the document. We can also integrate the DocuSign UI in our website with the help of iFrame. DocuSign provides multiple ways to implement document signing feature, Rest API, SOAP API, API Recipes, SDK in C#, Java, Objective-C, Node & PHP.

How It Works:

Here is a sample implementation in C#.

1. Install .Net framework 4.5 or higher
2. Sign up for a free sandbox account with DocuSign here https://www.docusign.com/developer-center
3. In Visual Studio project, Add a Nuget package for DocuSign.
4. It will add a dll, DocuSign.eSign.dll
5. If you do not have Newtonsoft (Newtonsoft.Json.dll) and RestSharp (RestSharp.dll) assemblies then it will auto detenct and install.
6. Use below code to send a signature request from a template.

using DocuSign.eSign.Api;
using DocuSign.eSign.Model;
using DocuSign.eSign.Client;

namespace DocuSignSample
{
class Program
{
static void Main(string[] args)
{
string username = "[EMAIL]";
string password = "[PASSWORD]";
string integratorKey = "[INTEGRATOR_KEY]";// it can be found in profile after login into Sandbox account. Got to preferences and click on API menu in bottom left in menu panel.

// initialize client for desired environment (for production change to www)
ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
Configuration.Default.ApiClient = apiClient;

// configure 'X-DocuSign-Authentication' header
string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}";
Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);

// we will retrieve this from the login API call
string accountId = null;

/////////////////////////////////////////////////////////////////
// STEP 1: LOGIN API
/////////////////////////////////////////////////////////////////

// login call is available in the authentication api
AuthenticationApi authApi = new AuthenticationApi();
LoginInformation loginInfo = authApi.Login();

// parse the first account ID that is returned (user might belong to multiple accounts)
accountId = loginInfo.LoginAccounts[0].AccountId;

/////////////////////////////////////////////////////////////////
// STEP 2: CREATE ENVELOPE API
/////////////////////////////////////////////////////////////////

// create a new envelope which we will use to send the signature request
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Sample Signature Request";

// provide a valid template ID from a template in your account
envDef.TemplateId = "[TEMPLATE_ID]";

// assign recipient to template role by setting name, email, and role name. Note that the
// template role name must match the placeholder role name saved in your account template.
TemplateRole tRole = new TemplateRole();
tRole.Email = "[SIGNER_EMAIL]";
tRole.Name = "[SIGNER_NAME]";
tRole.RoleName = "[ROLE_NAME]";

// add the roles list with the our single role to the envelope
List rolesList = new List() { tRole };
envDef.TemplateRoles = rolesList;

// set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent";

// |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
}
}
}

Boston Byte Grabs a Spot in Clutch’s List of Top Software Developers in Massachusetts

Boston Byte is a collective of highly-skilled and highly-professional developers dedicated to solving your technological ...