Bring Your Own Apple Pay

Accept Apple Pay under your own Apple Merchant ID: create the certificate from Tonder's CSR and send the payment token through the Direct API.

With Bring Your Own Apple Pay the payment runs under your Apple Merchant ID. You create it in your Apple Developer account, Tonder generates the certificate request and keeps the private key, and your website or iOS app sends each Apple Pay payment token to Tonder through the Direct API. Tonder decrypts it with your key and processes the charge as a Direct API payment. One Merchant ID and one certificate serve your website and your app alike.

Bring Your Own Apple Pay is enabled on request. Ask your Tonder representative before you start: the certificate exchange in step 2 is coordinated with Tonder's integrations team, and each environment, sandbox and production, is set up separately.

No Apple Developer account, or you want the button this week? Managed Apple Pay runs on Tonder's Merchant ID with no Apple paperwork on your side. The comparison shows both side by side.

Before you start: checklist

  • An Apple Developer Program membership, and someone with the Account Holder or Admin role: Apple restricts Merchant IDs, certificates and domains to those roles.
  • A working Direct API integration: the token is charged with your API key, from your server.
  • Apple Pay enabled on request for your business, in each environment you'll use.
  • The domains (web) and the app (iOS) that will show Apple Pay. For web, every domain and subdomain is registered separately in Apple.
  • A secure channel agreed with your representative for the certificate request and the certificate. Never send them in the clear.
  • A real Apple device for testing. The iOS Simulator can't run Apple Pay, and Apple's sandbox cards work for this model too.

How it works

Your Merchant ID and certificate
The shopper pays in your page or app
Tonder decrypts and charges

Apple encrypts every payment token with the public key of your Payment Processing Certificate. Only the matching private key can read it, and that key never leaves Tonder: it is generated with the certificate request in step 2 and stays there. That is why you never see or handle the key, and why a certificate created from any other request can't decrypt your shoppers' payments.

Step 1: create your Merchant ID and register your domains

In Apple Developer go to Certificates, Identifiers & Profiles → Identifiers, press + and choose Merchant IDs. Give it a description and an identifier in Apple's reverse-domain form, for example merchant.com.yourstore. The identifier can't change after creation and never expires; the same one serves your website and your iOS app, in sandbox and in production.

Inside the Merchant ID, under Domains, add every domain and subdomain that will show Apple Pay — yourstore.com and checkout.yourstore.com are two entries. Apple hands you its association file; host it at https://<your-domain>/.well-known/apple-developer-merchantid-domain-association and verify. The serving requirements and Apple's IP ranges are the same as for Managed Apple Pay; here the file comes from your Apple account and keeps Apple's fixed name. An iOS app needs no domain.

Give your representative the Merchant ID and the environments you need. Tonder prepares the certificate request for it.

Step 2: create the Payment Processing Certificate from Tonder's CSR

Tonder generates a certificate signing request (CSR) for your Merchant ID and sends it to you over the agreed secure channel. The CSR carries only the public half of a key pair; the private key is created with it and stays with Tonder.

In your Merchant ID, under Apple Pay Payment Processing Certificate, choose Create Certificate and upload Tonder's CSR. Download the certificate Apple issues, a .cer file.

Send the .cer back over the same channel. It holds no secret — it is the public certificate — but keeping the exchange on the agreed channel is what guarantees the right file reaches the right account.

Use Tonder's CSR, not one you generate. A certificate made from your own request will not work for payments. If Apple already shows a certificate on the Merchant ID, leave it alone and create a new one from Tonder's CSR.

Step 3: Tonder installs the certificate

Tonder converts the certificate, stores it with its private key, and binds both to your business in that environment. You never see or handle the key, and there is nothing to deploy on your side. Tonder confirms the setup, including the web session configuration, and tells you when sandbox and production are ready. Each environment is configured separately.

Step 4: charge the token through the Direct API

When the shopper confirms the sheet, Apple gives your page or app a payment token. From your server, send it to POST /api/v1/process/ with the amount and currency the shopper authorized. Tonder decrypts it under your Merchant ID, checks that amount and currency match what Apple sealed into the token, and processes the charge like any other Direct API payment.

The headers are the same as on any Direct API payment: Authorization: Token YOUR_API_KEY, Content-Type: application/json and X-Request-Id.

curl -X POST https://stage.tonder.io/api/v1/process/ \
  -H "Authorization: Token YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Request-Id: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "operation_type": "payment",
    "amount": 150.00,
    "currency": "MXN",
    "customer": {
      "name": "Juan Pérez",
      "email": "juan@example.com"
    },
    "client_reference": "ORD-001",
    "payment_method": {
      "type": "APPLE_PAY",
      "token": {
        "paymentData": {
          "version": "EC_v1",
          "data": "<encrypted-data>",
          "signature": "<signature>",
          "header": {
            "ephemeralPublicKey": "<ephemeral-key>",
            "publicKeyHash": "<hash>",
            "transactionId": "<transaction-id>"
          }
        },
        "paymentMethod": {
          "displayName": "Visa 1234",
          "network": "Visa",
          "type": "debit"
        },
        "transactionIdentifier": "<transaction-id>"
      },
      "apm_config": {
        "apple_pay_integration": "V2"
      }
    },
    "metadata": { "external_id": "ORD-001" }
  }'
curl -X POST https://app.tonder.io/api/v1/process/ \
  -H "Authorization: Token YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Request-Id: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "operation_type": "payment",
    "amount": 150.00,
    "currency": "MXN",
    "customer": {
      "name": "Juan Pérez",
      "email": "juan@example.com"
    },
    "client_reference": "ORD-001",
    "payment_method": {
      "type": "APPLE_PAY",
      "token": {
        "paymentData": {
          "version": "EC_v1",
          "data": "<encrypted-data>",
          "signature": "<signature>",
          "header": {
            "ephemeralPublicKey": "<ephemeral-key>",
            "publicKeyHash": "<hash>",
            "transactionId": "<transaction-id>"
          }
        },
        "paymentMethod": {
          "displayName": "Visa 1234",
          "network": "Visa",
          "type": "debit"
        },
        "transactionIdentifier": "<transaction-id>"
      },
      "apm_config": {
        "apple_pay_integration": "V2"
      }
    },
    "metadata": { "external_id": "ORD-001" }
  }'

apm_config.apple_pay_integration is required on Bring Your Own. Always send it with the value "V2".

Token fields. Forward them exactly as Apple Pay delivers them, without changing anything:

  • version: the encryption scheme, for example EC_v1.
  • data: the encrypted payment data.
  • signature: Apple's signature.
  • header.ephemeralPublicKey, header.publicKeyHash and header.transactionId.

Don't re-encode data, don't drop header fields, and don't reuse a token — each one is bound to a single authorization. The format is Apple's, documented in the Payment token format reference.

The response and the webhook are those of a Direct API payment, and GET /api/v1/transactions/{id}/ stays the source of truth. A decline from the issuer comes back as a declined transaction.

What stays the same

  • Webhooks. The charge produces a Direct API transaction and the webhook you already receive. See How webhooks work.
  • Correlation. Send client_reference and metadata.external_id as on every payment; they come back on the webhook. See Correlation keys.
  • Status. Fulfil from GET /api/v1/transactions/{id}/ or the webhook, never from the sheet's success animation.

Keep it running: certificates and renewals

WhatExpiresWhat to do
Merchant IDNeverNothing
Payment Processing CertificateEvery 25 monthsApple emails the Account Holder and Admin ahead of time. Before the date, ask your representative for a new CSR and repeat step 2; Tonder swaps the certificate
Domain verification (web)With your domain's SSL certificateRenew the SSL certificate before it expires and Apple keeps the domain verified; if it lapses, verify the domain again in your Apple account

Apple publishes these rules in Maintaining your environment.

Troubleshooting

If an Apple Pay payment is declined

If the response is payment_declined (HTTP 402), the payment wasn't authorized. The cause can be a decline from the bank or a problem with your Merchant ID or certificate setup. Check, in this order:

  1. That step 3 is complete for the environment you're charging in.
  2. That your domain or app is verified in Apple (step 1).
  3. That the amount and currency match what the shopper authorized.

If the problem continues, contact support with the request_id from the response.

Next steps

Was this page helpful?

On this page