The EBANX Document Verification feature enhances the security of your payment process by validating the format and structure of customer-provided document numbers (e.g., national IDs or passports). This ensures that the input from the form field matches the specific masking requirements for the selected document type, helping you maintain compliance with local regulations and reduce the risk of errors or fraud.
Requirements
- Credentials
- Ensure you have your EBANX.js Public Integration Key, which can be found in your EBANX Dashboard.
- If you don't have it, complete the Merchant Signup Form.
Instructions
Follow the steps below:
Install EBANX.js
Insert script tag
Add the following to your HTML.
<script src="https://ebanx-js.ebanx.com/latest/dist/ebanx.min.js"></script>
Initialize
Include the following function in your JavaScript.
EBANX.init({
publicIntegrationKey: '{your_public_integration_key}',
country: '{country_code_here}',
mode: 'test',
});Initialization parameters
Field Description publicIntegrationKey
Merchant's public integration key country
Customer country code.
2-digit String
International standard - ISO 3166-1 alpha-2mode
test
orproduction
Create object
Create an object with the document information.
const docInformation = {
type: 'br_cpf',
document: '85351346893',
};Available values for
type
Country Document Parameter Value Argentina CDI ar_cdi Argentina CUIL ar_cuil Argentina CUIT ar_cuit Argentina DNI ar_dni Brazil CPF br_cpf Brazil CNPJ br_cnpj Chile RUT cl_rut Colombia CC co_cc Colombia CE co_ce Colombia NIT co_nit Ecuador DOC ec_doc Peru DOC pe_doc Uruguay CI uy_ci South Africa ID za_id Guatemala DPI gt_dpi Costa Rica CN cr_cn Panama CN pa_cn El Salvador DUI sv_dui Check if document is valid
Call the
EBANX.utils.document.check
function using the object created in the previous step.EBANX.utils.document
.check(docInformation)
.then((verificationData) => {
// use verificationData to fullfil payment
})
.catch((error) => {
// handle errors
});Response
The following object is returned as a Promise.
check_circleValid DocumentcancelInvalid Document// verificationData
{
"status": "success",
"data": {
"document": {
"isValid": true,
"maskedField": "853.513.468-93"
}
}
}// verificationData
{
"status": "success",
"data": {
"document": {
"isValid": false,
"maskedField": ""
}
}
}Congratulations!
You have succesfully integrated a Document Verification using EBANX.js.
Still need help?
We hope this article was helpful. If you still have questions, you can explore the following options:
- Merchant support: Contact our support team at sales.engineering@ebanx.com for assistance.
- Not a partner yet? Please complete the Merchant Signup Form, and our commercial team will reach out to you.