Apple Pay
Integrate dLocal's native Apple Pay via the Full API to accept Apple Pay payments on web and iOS.
Apple Pay
Accept Apple Pay payments through dLocal by collecting an Apple Pay payment token in your website or native iOS app and submitting it in a standard card payment request.
Overview
This guide covers dLocal's native Apple Pay integration through the Full API: collecting the Apple Pay payment token on web or iOS, choosing a token-decryption model, sending the resulting request to dLocal, and handling recurring and merchant-initiated transactions.
This guide does not describe a Smart Fields-managed Apple Pay component. If the merchant expects dLocal to manage the Apple Pay button and Apple-side setup inside Smart Fields, confirm product availability and timing with your Technical Account Manager (TAM) before making a commitment.
Before you start
Apple Pay integration has two independent parts: the Apple Pay frontend and merchant-session setup, and the backend payment request sent to dLocal. Before you integrate, determine who owns the Payment Processing Certificate and who decrypts the Apple Pay token — this decides the request shape, not whether the frontend is web or iOS.
| Situation | Recommended model | Request sent to dLocal |
|---|---|---|
| You integrate directly with dLocal and do not decrypt Apple Pay tokens upstream | Model A: dLocal decryption | card.applepay_token |
| You, your PSP, or your payment orchestrator decrypts the token before it reaches dLocal | Model B: merchant/PSP decryption | card.network_token and card.cryptogram |
| Your orchestrator can forward the raw encrypted token without decrypting it | Model A: dLocal decryption | card.applepay_token |
| The decryption location is unknown | Confirm before integrating | Do not select a request shape until certificate ownership is confirmed |
card.wallet_typeis mandatory and must be exactlyAPPLE_PAYin both models. Submit the Apple Pay credential immediately after authorization — do not queue or batch it, and do not retry the same token after a key, decryption, signature, or token-expiration error.
For the list of parties involved and their responsibilities — customer, Apple, you as the merchant, your PSP or orchestrator, and dLocal — see Certificates and setup.
Apple Pay is supported on:
- Web, using Safari and
ApplePaySession. - Native iOS apps, using PassKit.
The backend request format can remain common across web and iOS. Only the frontend setup differs by channel.
Certificates and setup
Roles and responsibilities
| Party | Responsibilities |
|---|---|
| Customer | Authorizes the payment with Face ID, Touch ID, or the device passcode. |
| Apple | Stores the card in Apple Wallet, generates the payment token at authorization time, issues Apple Pay certificates from submitted CSRs, validates web merchant sessions, and enforces Apple Pay UX and branding requirements. |
| You (merchant) | Own the Apple Developer account and Merchant ID, build the Apple Pay button and checkout flow, perform web merchant-session validation, verify web domains, configure iOS entitlements, forward the payment credential to dLocal, and set card.wallet_type to APPLE_PAY. |
| Your PSP or orchestrator, if applicable | May own the Payment Processing Certificate and decrypt the Apple Pay token before sending the resulting network token and cryptogram to dLocal. |
| dLocal | Decrypts and processes the token in Model A, or accepts the already-decrypted network token and cryptogram in Model B. dLocal routes the transaction to the configured downstream payment path and returns the payment result and webhook notification. |
The two Apple Pay certificates
The certificates serve different purposes and are independent — one certificate cannot replace the other.
| Certificate | Purpose | Channel | Owner |
|---|---|---|---|
| Payment Processing Certificate | Used by Apple to encrypt the payment token for the designated payment processor. The holder of the corresponding private key decrypts the token. | Web and native iOS | dLocal in Model A; you, your PSP, or your orchestrator in Model B. |
| Merchant Identity Certificate | Used by your server to authenticate to Apple during web merchant-session validation. It does not decrypt payment data. | Web only | You (merchant). |
Merchant ID setup
In Apple Developer, create or select the Merchant ID used for the dLocal integration.
If another PSP already processes Apple Pay for the same business, use a dedicated Merchant ID for the dLocal path — do not assume that one active Payment Processing Certificate can be shared across independent processors.
A Merchant ID and its Payment Processing Certificate are normally configured for the merchant and environment, not separately for each country. Confirm the required setup with dLocal when multiple legal entities, PSPs, or environments are involved.
Model A: dLocal decrypts the token
- Provide dLocal with your merchant name or account identifier, the Apple Merchant ID, and the target environment.
- Request a CSR through the agreed dLocal support or TAM process. Sandbox and production require separate certificate setup.
- Upload the CSR in Apple Developer and create the Apple Pay Payment Processing Certificate for the correct Merchant ID.
- Download the resulting
.cerfile. - Return the
.cerfile to dLocal through the agreed secure channel. Do not send certificate material through an unsecured channel. - Ask dLocal to confirm that the certificate is installed and mapped to the correct merchant and environment before sending live payments.
You do not receive or manage dLocal's corresponding private key. CSR generation, private-key custody, installation, and rotation are dLocal-managed configuration.
Model B: you, your PSP, or your orchestrator decrypts the token
- Confirm that you, your PSP, or your orchestrator owns the Payment Processing Certificate and private key.
- Complete Apple's certificate setup directly with that certificate owner.
- Decrypt the Apple Pay token in the upstream component.
- Send the resulting network token and cryptogram to dLocal using the Model B contract.
- Confirm with your PSP or orchestrator which fields it forwards, how it preserves the cryptogram, and how it exposes the ECI.
No Payment Processing Certificate exchange with dLocal is required for Model B. You, or your PSP/orchestrator, remain responsible for your own Apple Developer account, Merchant ID, certificate, private key, and token decryption process.
Web domain verification
For web integrations:
- Configure the checkout domain in Apple Developer under the Merchant ID used by the web payment flow.
- Serve Apple's domain-association file from the exact path:
https://<your-domain>/.well-known/apple-developer-merchantid-domain-association. - Serve the file over HTTPS without redirects.
- Add and verify the domain for the correct Merchant ID.
- Implement server-side merchant-session validation using your Merchant Identity Certificate.
If an existing PSP Merchant ID and the dLocal Merchant ID are in the same Apple Developer account, an already verified domain generally uses the same domain-association file — still add the domain to the new Merchant ID and complete the verification step. If the Merchant IDs are in different Apple Developer accounts, use separate subdomain configuration so each account can serve its own association file.
Native iOS entitlements
For native iOS:
- Enable the Apple Pay capability for the App ID.
- Add the correct Merchant ID to the application entitlements.
- Use PassKit to create and present the payment request.
- Test on a physical Apple device with Apple Pay configured.
Native iOS uses PassKit and entitlements. It does not use the web merchant-session validation flow.
<key>com.apple.developer.in-app-payments</key>
<array>
<string>merchant.com.example.dlocal</string>
</array>If the same Merchant ID is used for web and native iOS, the Payment Processing Certificate can cover both channels. iOS still uses PassKit entitlements, while web uses Apple Pay JS and merchant-session validation.
Payment flow
Diagram pending — request the end-to-end flow diagram asset before this page goes fully live.
- The customer taps the Apple Pay button in your website or native iOS app.
- Apple presents the payment sheet and the customer authorizes the payment with Face ID, Touch ID, or the device passcode.
- Apple generates the payment token and returns it to your frontend as
payment.token.paymentData. - Your frontend forwards the token to your backend without parsing or re-serializing it.
- Your backend sends the payment request to dLocal, using Model A (
card.applepay_token) or Model B (card.network_tokenandcard.cryptogram), depending on who decrypts the token. - dLocal processes the payment and returns the payment result to your backend and, when configured, a webhook notification.
- Your backend notifies the customer that the payment was successful.
Step 1: Frontend integration
Web
Use Apple's Apple Pay on the Web documentation and Human Interface Guidelines for Apple Pay buttons and marks.
Your server must perform merchant-session validation using the Merchant Identity Certificate. After authorization, forward the payment token to your backend without changing its structure.
session.onpaymentauthorized = function (event) {
const tokenData = event.payment.token.paymentData;
// Send tokenData to your backend without parsing or re-serializing it.
// Do not log tokenData.
};Native iOS
Use Apple's PassKit documentation.
In the payment authorization callback, forward payment.token.paymentData to your backend without changing it.
func paymentAuthorizationViewController(
_ controller: PKPaymentAuthorizationViewController,
didAuthorizePayment payment: PKPayment,
handler completion: @escaping (PKPaymentAuthorizationResult) -> Void
) {
let tokenData = payment.token.paymentData
// Send tokenData to your backend without parsing or re-serializing it.
// Do not log tokenData.
}The Apple Pay frontend may return additional information such as shipping details. Send only the payment credential required for authorization to your backend.
Step 2: Backend integration
Apple Pay payments use the standard dLocal card payment endpoint. The request shape depends on who decrypts the Apple Pay token.
Canonical fields
| Purpose | Field |
|---|---|
| Encrypted Apple Pay token | card.applepay_token |
| Decrypted network token, normally the DPAN | card.network_token |
| One-time Apple Pay cryptogram | card.cryptogram |
| Apple Pay indicator | card.wallet_type with value APPLE_PAY |
| ECI from the decrypted payload, when applicable | three_dsecure.eci |
| Save the credential and request a dLocal card token in Model A | card.save with value true |
Use
card.applepay_tokenas the canonical encrypted-token field name across the API, OpenAPI definition, SDKs, examples, and validators.
Model A: dLocal decryption
Use Model A when dLocal owns the Payment Processing Certificate used for the token and decrypts the encrypted Apple Pay token.
Send the token received from Apple as card.applepay_token. Do not parse, reserialize, normalize, reorder, or otherwise transform the token object.
Submit a standard payment request via the https://api.dlocal.com/secure_payments endpoint using the following parameter values:
payment_method_idshould beCARD.card.applepay_tokenshould be the JSON object obtained in the frontend integration step. Send a JSON object, not a string, in this parameter.
{
"amount": 120.00,
"currency": "BRL",
"country": "BR",
"payment_method_id": "CARD",
"payment_method_flow": "DIRECT",
"payer": {
"name": "Ricardo Gomes",
"email": "[email protected]",
"document": "53033315550"
},
"card": {
"wallet_type": "APPLE_PAY",
"save": true,
"applepay_token": {
"version": "EC_v1",
"data": "<APPLE_PAY_TOKEN_DATA>",
"signature": "<APPLE_PAY_TOKEN_SIGNATURE>",
"header": {
"ephemeralPublicKey": "<EPHEMERAL_PUBLIC_KEY>",
"publicKeyHash": "<PUBLIC_KEY_HASH>",
"transactionId": "<APPLE_TRANSACTION_ID>"
}
}
},
"order_id": "ORDER_12345",
"notification_url": "https://merchant.example/webhooks/dlocal"
}Model A rules
card.wallet_typeis mandatory.card.applepay_tokenmust use the canonical field name shown above.- Forward the token exactly as received from Apple.
- Call dLocal immediately after customer authorization. Do not queue, batch, or intentionally delay the token.
- If you want dLocal to save the card credential and return a card token for future use, send
card.save: trueon the applicable Model A payment request. - Do not retry the same token after a signature, key, decryption, or expiration error.
- Do not log the raw token or any decrypted output.
Model B: merchant or PSP decryption
Use Model B when you, your PSP, or your payment orchestrator owns the Payment Processing Certificate and decrypts the Apple Pay token before the request reaches dLocal.
Send the decrypted fields as a standard network-token card payment. The cryptogram is the one-time cryptographic value associated with the network token. It must be sent separately and preserved exactly as provided by the decrypting component.
{
"amount": 120.00,
"currency": "BRL",
"country": "BR",
"payment_method_id": "CARD",
"payment_method_flow": "DIRECT",
"payer": {
"name": "Ricardo Gomes",
"email": "[email protected]",
"document": "53033315550"
},
"card": {
"network_token": "<DPAN_OR_MPAN>",
"cryptogram": "<APPLE_PAY_CRYPTOGRAM>",
"wallet_type": "APPLE_PAY",
"holder_name": "Ricardo Gomes",
"expiration_month": 12,
"expiration_year": 2028
},
"three_dsecure": {
"eci": "05"
},
"order_id": "ORDER_12346",
"notification_url": "https://merchant.example/webhooks/dlocal"
}For Model B, sending
card.cryptogramis mandatory. Omitting it may lead to format errors or issuer rejections.
Model B rules
card.wallet_typeis mandatory even though dLocal does not decrypt the Apple Pay token.card.network_tokenis the network token extracted from the decrypted Apple Pay token. It is normally a DPAN for a standard CIT and may be an MPAN when Apple returns one for a qualifying recurring-payment request.card.cryptogramis the one-time cryptogram associated with that network token.three_dsecure.eciis transmitted separately from the card fields when it is provided by the decrypted Apple Pay payload and required by the API contract.- Do not substitute a card PAN for the network token.
- Do not reuse the cryptogram for another authorization.
Choosing between the models
| Attribute | Model A: dLocal decryption | Model B: merchant/PSP decryption |
|---|---|---|
| Certificate owner | dLocal | You, your PSP, or your orchestrator |
| Encrypted field sent to dLocal | card.applepay_token | None |
| Decrypted fields sent to dLocal | dLocal extracts them internally | card.network_token and card.cryptogram |
card.wallet_type | Required: APPLE_PAY | Required: APPLE_PAY |
| Certificate exchange with dLocal | Required | Not required |
| Typical use case | Direct dLocal integration | Existing PSP or orchestrator decrypts upstream |
If your PSP or orchestrator's behavior is unclear, ask whether it forwards the raw Apple Pay token unchanged or decrypts it before sending the payment request — that answer determines the model.
Recurring and merchant-initiated transactions
Customer-initiated Apple Pay payments
A standard Apple Pay authorization is a customer-initiated transaction. The resulting payment credential includes a network token and a transaction-specific cryptogram.
The cryptogram is single-use for the authorization. Do not store it for later use and do not reuse it for a subsequent payment.
Request recurring behavior in the Apple Pay session
If recurring or MIT processing is in scope, request recurring behavior when creating the initial Apple Pay session. Apple exposes this through the recurringPaymentRequest property on the Apple Pay payment request:
- On iOS, set the recurring payment request on the
PKPaymentRequestused by PassKit. - On the web, set
recurringPaymentRequeston the Apple Pay payment request used byApplePaySession. - Populate the recurring request with your billing description and recurring billing details required by Apple's current SDK/API contract.
recurringPaymentRequestis an Apple Pay session property, not a dLocal/paymentsfield. Do not add a separaterecurringPaymentflag to the dLocal payment request.
Requesting recurring behavior does not guarantee that Apple or the issuer will return an MPAN. Validate the exact property names and required fields against Apple's current PassKit and Apple Pay on the Web documentation before implementing.
DPAN and MPAN
- DPAN is a device- and card-specific network token used for a customer-initiated Apple Pay authorization, with a fresh cryptogram for each transaction.
- MPAN is a merchant-specific network token that may be requested for recurring use, subject to Apple Pay, issuer, network, acquirer, and market support.
When the token is decrypted upstream in Model B, pass the network token, cryptogram, expiry, and three_dsecure.eci exactly as produced by the wallet or processor path. The network token may be a DPAN or, when returned for the recurring request, an MPAN. In Model A, dLocal receives the encrypted token and extracts the applicable values.
Do not assume that MPAN is supported for a target market or issuer. Confirm support with dLocal and the relevant PSP or acquirer before committing to a recurring-payment design.
Card-on-File fields for MIT payments
For subsequent Merchant Initiated Transactions, send the corresponding Card-on-File fields in the card object:
| Field | Initial customer-initiated payment | Subsequent MIT |
|---|---|---|
card.stored_credential_type | Select according to the agreement, such as SUBSCRIPTION or UNSCHEDULED_CARD_ON_FILE | Send the same applicable type |
card.stored_credential_usage | FIRST | USED |
card.network_tx_reference | Returned in the response to the initial payment | Not applicable |
card.network_payment_reference | Not applicable | Required — set to the card.network_tx_reference value from the initial payment |
card.transaction_link_id | Store it when returned | Required for Mastercard MITs once available and applicable; not applicable to Visa |
The exact card.stored_credential_type depends on your use case. Use SUBSCRIPTION for fixed, regular billing and UNSCHEDULED_CARD_ON_FILE for non-fixed recurring charges. Other supported types include CARD_ON_FILE, INSTALLMENTS, and STANDING_ORDER.
For a subsequent MIT, send the corresponding Card-on-File flags described in dLocal's Merchant Initiated Transactions documentation, including the applicable card.stored_credential_type and card.stored_credential_usage values.
For Mastercard, store
card.transaction_link_idwhen dLocal begins returning it and send it on subsequent Mastercard MITs once required — see the Mastercard Transaction Link Identifier (TLID) rollout timeline in Merchant Initiated Transactions. Visa is unaffected. Confirm the current rollout status with dLocal before relying on the field.
Recommended recurring-payment pattern
- Initiate the first Apple Pay payment as a customer-initiated transaction.
- Include
recurringPaymentRequestin the initial Apple Pay session when recurring behavior is required. - For Model A, include
card.save: truewhen you want dLocal to save the credential and return a card token for future use. - Store the resulting dLocal payment method, card token, and network payment reference according to the applicable security and stored-credential requirements.
- Use the stored credential for later MITs with the required Card-on-File fields and network payment references.
- Do not reuse the first payment's cryptogram.
- Confirm the required combination of stored-credential fields and network references for the target acquirer.
Error handling
Apple Pay issues can originate in the Apple frontend, the dLocal API, or the downstream acquirer/issuer. Classify the error by layer before deciding what to retry.
Apple frontend and setup errors
| Error area | Likely cause | Retryable? | Recommended action |
|---|---|---|---|
| Merchant-session validation | Merchant Identity Certificate is missing, expired, invalid, or not associated with the requested Merchant ID | No automatic retry | Verify the Merchant Identity Certificate, Merchant ID, domain, server mTLS configuration, and Apple merchant-session request. |
| Domain verification | Association file is missing, served over HTTP, redirected, or configured under the wrong Merchant ID | No | Serve the file over HTTPS at the exact .well-known path and verify the correct domain/Merchant ID association. |
| iOS entitlement or capability | Apple Pay capability or Merchant ID is missing from the App ID or app entitlements | No | Enable the capability, add the correct Merchant ID, rebuild, and test on a physical device. |
| User cancellation | Customer dismissed the Apple Pay sheet or cancelled authorization | No payment retry with the same token | Treat the cancellation as a user outcome and allow the customer to try again from checkout. |
dLocal API errors
| Code | Likely cause | Retryable? | Recommended action |
|---|---|---|---|
APPLEPAY_KEY_NOT_FOUND | Payment Processing Certificate is not installed or the token's publicKeyHash does not match the configured key | No | Confirm the Merchant ID, environment, certificate installation, and publicKeyHash mapping with dLocal. Do not retry the same token until configuration is corrected. |
APPLEPAY_DECRYPTION_FAILED | Wrong certificate type, invalid certificate, or certificate does not correspond to the CSR and Merchant ID used for the token | No | Confirm that a Payment Processing Certificate — not a Merchant Identity Certificate — was used. Recreate or reissue the correct certificate only after dLocal confirms the expected process. |
APPLEPAY_SIGNATURE_FAILED | Encrypted token was parsed, reserialized, modified, or otherwise altered in transit | No | Forward card.applepay_token unchanged. Inspect proxies, middleware, serializers, request validators, and logging components that may modify the body. |
APPLEPAY_TOKEN_EXPIRED | Apple Pay's token validity has elapsed before processing | No | Process tokens immediately after authorization. Do not retry the same token; request a new Apple Pay authorization. Apple defines token validity, not the merchant or dLocal. |
| Network timeout or transport failure | Request did not receive a definitive response because of a connection or transport problem | Yes, with idempotency | Retry according to the dLocal API retry and idempotency requirements. Do not create a duplicate payment or generate a new request without preserving idempotency. |
Acquirer and issuer outcomes
An acquirer or issuer may decline an authorization even when Apple Pay tokenization and dLocal processing succeeded. Handle these outcomes using the standard dLocal payment status and status-detail contract.
- Do not retry a decline indiscriminately.
- Show the customer an appropriate payment-failure experience.
- Follow the configured payment-status and webhook flow.
- Contact dLocal if the decline pattern suggests a market, network-token, wallet-flagging, or acquirer configuration issue.
Getting ready to go live
Apple Pay availability is not global by default. Before launch, confirm support for each intended combination of country and settlement configuration, card network, acquirer or downstream route, network-token processing, Apple Pay wallet flagging, and customer/issuer conditions — do not assume a country is fully supported merely because Apple Pay is available there.
Contact your Technical Account Manager (TAM) to confirm the countries, networks, and acquirer routes in scope, and to check that your certificates, domain verification, and entitlements are correctly configured before switching to production.
Updated 15 days ago
