Skip to main content
Document Verification

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

Instructions

Follow the steps below:

  1. 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

    FieldDescription
    publicIntegrationKeyMerchant's public integration key
    countryCustomer country code.
    2-digit String
    International standard - ISO 3166-1 alpha-2
    modetest or production
  2. Create object

    Create an object with the document information.

    const docInformation = {
    type: 'br_cpf',
    document: '85351346893',
    };

    Available values for type

    CountryDocumentParameter Value
    ArgentinaCDIar_cdi
    ArgentinaCUILar_cuil
    ArgentinaCUITar_cuit
    ArgentinaDNIar_dni
    BrazilCPFbr_cpf
    BrazilCNPJbr_cnpj
    ChileRUTcl_rut
    ColombiaCCco_cc
    ColombiaCEco_ce
    ColombiaNITco_nit
    EcuadorDOCec_doc
    PeruDOCpe_doc
    UruguayCIuy_ci
    South AfricaIDza_id
    GuatemalaDPIgt_dpi
    Costa RicaCNcr_cn
    PanamaCNpa_cn
    El SalvadorDUIsv_dui
  3. 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
    });
  4. Response

    The following object is returned as a Promise.

    check_circleValid Document
    // verificationData
    {
    "status": "success",
    "data": {
    "document": {
    "isValid": true,
    "maskedField": "853.513.468-93"
    }
    }
    }
    cancelInvalid Document
    // verificationData
    {
    "status": "success",
    "data": {
    "document": {
    "isValid": false,
    "maskedField": ""
    }
    }
    }
  5. Congratulations!

    You have succesfully integrated a Document Verification using EBANX.js.

Still need help?

Help Image

We hope this article was helpful. If you still have questions, you can explore the following options: