Implement Apple Pay merchant validation and decrypt the resulting payment token server-side

domain: developer.apple.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. On receiving the onvalidatemerchant event (web) or the equivalent native delegate callback, send the provided validationURL to your server.
  2. From your server, POST to that validation URL over mutual TLS using your Apple merchant identity certificate to request a merchant session; use an allow-list of Apple's validation domains rather than hardcoding a single endpoint, since Apple's own guidance is moving from the older 'Start Session' terminology to 'Payment Session.'
  3. Return the merchant session to the client so it can call completeMerchantValidation and unblock the payment sheet.
  4. After the user authorizes payment, receive the resulting payment token (ApplePayPaymentToken or PKPaymentToken) containing paymentData with data, header (ephemeralPublicKey, publicKeyHash, transactionId), signature, and version.
  5. Either decrypt the token yourself server-side (ECDH with the ephemeral public key, then AES-256, per Apple's Payment Token Format Reference, using your payment processing certificate's private key) or forward the opaque token to your payment processor, which is the more commonly used integration path.

Known gotchas

Related routes

Decrypt an Apple Pay payment token and extract the DPAN and cryptogram for authorization
developer.apple.com · 6 steps · unrated
Decrypt a Google Pay ECv2 payment token server-side without relying on a payment gateway
developers.google.com · 5 steps · unrated
Validate an Apple App Store in-app purchase receipt server-side using the App Store Server API
app-store-server-api · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans