JavaScript API
The JavaScript API is a resource that allows you easily incorporate the digital and electronic signature feature into your application. This API opens a modal window in your application that handles everything that is required to make the signature and returns the status of the performed action to your application.
How it Works?
Before to make any signature a document should be sent to signature. It's done using our Signature Rest APIs, where you should upload a file and then submit it filling the signer's info. So, you get a response with all required data to sign from your application with the JavaScript API.
You can see this JavaScript API working in our tool Sign that simulates an integrated client. You can also download the sample page and try out.
-
Digital Signature
The modal window uses a browser extension to perform the digital signature. The signer will be redirected to download the plugin at the first time that tries to sign.
-
Individual Signature
You should provide the unique signature URL that is returned in the field
signUrl
from the API Create response. -
Batch Signature
In order to perform signature of a batch of documents you should provide to this API a list of document keys, such as the signer identifier for these documents, which you get from the API CreateBatch. You can also use the API Create to submit individual documents, grouping its keys for later use.
Uses the parameter
chave
from the Create API response and the signer identifier must be provide.
-
-
Electronic Signature
The modal window uses a PAD to capture the handwritten signature and optionally could be only a Click Through. In addition, a second authetication factor could be required to the signer, such as SMS, Access Code or FaceCheck. See how to submit a document for Electronic Signature here.
Documentation
Índice
Constructor
Parameters
- url
Use /Assinatura/AssinarLoteFrame to sign a batch of documents or the complete url to sign a individual document
- width
Modal width
- heigth
Modal heigth
- closeOnFinishbool
Close the modal on finish the the signature(s)
- confirmCloseConfigobject (opcional)
Sets the confirmation message when trying to close the modal. If omitted, default message will be used.
{
textMessage
: Message to be displayed (Default: "Closing will stop the signing process. Confirm?"),
textOkButton
: Text for OK button (Default: "Ok"),
textCancelButton
: Text for OK Cancel button (Default: "Cancel")
} -
disableCloseInProcessingnullable bool (optional)
false
: Allows you to close modal without confirmation while signing.
If it is modal closed during signing, there will be a temporary inconsistency in the status of signatures already made, which will be updated the next time you try to sign.
true
: Disables the close action ('X' in the top-right corner of the modal), preventing its closing.
null
orundefined
: Shows the confimation massage defined in parameterconfirmCloseConfig
Individual Signature
Invoking the sign() method without parameters opens the modal window with the url (informed in the constructor method) for single signature.
sign().onSignCompleted(function (signStatus) {...} )
Parameters
-
(without parameters)
-
Output
-
signStatus
int
-1
- Error
0
- Document already signed
1
- Success
Sample
new window.CertisignIntegration(
'https://sandbox.portaldeassinaturas.com.br/Assinatura/AssinarFrame/53462?chave=6C25692F03DB1F71', //url
//To Electronic Signature the url will be slightly different:
//https://sandbox.portaldeassinaturas.com.br/Assinatura/AssinarEletronicoFrame/1234?chave=A8034FD039B89082
850, 830, //width, height
false, //closeOnFinish
//{confirmCloseConfig} (optional)
{ textOkButton: 'Yes', textCancelButton: 'No',
textMessage: 'Stopping the signing process will cause signature status inconsistency. '+
'However, the next time you try to sign the status will be updated. '+
'Do you really want to interrupt the signature process?'
}
)
.sign()
.onSignCompleted(function (signStatus) {
console.log(signStatus);
//Output sample: '1'
}
);
Batch Signature
Invoking the sign() method with parameters opens the modal window with the url (informed in the constructor method) for batch signature.
sign(docList, signer).onSignCompleted(function (signStatus) {...} )
Parameters
- docList array/string
List of document keys to sign, in array format or comma-separated string
Eg.
-"A030D14B5F054A66,3EA369A2AF2B9F92"
-["A030D14B5F054A66","3EA369A2AF2B9F92"]
- signerstring
Signer identifier (In Brazil it's the CPF)
-
Output
- signStatusarray/string
[s1,s2,s3,...]
(if docList is array) - array with status for each document
Eg.[0,-1,1]
"s1,s2,s3,..."
(if docList is a comma-separated string) - comma-separated string with status for each document
Eg."0,-1,1"
Sample
new window.CertisignIntegration(
'https://sandbox.portaldeassinaturas.com.br/Assinatura/AssinarLoteFrame', //url
1200, 560, //width, height,
false, //closeOnFinish
// {confirmCloseConfig} (optional)
{ textOkButton: 'Yes', textCancelButton: 'No',
textMessage: 'Stopping the signing process will cause signature status inconsistency. '+
'However, the next time you try to sign the status will be updated. '+
'Do you really want to interrupt the signature process?'
}
)
.sign(
'A030D13B5F054A66,3EA369C2AF2B9F92', //docList: An array can also be used array: ['A030D14B5F054A66','3EA369A2AF2B9F92']
'123.456.789-01', //signerIndividualIdentificationCode (Brazilian CPF)
)
.onSignCompleted(function (signStatus) {
console.log(signStatus);
//Output sample: '1,0,-1' (or ['1','0','-1'], if "docList" was an array of strings)
}
);
Download
Enter this page to download the sample and try out