Apple Pay
Select your integration model below. If you haven't chosen yet, see the Overview for a comparison.
- Model 1: Merchant-side decryption
- Model 2: EBANX-side decryption
Your server decrypts the PKPaymentToken and sends the extracted card data to EBANX using the network_token_* fields. Use this model if you already have Apple Pay decryption in place.
Before you start
- API authentication. All API requests must be authenticated using JWS (JSON Web Signature). The legacy
integration_keyis being deprecated — if you still use it, follow the Migration Guide to transition to JWS. - Active EBANX Direct integration. You need an existing EBANX Direct API integration.
- Apple Developer Program membership. With a registered Merchant ID and your own Payment Processing Certificate.
- Server-side Apple Pay decryption. Your backend must implement ECDH-ES decryption for
EC_v1tokens.
- Select your environment
Select the appropriate environment for your integration. Use the sandbox environment for testing, or the production environment for live transactions. Use the URL for your HTTP requests based on your selection.
Check the method's availability for your country and tenant in Payment Methods by Country. Questions about tenant and environment? Check our API Operability and API Endpoints.
Cross-border sandboxhttps://sandbox.ebanxpay.com/ws/direct - Decrypt the PKPaymentToken
After the customer authenticates, decrypt the
PKPaymentTokenon your server to extract:- DPAN (
applicationPrimaryAccountNumber). The network token that replaces the card PAN. For recurring or merchant-initiated transactions, Apple may return an MPAN in this field instead — a merchant-scoped token that persists across devices and enables MIT flows. - Expiry date (
applicationExpirationDate). InYYMMDDformat; convert toMM/YYYY. - Cryptogram (
paymentData.onlinePaymentCryptogram). One-time auth value. - ECI (
paymentData.eciIndicator). Electronic commerce indicator.
- DPAN (
- Prepare your request
Add the following parameters to the
creditcardobject in your/ws/directrequest.Parameter Type Description network_token_panstring Required. DPAN or MPAN from applicationPrimaryAccountNumber. Use MPAN for recurring and merchant-initiated transactions.network_token_expire_datestring Required. Token expiry in MM/YYYYformat, converted from Apple Pay'sYYMMDDfield.network_token_cryptogramstring Required for CIT. onlinePaymentCryptogramfrom the decrypted token. Base64-encoded. Omit for MIT flows using an MPAN.network_token_wallet_typestring Required. Must be "apple".network_token_ecistring Recommended. eciIndicatorfrom the decrypted token (e.g."05","07"). Enables liability shift when the issuer supports it.card_namestring Required. Cardholder name. Use cardholderNamefrom the token when available. - Sample requestCountry-specific fields
Always include
country(two-letter code, e.g."br","ar","cl") and the matchingcurrency_code(e.g."BRL","ARS","CLP"). Thedocumentfield is required in most markets and its format varies by country — for example, CPF or CNPJ in Brazil, CUIT/CUIL in Argentina, and RUT in Chile. See Payment Fields by Country for the full reference.The example below shows a Brazil transaction. Adjust
country,currency_code, anddocumentfor the target market.Shellcurl -X POST \
--location 'https://sandbox.ebanxpay.com/ws/direct' \
--header 'Content-Type: application/json' \
--header 'X-JWS-Signature: {{jws_signature}}' \
--data '{
"payment": {
"merchant_payment_code": "{{unique_merchant_code}}",
"amount_total": 99.85,
"currency_code": "BRL",
"name": "John Doe",
"email": "john.doe@example.com",
"document": "{{cpf_or_cnpj}}",
"address": "123 Main Street",
"street_number": "100",
"city": "São Paulo",
"state": "SP",
"zipcode": "01310100",
"country": "br",
"phone_number": "5511999990000",
"payment_type_code": "visa",
"creditcard": {
"card_name": "John Doe",
"network_token_pan": "{{dpan}}",
"network_token_expire_date": "12/2027",
"network_token_cryptogram": "{{base64Cryptogram}}",
"network_token_eci": "05",
"network_token_wallet_type": "apple"
}
}
}' - Sample response
A successful request returns a response similar to the example below.
JSON{
"payment": {
"hash": "{{payment_hash}}",
"country": "br",
"merchant_payment_code": "{{unique_merchant_code}}",
"status": "CO",
"status_date": "{{YYYY-MM-DD HH:mm:ss}}",
"open_date": "{{YYYY-MM-DD HH:mm:ss}}",
"confirm_date": "{{YYYY-MM-DD HH:mm:ss}}",
"amount_br": "99.85",
"amount_ext": "99.85",
"currency_ext": "BRL",
"payment_type_code": "visa",
"transaction_status": {
"acquirer": "EBANX",
"code": "OK",
"description": "Accepted",
"authcode": "{{authcode}}"
},
"pre_approved": true,
"capture_available": false
},
"status": "SUCCESS"
} - Congratulations!
Apple Pay (Model 1) is live.
Your checkout sends the raw encrypted PKPaymentToken to EBANX. EBANX decrypts it, extracts the DPAN and cryptogram, and routes the authorization. No decryption on your side.
Before you start
- API authentication. All API requests must be authenticated using JWS (JSON Web Signature). The legacy
integration_keyis being deprecated — if you still use it, follow the Migration Guide to transition to JWS. - Active EBANX Direct integration. You need an existing EBANX Direct API integration.
- Apple Developer Program membership. Required to create a Merchant ID. Enroll at developer.apple.com.
- Apple Merchant ID. Create one in Apple Developer Portal, under Identifiers, then Merchant IDs.
- EBANX Payment Processing Certificate. Download the EBANX CSR and upload it when creating the Payment Processing Certificate for your Merchant ID. This makes Apple encrypt tokens with EBANX's public key. After Apple generates the certificate, contact your EBANX integration engineer to complete the configuration on EBANX's side.
You register and own your Apple Merchant ID. By uploading EBANX's CSR, you create a Payment Processing Certificate that locks tokens to EBANX's public key. Only EBANX can decrypt them. You never manage a private key.
- Select your environment
Select the appropriate environment for your integration. Use the sandbox environment for testing, or the production environment for live transactions. Use the URL for your HTTP requests based on your selection.
Check the method's availability for your country and tenant in Payment Methods by Country. Questions about tenant and environment? Check our API Operability and API Endpoints.
Cross-border sandboxhttps://sandbox.ebanxpay.com/ws/direct - Configure Apple Pay and complete the EBANX setup
Set up Apple Pay on your platform using the
merchantIdentifieryou registered in Apple Developer Portal and the Payment Processing Certificate you created with the EBANX CSR. Your implementation must requestsupports3DScapability and includevisaandmasterCardin the supported networks.Refer to Apple's documentation for the full setup:
- Setting Up Apple Pay (iOS / PassKit)
- Apple Pay on the Web (ApplePaySession)
Once you have completed the Apple Developer setup, contact your EBANX integration engineer to finalize the configuration. EBANX needs to register the certificate on its infrastructure before your first transaction can be processed.
- Receive the PKPaymentToken
After the customer authenticates with Face ID or Touch ID, Apple returns a
PKPaymentToken. Serialize it as a JSON string. That's what you send to EBANX.The token has the following structure:
JSON{
"version": "EC_v1",
"data": "{{base64EncodedEncryptedData}}",
"signature": "{{base64EncodedSignature}}",
"header": {
"ephemeralPublicKey": "{{base64EphemeralPublicKey}}",
"publicKeyHash": "{{base64PublicKeyHash}}",
"transactionId": "{{hexTransactionId}}"
}
} - Send the payment request
Pass the serialized
PKPaymentTokenJSON string in thecreditcard.apple_payfield of your/ws/directrequest. All other payment fields stay the same.Country-specific fieldsAlways include
country(two-letter code, e.g."br","ar","cl") and the matchingcurrency_code(e.g."BRL","ARS","CLP"). Thedocumentfield is required in most markets and its format varies by country — for example, CPF or CNPJ in Brazil, CUIT/CUIL in Argentina, and RUT in Chile. See Payment Fields by Country for the full reference.The example below shows a Brazil transaction. Adjust
country,currency_code, anddocumentfor the target market.Shellcurl -X POST \
--location 'https://sandbox.ebanxpay.com/ws/direct' \
--header 'Content-Type: application/json' \
--header 'X-JWS-Signature: {{jws_signature}}' \
--data '{
"payment": {
"merchant_payment_code": "{{unique_merchant_code}}",
"amount_total": 99.85,
"currency_code": "BRL",
"name": "John Doe",
"email": "john.doe@example.com",
"document": "{{cpf_or_cnpj}}",
"address": "123 Main Street",
"street_number": "100",
"city": "São Paulo",
"state": "SP",
"zipcode": "01310100",
"country": "br",
"phone_number": "5511999990000",
"payment_type_code": "visa",
"creditcard": {
"apple_pay": "{\"version\":\"EC_v1\",\"data\":\"{{base64EncryptedData}}\",\"signature\":\"{{base64Signature}}\",\"header\":{\"ephemeralPublicKey\":\"{{base64EphemeralPublicKey}}\",\"publicKeyHash\":\"{{base64PublicKeyHash}}\",\"transactionId\":\"{{hexTransactionId}}\"}}"
}
}
}' - Sample response
A successful request returns a response similar to the example below.
JSON{
"payment": {
"hash": "{{payment_hash}}",
"country": "br",
"merchant_payment_code": "{{unique_merchant_code}}",
"status": "CO",
"status_date": "{{YYYY-MM-DD HH:mm:ss}}",
"open_date": "{{YYYY-MM-DD HH:mm:ss}}",
"confirm_date": "{{YYYY-MM-DD HH:mm:ss}}",
"amount_br": "99.85",
"amount_ext": "99.85",
"currency_ext": "BRL",
"payment_type_code": "visa",
"transaction_status": {
"acquirer": "EBANX",
"code": "OK",
"description": "Accepted",
"authcode": "{{authcode}}"
},
"pre_approved": true,
"capture_available": false
},
"status": "SUCCESS"
} - Congratulations!
Apple Pay (Model 2) is live. EBANX handles decryption and routing.
Resources
Use the following resources when testing in your sandbox environment.
Sample Cards
Click here to view mock card data to validate your payment integration.
API Reference
Click here to access detailed API documentation to integrate efficiently.
Mock Customer Data
Click here to view mock customer data for testing and validating user flows.
Error Codes
Click here to review common error codes to troubleshoot and resolve issues quickly.
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.