Embeddable Payment SDK for 3DS integration (A55)
npm install a55pay-sdkJavaScript SDK for payment integration with 3DS authentication, Device Data Collection and ThreatMetrix fingerprinting.
Include the SDK in your HTML:
``html`
`html`
Main method for payments with complete authentication.
Parameters:
- charge_uuid (string, required): Transaction UUIDuserData
- (object, required): User and card dataonReady
- (function, optional): Callback when SDK is readyonSuccess
- (function, optional): Success callbackonError
- (function, optional): Error callback
Tests authentication only without making payment.
`javascript`
A55Pay.authentication({
transactionReference: "550e8400-e29b-41d4-a716-446655440000",
cardBrand: "Visa",
cardExpiryMonth: "12",
cardExpiryYear: "2028",
cardNumber: "4111111111111111",
onSuccess: function(result) {
console.log("Authentication completed:", result);
// result.sessionId can be used in payment
},
onError: function(error) {
console.log("Authentication error:", error);
}
});
Returns the current Device ID generated by ThreatMetrix.
`javascript`
const deviceId = A55Pay.getDeviceId();
console.log("Device ID:", deviceId);
Generates a new Device ID.
`javascript`
const newDeviceId = A55Pay.regenerateDeviceId();
console.log("New Device ID:", newDeviceId);
`javascript
const userData = {
// Payer
payer_name: "Full Name",
payer_email: "email@example.com",
payer_tax_id: "000.000.000-00",
cell_phone: "(11) 99999-9999",
// Card
holder_name: "NAME ON CARD",
number: "0000000000000000",
expiry_month: "MM",
expiry_year: "YYYY",
ccv: "123", // OR card_cryptogram
// Alternative card
card_token: "card_token",
card_cryptogram: "3ds_cryptogram",
// Address
postal_code: "00000-000",
street: "Street Name",
address_number: "123",
neighborhood: "Neighborhood Name",
complement: "Apt 101",
city: "City Name",
state: "SP",
country: "BR"
// Shipping address (if different from billing)
shipping_postal_code: "00000-000",
shipping_street: "Shipping Street",
shipping_address_number: "456",
shipping_complement: "Block B",
shipping_neighborhood: "Shipping Neighborhood",
shipping_city: "Shipping City",
shipping_state: "RJ",
shipping_country: "BR"
};
`
1. Initialization: SDK loads ThreatMetrix and generates Device ID
2. Authentication: CyberSource Device Data Collection
3. IP Collection: Multiple methods (Ipify, HTTPBin, WebRTC)
4. Send: Complete payload to payment API
5. 3DS: If needed, opens modal for authentication
6. Result: Success or error callback
- ThreatMetrix: Advanced device fingerprinting
- CyberSource: Device Data Collection for 3DS
- 3DS 2.0: Strong authentication when needed
- IP Detection: Multiple methods for maximum compatibility
For questions or issues:
1. Check browser console logs
2. Test with provided examples
3. Use authentication-test.html` file for isolated debugging