Cards with 3DS 2
3DS 2 at EBANX is a security feature designed to add an extra layer of authentication for card transactions, enhancing protection against fraud and improving compliance with international security standards. With 3DS 2, cardholders go through a streamlined verification process, where additional checks are performed without disrupting the user experience. This method provides risk-based authentication, meaning only transactions flagged as high-risk may require customer interaction, making the process smoother for most users. EBANX’s 3DS 2 implementation supports a variety of card networks and integrates directly with your payment flow.
Requirements
- API credentials - Make sure you have your EBANX integration key. If not, complete the Merchant Signup Form.
Authentication methods
There are three methods to authenticate a payment when using 3DS:
- EBANX SDK Authentication - The integration utilizes the EBANX.js Client SDK for authentication. The data obtained is subsequently included in the payment request payload transmitted via the EBANX Direct API. This approach is favored for delivering a superior shopper experience.
- EBANX Direct API Authentication - In this integration, EBANX provides a redirect URL to facilitate the shopper's authentication process via the Direct API. This method offers a streamlined approach for initiating the authentication service.
- External Authentication - Authentication is managed through an external Third-Party Authenticator. The authentication data obtained is subsequently incorporated into the payment request, which is processed using the EBANX Direct API.
Choose authentication method
- EBANX SDK Authentication
- EBANX Direct API Authentication
- External Authentication
Follow the steps below to integrate 3DS 2 using EBANX SDK Authentication.
Integrate the SDK into your webpage
Add the EBANX.js SDK to your webpage using the following script:
<script type="text/javascript" src="https://ebanx-js.ebanx.com/latest/dist/ebanx.min.js"></script>
Initialize the SDK with your merchant configuration:
EBANX.init({
publicIntegrationKey: '{your_public_integration_key}',
country: '{country_code_here}',
mode: 'test',
});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
Define your options
Create
orderInformation
,paymentInformation
andpersonalIdentification
with the following fields:// Order Information
const orderInformation = {
amountDetails: {
totalAmount: '10.04',
currency: 'BRL',
},
billTo: {
address1: 'Rua Estanislau Szarek',
administrativeArea: 'PR',
country: 'BR',
email: '1584023172@exemplo.com.br',
homePhone: '41999999999',
locality: 'Curitiba',
postalCode: '81315380',
mobilePhone: '41999999999',
},
};
// Payment Information
const paymentInformation = {
card: {
number: '4000000000001000',
expirationMonth: '12',
expirationYear: '34',
holderName: 'JOAO DA SILVA',
},
paymentMethod: 'creditcard', // Set to 'creditcard', or 'debitcard'.
dataOnly: true, // Set to true for Data Only authentication flow.
};
// Personal Identification
const personalIdentification = {
id: '97370192024',
type: 'CPF',
};Data-Only flow.The 3D Secure (3DS) Data-Only flow enhances online transaction security and boosts authorization rates by eliminating the need for user authentication, ensuring a seamless customer experience. In this process, merchants provide the additional data required by 3DS 2 directly to card schemes (e.g., Mastercard, Visa). These schemes incorporate the risk data into the authorization message, enabling issuers to make more informed and confident decisions. use the
paymentInformation.dataOnly
parameter to enable this workflow.Authenticate your payment request
Invoke Authentication Method
Invoke
EBANX.threeDSecure.authenticate
using objects from previous step.const options = {
orderInformation,
paymentInformation,
personalIdentification,
};
EBANX.threeDSecure.authenticate(options)
.then((authenticationData) => {
// Use authenticationData in your `Create Payment` API request.
})
.catch((error) => {
// Handle Errors
});Method Response
The
EBANX.threeDSecure.authenticate
method returns a Promise object, so it's important to handle the asynchronous call properly, typically by using a.then()
callback orasync/await
. A successful authentication response will contain the following fields, though the values may vary with each authentication:// authenticationData
{
threeds_eci: "05",
threeds_cryptogram: "AAIBAkl0NwmHglFBAXQ3AAAAAAA",
threeds_xid: "AAIBAkl0NwmHglFBAXQ3AAAAAAA",
threeds_version: "2",
threeds_trxid: "AAIBAkl0NwmHglFBAXQ3AAAAAAA"
}Method Failure
If authentication fails, you can simply retry the request. Common causes include:
- Invalid customer input
- Issuer unavailable
- Communication issue
Create a payment request
Use the EBANX Direct API to create a payment request.
- Embed
authenticationData
into your request.- Specifically, embed within the
payment.card
object. - See examples below.
- All other data within the request body should remain the same.
- Specifically, embed within the
- When you are ready to the construct your EBANX Direct API request, refer to one of the following:
Examples:
-Using Spread Operator:
// payment.card object in your EBANX Direct API request
"payment" : {
"card": {
"card_number": 4000000000001000,
"card_name": "JOAO DA SILVA",
"card_due_date": "12/2034",
"card_cvv": "123",
...authenticationData // Spread Operator
}
}Older Javascript:
// payment.card object in your EBANX Direct API request
"payment" : {
"card": {
"card_number": 4000000000001000,
"card_name": "JOAO DA SILVA",
"card_due_date": "12/2034",
"card_cvv": "123",
"threeds_eci": "05",
"threeds_cryptogram": "AAIBAkl0NwmHglFBAXQ3AAAAAAA",
"threeds_xid": "AAIBAkl0NwmHglFBAXQ3AAAAAAA",
"threeds_version": "2",
"threeds_trxid": "AAIBAkl0NwmHglFBAXQ3AAAAAAA"
}
}ImportantIn cases where authentication isn't required, such as with Caixa debit cards,
EBANX.threeDSecure.authenticate
returns an empty object. To avoid issues, we recommend using a spread operator when adding the response to your payment. This ensures that if the object is empty, it won't disrupt your payment process.- Embed
Congratulations!
You have completed the necessary steps to create a card payment using 3DS 2.
Follow the steps below to use EBANX Direct API Authentication for 3DS 2.
Integrate with EBANX Direct API
Before authenticating with the EBANX Direct API, you must first successfully create a payment request. If you have not yet completed this prerequisite step, the following information will guide you.
Once this prerequisite is met, you can proceed with the authentication steps outlined below.
Define your 3DS Mode option during the payment request
The
threeds_mode
field in EBANX Direct API allows merchants to specify the type of 3DS authentication desired for a transaction. This enables tailored authentication flows to meet specific business requirements while maintaining a consistent API response structure. It is mandatory to send thethreeds_redirect_url
for the redirect modes (details below), this URL is the destination where the shopper is redirected after completing the 3DS authentication process in a redirect flow. They are added to the Ebanx Direct API request payload within thecard
object, e.g:{
"integration_key": "your_test_integration_key_here",
"operation": "request",
"payment": {
"name": "José Silva",
"email": "jose@example.com.co",
"document": "4023030074",
"address": "Rua E",
"street_number": "1040",
"city": "Medellín",
"state": "Antioquia",
"zipcode": "29269",
"country": "co",
"phone_number": "8522847035",
"payment_type_code": "creditcard",
"merchant_payment_code": "3ad1f4096a22",
"currency_code": "COP",
"instalments": 3,
"amount_total": 1000000,
"card": {
"card_number": "4111111111111111",
"card_name": "José Silva",
"card_due_date": "12/2025", // Ensure the date is in the future
"card_cvv": "123",
"threeds_mode": "redirect_full_authentication",
"threeds_redirect_url": "https://www.merchant.com/3ds-response"
},
}
}The
threeds_mode
andthreeds_redirect_url
accept the following values:Field Description threeds_mode
redirect_full_authentication: Performs a Full 3DS authentication, with the possibility of liability shift for the card issuer. The API response will include another Redirect URL, prompting the cardholder to start the authentication on a separate page. The cardholder would be redirected to their issuing bank for authentication.
redirect_data_only: Performs a Data-Only 3DS authentication, with an git expectation of improvement in the approval rate. The API response will include another Redirect URL, prompting the cardholder to start the authentication on a separate page. Liability remains with the merchant. The cardholder is never redirected to their issuing bank for authentication.
data_only: Performs a Data-Only 3DS authentication. No Redirect URL is used, and device fingerprinting is skipped. Liability remains with the merchant. The cardholder is never redirected to their issuing bank for authentication.
data_only_preferred: Performs a Data-Only 3DS authentication. No Redirect URL is used, and device fingerprinting is skipped. If the authentication fails, the transaction will be processed without 3DS information. Liability remains with the merchant in both cases. The cardholder is never redirected to their issuing bank for authentication.threeds_redirect_url
The Return URL to which the shopper is redirected after completing the 3DS authentication flow. Your application should handle the authentication result at this endpoint ImportantFor
data_only
anddata_only_preferred
modes is mandatory to send thebrowser_info
object in Direct API request. Here's an example:{
"integration_key": "your_test_integration_key_here",
"operation": "request",
"payment": {
"name": "José Silva",
"email": "jose@example.com.co",
"document": "4023030074",
"address": "Rua E",
"street_number": "1040",
"city": "Medellín",
"state": "Antioquia",
"zipcode": "29269",
"country": "co",
"phone_number": "8522847035",
"payment_type_code": "creditcard",
"merchant_payment_code": "3ad1f4096a22",
"currency_code": "COP",
"instalments": 3,
"amount_total": 1000000,
"card": {
"card_number": "4111111111111111",
"card_name": "José Silva",
"card_due_date": "12/2025",
"card_cvv": "123",
"threeds_mode": "data_only"
},
}
"browser_info": {
"ip_address": "127.0.0.1",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
"language": "es-ES",
"color_depth": "24",
"screen_height": "1080",
"screen_width": "1920",
"timezone_offset": "-300", // UTC-5
"javascript_enabled": true,
"java_enabled": true
}
}Payment response
Response format for
redirect_full_authentication
orredirect_data_only
modesThe API response structure remains consistent, regardless of the
threeds_mode
used. This ensures backward compatibility for existing integrations. The 3DS authentication results will be reflected within thethreedsecure
object of the response and with the EBANX URL Redirect used to authenticate the Consumer in the fieldthreedsecure.threeds_redirect_url
. See the example below:{
"payment": {
"hash": "595cf4c4f4f05575625ff33121fa23b132de5755568c27b8",
"pin": "131834024",
"merchant_payment_code": "1499263766",
"order_number": null,
"status": "CO",
"status_date": "2017-07-05 14:16:47",
"open_date": "2017-07-05 14:16:35",
"confirm_date": "2017-07-05 14:16:47",
"transfer_date": null,
"amount_br": "15000.00",
"amount_ext": "15000.00",
"amount_iof": "0.00",
"amount_usd": "4.90",
"currency_rate_usd": "3060.8188",
"currency_rate": "1.0000",
"currency_ext": "COP",
"due_date": "2017-07-05",
"instalments": "1",
"payment_type_code": "creditcard",
"details": {
"billing_descriptor": ""
},
"pre_approved": true,
"capture_available": false,
"threedsecure": {
"threeds_redirect_url": "https:\/\/ui-elements.ebanx.com\/three-d-secure?auth_token=aGFzaD02NzFiYjMwM2VmZDmdGVuYW51PUNST1NTX0JPUkRFUiZtb2RlPVBST0RVQ1RJT04mY291bnRyeT1jbA==",
"has_threeds": true,
"status": "PENDING_AUTHENTICATION",
"threeds_attempts": [],
"threeds_result": null
}
},
"status": "SUCCESS"
}After completing the 3DS challenge by the shopper, the final response, using the EBANX Query Utils, will resemble the following example:
{
"payment": {
"hash": "673647a0d32842281ab72972a629a91dba1895b9b55g3k91",
"country": "br",
"merchant_payment_code": "1731610456",
"order_number": null,
"status": "CO",
"status_date": "2024-11-14 18:56:20",
"open_date": "2024-11-14 18:55:28",
"confirm_date": "2024-11-14 18:56:20",
"transfer_date": null,
"amount_br": "5.00",
"amount_ext": "4.98",
"amount_iof": "0.02",
"amount_ext_requested": "5.00",
"currency_rate": "1.0000",
"currency_ext": "BRL",
"due_date": "2024-11-17",
"instalments": "1",
"payment_type_code": "mastercard",
"details": {
"billing_descriptor": "EBN*DEMONSTRATION"
},
"transaction_status": {
"acquirer": "EBANX",
"code": "OK",
"description": "Accepted",
"authcode": "572123",
"iso_code": "00",
"mac_code": ""
},
"pre_approved": true,
"capture_available": false,
"threedsecure": {
"has_threeds": true,
"status": "AUTHENTICATION_DONE",
"threeds_attempts": [
{
"attempt_number": 1,
"attempt_status": "AUTHENTICATION_DONE",
"threeds_reference": "3DS2412632847456",
"eci": "02",
"pares_status": "Y",
"pares_status_description": "Customer was successfully authenticated."
}
],
"threeds_result": {
"attempt_number": 1,
"attempt_status": "AUTHENTICATION_DONE",
"threeds_reference": "3DS2412632847456",
"eci": "02",
"pares_status": "Y",
"pares_status_description": "Customer was successfully authenticated.",
"liability": "ISSUER_BANK"
}
}
},
"status": "SUCCESS"
}If authentication fails, the response will be as follows example:
{
"payment": {
"hash": "673647a0d32842281ab72972a629a91dba1895b9b55g3k91",
"country": "br",
"merchant_payment_code": "1731610456",
"order_number": null,
"status": "CA",
"status_date": "2025-02-16 22:47:32",
"open_date": "2025-02-16 22:47:14",
"confirm_date": null,
"transfer_date": null,
"amount_br": "5.00",
"amount_ext": "4.98",
"amount_iof": "0.02",
"amount_ext_requested": "5.00",
"currency_rate": "1.0000",
"currency_ext": "BRL",
"due_date": "2024-11-17",
"instalments": "1",
"payment_type_code": "mastercard",
"details": {
"billing_descriptor": "MERCHANT.COM"
},
"pre_approved": false,
"capture_available": null,
"threedsecure": {
"has_threeds": true,
"status": "UNABLE_TO_AUTHENTICATE",
"threeds_attempts": [
{
"attempt_number": 1,
"attempt_status": "UNABLE_TO_AUTHENTICATE",
"threeds_reference": "3DS2605301091234",
"eci": "07",
"status_reason": "Encountered a Payer Authentication problem. Payer could not be authenticated.",
"pares_status": "N",
"pares_status_description": "Customer failed or canceled authentication. Transaction denied."
}
],
"threeds_result": {
"attempt_number": 1,
"attempt_status": "UNABLE_TO_AUTHENTICATE",
"threeds_reference": "3DS2605301091234",
"eci": "07",
"status_reason": "Encountered a Payer Authentication problem. Payer could not be authenticated.",
"pares_status": "N",
"pares_status_description": "Customer failed or canceled authentication. Transaction denied."
}
}
},
"status": "SUCCESS"
}Response format for
data_only
ordata_only_preferred
modesThe API response structure remains consistent, regardless of the threeds_mode used. This ensures backward compatibility for existing integrations. The 3DS authentication results will be reflected within the
threedsecure
object of the response. See the example below:"payment": {
"hash": "673647a0d32842281ab72972a629a91dba1895b9b55g3k91",
"country": "br",
"merchant_payment_code": "1731610456",
"order_number": null,
"status": "CO",
"status_date": "2024-11-14 18:56:20",
"open_date": "2024-11-14 18:55:28",
"confirm_date": "2024-11-14 18:56:20",
"transfer_date": null,
"amount_br": "5.00",
"amount_ext": "4.98",
"amount_iof": "0.02",
"amount_ext_requested": "5.00",
"currency_rate": "1.0000",
"currency_ext": "BRL",
"due_date": "2024-11-17",
"instalments": "1",
"payment_type_code": "mastercard",
"details": {
"billing_descriptor": "EBN*DEMONSTRATION"
},
"transaction_status": {
"acquirer": "EBANX",
"code": "OK",
"description": "Accepted",
"authcode": "572123",
"iso_code": "00",
"mac_code": ""
},
"pre_approved": true,
"capture_available": false,
"threedsecure": {
"has_threeds": true,
"status": "AUTHENTICATION_DONE",
"threeds_attempts": [
{
"attempt_number": 1,
"attempt_status": "AUTHENTICATION_DONE",
"threeds_reference": "3DS2412632847456",
"eci": "04",
"pares_status": "U",
"pares_status_description": "Data Only successfully. Liability remains with the merchant."
}
],
"threeds_result": {
"attempt_number": 1,
"attempt_status": "AUTHENTICATION_DONE",
"threeds_reference": "3DS2412632847456",
"eci": "04",
"pares_status": "U",
"pares_status_description": "Data Only successfully. Liability remains with the merchant.",
"liability": "MERCHANT"
}
}
},
"status": "SUCCESS"
}If authentication fails, the response will be as follows example:
ImportantIf the authentication fails when using
data_only_preferred
, the transaction will be processed without 3DS information. Liability remains with the merchant in both cases.{
"payment": {
"hash": "673647a0d32842281ab72972a629a91dba1895b9b55g3k91",
"country": "br",
"merchant_payment_code": "1731610456",
"order_number": null,
"status": "CA",
"status_date": "2025-02-16 22:47:32",
"open_date": "2025-02-16 22:47:14",
"confirm_date": null,
"transfer_date": null,
"amount_br": "5.00",
"amount_ext": "4.98",
"amount_iof": "0.02",
"amount_ext_requested": "5.00",
"currency_rate": "1.0000",
"currency_ext": "BRL",
"due_date": "2024-11-17",
"instalments": "1",
"payment_type_code": "mastercard",
"details": {
"billing_descriptor": "MERCHANT.COM"
},
"pre_approved": false,
"capture_available": null,
"threedsecure": {
"has_threeds": true,
"status": "UNABLE_TO_AUTHENTICATE",
"threeds_attempts": [
{
"attempt_number": 1,
"attempt_status": "UNABLE_TO_AUTHENTICATE",
"threeds_reference": "3DS2605301091234",
"eci": "07",
"status_reason": "Encountered a Payer Authentication problem. Payer could not be authenticated.",
"pares_status": "N",
"pares_status_description": "Customer failed or canceled authentication. Transaction denied."
}
],
"threeds_result": {
"attempt_number": 1,
"attempt_status": "UNABLE_TO_AUTHENTICATE",
"threeds_reference": "3DS2605301091234",
"eci": "07",
"status_reason": "Encountered a Payer Authentication problem. Payer could not be authenticated.",
"pares_status": "N",
"pares_status_description": "Customer failed or canceled authentication. Transaction denied."
}
}
},
"status": "SUCCESS"
}Congratulations!
You have completed the necessary steps to create a card payment using 3DS 2.
Follow the steps below to integrate 3DS 2 using External Authentication.
Authenticate the payment using external authenticator
The process for performing external authentication will vary depending on the provider you select.
Add the 3DS Authentication values to your payment
Now that the payment is authenticated, include the values obtained in Step 1 within the payments.card object in your Direct API call.
// payment.card object in your EBANX Direct API request
"payment" : {
"card": {
"card_number": 4000000000001091,
"card_name": "JOAO DA SILVA",
"card_due_date": "12/2034",
"card_cvv": "123",
"threeds_eci": "05",
"threeds_cryptogram": "AAIBAkl0NwmHglFBAXQ3AAAAAAA=",
"threeds_xid": "AAIBAkl0NwmHglFBAXQ3AAAAAAA=",
"threeds_version": "2"
"threeds_trxid": "AAIBAkl0NwmHglFBAXQ3AAAAAAA"
}
}Create a Payment Request
Use the EBANX Direct API to create a payment request.
- Embed
authenticationData
into your request.- Specifically, embed within the
payment.card
object. - See examples below.
- All other data within the request body should remain the same.
- Specifically, embed within the
- When you are ready to the construct your EBANX Direct API request, refer to one of the following:
Examples:
-Using Spread Operator:
// payment.card object in your EBANX Direct API request
"payment" : {
"card": {
"card_number": 4000000000001000,
"card_name": "JOAO DA SILVA",
"card_due_date": "12/2034",
"card_cvv": "123",
...authenticationData // Spread Operator
}
}Older Javascript:
// payment.card object in your EBANX Direct API request
"payment" : {
"card": {
"card_number": 4000000000001000,
"card_name": "JOAO DA SILVA",
"card_due_date": "12/2034",
"card_cvv": "123",
"threeds_eci": "05",
"threeds_cryptogram": "AAIBAkl0NwmHglFBAXQ3AAAAAAA",
"threeds_xid": "AAIBAkl0NwmHglFBAXQ3AAAAAAA",
"threeds_version": "2",
"threeds_trxid": "AAIBAkl0NwmHglFBAXQ3AAAAAAA"
}
}- Embed
Resources
Use the following resources when testing 3DS 2 in your sandbox environment.
Sample Cards
Click here to view mock card data to validate your payment integration.
ECI responses
Click here to access Electronic Commerce Indicator (ECI) responses.
Troubleshooting
3DS 2 Error Codes
When an error occurs, EBANX responds with a JSON object containing detailed error information.
- 3DSecure
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.