Overview
TheDLocalAdapter implements the PaymentAdapter interface to process payments through dLocal’s API. It specializes in Latin American payment methods including PIX, Boleto, cards, and bank transfers across 17 countries.
Class Signature
Constructor
Configuration
dLocal API login credential (X-Login header).Required. Throws
VaultConfigError if not provided.dLocal transaction key (X-Trans-Key header).Required. Throws
VaultConfigError if not provided.dLocal secret key for HMAC-SHA256 request signing.Required. Throws
VaultConfigError if not provided.dLocal webhook secret for signature verification. Falls back to
secretKey if not provided.Optional. Used in handleWebhook() method.Custom dLocal API base URL.Default:
"https://api.dlocal.com"Request timeout in milliseconds.Default:
15000 (15 seconds)Custom fetch implementation for testing or special network requirements.Default: global
fetchConfiguration Example
Supported Capabilities
Payment Methods
Credit and debit cards processed through dLocal’s network.Supports local and international cards with tokenization.
Brazil only. Instant payment method via Brazil’s PIX system.Currency: BRL only. Real-time bank transfers with QR code or payment link.
Brazil only. Boleto bancário payment vouchers.Currency: BRL only. Requires customer document (CPF/CNPJ) for processing.
Direct bank transfers using local banking networks.Available in multiple countries with country-specific bank codes.
Supported Currencies
14 Latin American currencies plus USD:- Brazil: BRL
- Mexico: MXN
- Argentina: ARS
- Chile: CLP
- Colombia: COP
- Peru: PEN
- Uruguay: UYU
- Bolivia: BOB
- Paraguay: PYG
- Costa Rica: CRC
- Guatemala: GTQ
- Panama: PAB
- Dominican Republic: DOP
- International: USD
Supported Countries
17 Latin American countries: BR, MX, AR, CL, CO, PE, UY, BO, PY, CR, GT, PA, DO, EC, SV, NI, HNMethods
Implements allPaymentAdapter interface methods:
charge()- Creates a dLocal payment with automatic captureauthorize()- Creates a payment with manual capturecapture()- Captures an authorized paymentrefund()- Processes a full or partial refundvoid()- Cancels an uncaptured paymentgetStatus()- Retrieves payment statuslistPaymentMethods()- Returns available payment methods (card, PIX, Boleto)handleWebhook()- Verifies and processes dLocal webhook events
Webhook Events
The adapter maps dLocal webhook events to VaultSaaS event types:| dLocal Event | VaultSaaS Event |
|---|---|
payment.approved | payment.completed |
payment.captured | payment.completed |
payment.pending | payment.pending |
payment.failed | payment.failed |
payment.rejected | payment.failed |
payment.refunded | payment.refunded |
payment.partially_refunded | payment.partially_refunded |
chargeback.created | payment.disputed |
chargeback.closed | payment.dispute_resolved |
Webhook Verification
dLocal webhooks are verified using HMAC-SHA256 signatures:- Signature header:
x-dlocal-signatureorx-signature - Algorithm: HMAC-SHA256 of raw payload
- Secret:
webhookSecret(or falls back tosecretKey)
Authentication
dLocal uses V2-HMAC-SHA256 authentication with the following headers:Status Mapping
dLocal payment statuses are mapped to VaultSaaS statuses:| dLocal Status | VaultSaaS Status |
|---|---|
AUTHORIZED | authorized |
PAID / APPROVED / CAPTURED | completed |
PENDING / IN_PROCESS | pending |
REJECTED / DECLINED | declined |
CANCELED / CANCELLED | cancelled |
REQUIRES_ACTION | requires_action |
| Other | failed |