How to Integrate?
- Add JS sdk to script tagThe sdk can be downloaded from base_url/sdk/v11/digio.js
- For sandbox:
- base_url : https://ext.digio.in
- For production:
- base_url : https://app.digio.in
- For sandbox:
<script type="text/javascript" src="https://app.digio.in/sdk/v11/digio.js"></script>
The sdk requires an instance of the Digio class to start the process. Read Digio JS API below for implementation details. Once the Digio instance is available with the correct options configuration, it can be used to trigger the flow.
The flow requires following 3 steps
- Instantiation
var options = {
environment: "production",
callback: function(response) {
if (response.hasOwnProperty("error_code"){
return console.log("error occurred in process");
}
console.log("Signing;completed;successfully:");
},
logo: "https://www.mylogourl.com/image.jpeg",
theme: {
primaryColor: "#AB3498",
secondaryColor: "#000000"
}
};
var digio = new Digio(options);
- Initialization
digio.init();
- Submission```
// DID KID from Step-1 response, customer identifier
digio.submit(documentId, identifier)// If using TOKEN APPROACH: From Step-1 response (KID/DID, …., GWT)
digio.submit(requestId, identifier, token_id);````````````
- Cancel
// cancels the transaction in between by closing the popup/iframe window, not applicable in redirection_approach
digio.cancel()
Digio options Properties
- environment : String
<sandbox, production> - logo : String
<url for your brand logo>Is_redirection_approach supports from SDK v10. Iframe and callback are not required in this case - Is_redirection_approach : Boolean
<true/false> - redirect_url :
<url to be redirected to in case of successful process completion>The redirection will contain the above success response object as query parameters. - is_iframe : Boolean
Set to true to make the popup open in iframe. - event_listener : function(event)
Refer this document for more info- Event Object Properties
- documentId : String
- txnId : String
- entity : String
- identifier : String
- event : String
- payload : Object
- type : 'error' | 'info'
- data : Object
- error : Object
- code : String
- message : String
- Event Object Properties
- event_filter : Object
- events : String[]
['sign.initiated', ...]
- events : String[]
- callback : function(response)
Callback function is triggered, either on successful completion of the process or on an error occurring. It has one parameter as response with the following structure. response object on success:- Response Object Properties
- txn_id : String
<Transaction id for current transaction> - digio_doc_id : String
<Digio generated id for the document> - message : String
<Description Message> - error_code : String
<Error code for failure>
- txn_id : String
- Response Object Properties
- method : String
(Optional) : biometric in case Biometric Esign Approach
Methods
- init()
This method is used to create a popup window for the digio application. It configures the window for optimal view. It must be called at some user event like clicking of a button, and not in any callback or asynchronous method, else the browser’s popup blocker blocks the window from opening. - submit(
<document ids array> or <documentId>,identifier)Parameters : DocumentId : e.g ["DID12345", "DID123123"] , "DID54321"Identifier : email or mobile e.g. "email@gmail.com" / "9087654321"This method redirects the popup to the required digio application page based on document id/ids provided.It functions with a single document id passed as a string or an array of document ids passed. If an array of document ids is passed it shall invoke a sequential multidoc signing process and all the documents in the array shall be signed one by one. - cancel()
This method cancels the transaction by closing the popup window.
Gateway Events :
Refer Gateway Event document for all possible events and error data : Gateway Event Doc