API Reference

A55Pay SDK - V2

💳 A55Pay SDK — Payment Integration Guide

End-to-end guide for integrating A55Pay SDK to process card payments with 3DS authentication, device fingerprinting, and automated callbacks.
Secure, fast, and developer-friendly.


🧭 Payment Flow Overview

sequenceDiagram
    autonumber
    participant Merchant as "🛒 Merchant"
    participant A55 as "💳 API A55"
    participant Script as "📜 A55 SDK"
    participant Serve3DS as "🛡️ A55 Server"

    rect rgba(191,223,255,0.2)
        Merchant->>A55: Create payment
        activate A55
        Note right of A55: Payment transaction starts
        A55-->>Merchant: Returns charge_uuid (for SDK)
        deactivate A55
    end

    Merchant->>Script: Initializes SDK using charge_uuid
    Script->>Serve3DS: Performs DDC, fingerprint, 3DS, payment data
    activate Serve3DS

    alt Challenge required
        Serve3DS-->>Script: 3DS challenge required
        Script->>Merchant: Displays 3DS modal to customer
        Merchant-->>Script: Customer completes challenge
    else No challenge required
        Serve3DS-->>Script: Returns result
    end
    deactivate Serve3DS

    rect rgba(200,255,200,0.2)
        Script->>A55: Sends authentication & payment data
        activate A55
        A55-->>Merchant: Returns final status (success/failure)
        deactivate A55
    end

✅ Prerequisites

Before integrating:

  • Serve your checkout over HTTPS (required for DDC/3DS).
  • The charge must already exist — created via API.
  • Provide a public webhook_url to receive final status updates.
  • (Optional) Implement a parent window listener for post-3DS updates or redirections.

⚙️ Step 1: Create a Charge (API)

Create the charge and store the returned charge_uuid to be used by the SDK.

{
  "wallet_uuid": "00000000-0000-0000-0000-000000000000",
  "merchant_id": "11111111-1111-1111-1111-111111111111",
  "payer_name": "John Doe",
  "payer_email": "[email protected]",
  "payer_cell_phone": "+5511999999999",
  "threeds_authentication": true,
  "items": [
    {
      "name": "Sample Product",
      "description": "Sample product description",
      "quantity": 1,
      "total_amount": 100.0,
      "unit_amount": 100.0,
      "sku": "SAMPLE-SKU-123",
      "code": "SAMPLE-CODE-456"
    }
  ],
  "currency": "BRL",
  "installment_value": 100.0,
  "installment_count": 1,
  "due_date": "2025-12-31",
  "description": "Sample purchase description",
  "type_charge": "credit_card",
  "webhook_url": "https://webhook.example.com/endpoint",
  "redirect_url": "https://redirect.example.com"
}

Tips

  • Include full payer_*, items[], and address data for better 3DS results.
  • redirect_url is used after the 3DS challenge (if needed).
  • Final transaction status is always delivered to your webhook_url.

🧩 Step 2: Front-end Integration — A55Pay.payV2

2.1 Load the SDK

<script src="https://cdn.jsdelivr.net/npm/a55pay-sdk"></script>

2.2 Minimal HTML Example

⚠️

For testing only — never log sensitive data in production.

<!DOCTYPE html>
<html>
<head>
  <title>A55Pay SDK Example</title>
</head>
<body>
  <script src="https://cdn.jsdelivr.net/npm/a55pay-sdk"></script>
  <script>
    const userData = {
      // Payer
      payer_name: "Full Name",
      payer_email: "[email protected]",
      payer_tax_id: "00000000000",
      cell_phone: "5511999999999",
      
      // Card
      holder_name: "NAME ON CARD",
      number: "0000000000000000",
      expiry_month: "MM",
      expiry_year: "YYYY",
      ccv: "123", // or card_cryptogram

      // Alternative card options
      card_token: "card_token",
      card_cryptogram: "3ds_cryptogram",
      
      // Billing address
      postal_code: "00000000",
      street: "Street Name",
      address_number: "123",
      neighborhood: "Neighborhood Name",
      complement: "Apt 101",
      city: "City Name",
      state: "SP", // 2 caracteres
      country: "BR", // 2 caracteres

      // Shipping address (if different from billing)
      shipping_postal_code: "00000000",
      shipping_street: "Shipping Street",
      shipping_address_number: "456",
      shipping_complement: "Block B",
      shipping_neighborhood: "Shipping Neighborhood",
      shipping_city: "Shipping City",
      shipping_state: "RJ", // 2 caracteres
      shipping_country: "BR" // 2 caracteres
    };

    const config = {
      charge_uuid: "550e8400-e29b-41d4-a716-446655440000",
      userData,
      onReady: () => console.log("SDK ready – starting authentication"),
      onSuccess: (result) => console.log("✅ Payment success:", result),
      onError: (error) => console.log("❌ Payment error:", error)
    };

    A55Pay.payV2(config);
  </script>
</body>
</html>

🧠 What payV2 Handles Automatically

  • DDC (Device Data Collection) + fingerprint + IP capture → builds device_info.
  • 3DS Automation → opens modal/iframe when required.
  • Post-3DS event → emits 3ds-auth-complete via postMessage.

Callbacks

CallbackTriggerDescription
onReady()When SDK initializesStarts authentication and data collection
onSuccess(result)Payment successReturns full authorization response
onError(error)Any issueValidation, network, or 3DS errors

🪄 Optional: Parent-Window Listener

Handle post-3DS events or UI updates from inside your checkout page.

<script>
  window.addEventListener('message', function (event) {
    if (event.data && event.data.event === '3ds-auth-complete') {
      const chargeUuid = event.data.chargeUuid;
      // custom actions
    }
    // if send redirect_url
		if (event.data && event.data.event === '3ds-redirect-request') {
       window.location.replace(event.data.redirectUrl);
    }
  });
</script>

🧾 userData Reference

FieldRequiredExampleDescription
payer_nameJohn DoeFull name of the payer
payer_email[email protected]Payer email address
payer_tax_id00000000000National ID or tax number
cell_phone5511999999999Payer phone number
holder_nameJOHN DOECardholder name
number4111111111111111PAN or DPAN
expiry_month12Month (MM)
expiry_year2032Year (YYYY)
ccv123Security code
card_token86f22388-bb59-4c47-ae00-3c79803e364fTokenized card reference
card_cryptogramQmFzZTY0Rm9yQ2lwdG9ncmFtMTIz==Used in 3DS or tokenized flows
postal_code01310100ZIP/postal code
streetAv. PaulistaStreet name
address_number1000Address number
neighborhoodBela VistaNeighborhood
complementApt 101Optional complement
citySão PauloCity name
stateSPState/province
countryBRISO-2 country code
shipping_postal_code04038001Shipping ZIP (if different)
shipping_streetRua Fidêncio RamosShipping street
shipping_address_number308Shipping number
shipping_complementTower AShipping complement
shipping_neighborhoodVila OlímpiaShipping neighborhood
shipping_citySão PauloShipping city
shipping_stateSPShipping state
shipping_countryBRShipping country

🔄 Full Execution Flow

  1. Initialization: SDK loads and generates Device ID (fingerprint).
  2. Authentication: Device Data Collection .
  3. IP Collection: Multiple methods.
  4. Transmission: Sends payload to A55 API.
  5. 3DS: Opens modal for authentication if required.
  6. Result: Returns via callback and webhook.

🧪 Testing & Sandbox Tips

  • Some 3DS redirects may not fully reproduce in sandbox.
  • Use charges below BRL 0.20 for testing and refund afterward.
  • Always serve pages over HTTPS, even locally.

💬 FAQ

Can I use a token or cryptogram instead of raw PAN?
Yes. Include either card_token or card_cryptogram in userData.

Do I need to build the 3DS UI manually?
No. The SDK automatically opens a modal/iframe for the 3DS challenge.

Where do I receive the final payment status?
Your backend webhook receives the final, authoritative status from A55.


🧠 Summary

The A55Pay SDK abstracts complex payment flows — device fingerprinting, 3DS, and callbacks — into a simple front-end integration.
Developers can securely accept card payments with minimal effort and high approval rates.