Decrypt an Apple Pay payment token and extract the DPAN and cryptogram for authorization

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

Steps

  1. Receive the PKPaymentToken from the Apple Pay payment sheet; the token contains an encrypted payment data blob and header metadata
  2. Retrieve your Apple Pay payment processing certificate private key from secure storage; use it to perform ECDH key agreement with the ephemeral public key in the token header
  3. Derive a symmetric decryption key using the ECDH shared secret combined with the merchant identifier and other header fields according to Apple's key derivation specification
  4. Decrypt the payment data using AES-256-GCM with the derived key to obtain the decrypted payment data JSON, which contains the DPAN (device PAN), expiry, and payment cryptogram
  5. Submit the DPAN, expiry, ECI indicator, and cryptogram to your payment processor in the authorization request, flagging it as a network token or wallet transaction as appropriate
  6. Validate the token's transaction time and amount against your order before submitting; reject tokens where these values do not match the expected order

Known gotchas

Related routes

Implement Apple Pay merchant validation and decrypt the resulting payment token server-side
developer.apple.com · 5 steps · unrated
Configure Google Pay API merchant info and tokenization parameters for PAN_ONLY vs CRYPTOGRAM_3DS
developers.google.com · 6 steps · unrated
Provision a network token and cryptogram via the Worldpay (Access) Tokens API
docs.worldpay.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ 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