This is the first of three posts on implementing Apple Pay on Optimizely Commerce. Part 2 covers the developer implementation guide, and Part 3 covers the QA/testing guide.
Legend: gray = your systems, coral = third-party services (Apple Pay servers, payment gateway).
The diagram above is the whole story in one picture. Five stages, two colors: your own systems in gray, third parties in coral. Everything else in this post is justification for why it’s shaped that way.
Apple Pay isn’t a payment method in the conventional sense — it’s a new front door into an order pipeline you already have. The temptation on a project like this is to treat Apple Pay as a parallel checkout path with its own session handling, its own order creation, its own everything. We didn’t do that, and it’s the single decision I’d defend hardest in a design review.
Instead, Apple Pay terminates at the payment gateway boundary exactly like every other payment method already does. The merchant validation handshake — the part that’s genuinely Apple-specific — lives in one isolated component. Once a payment token comes back, it re-enters the same order pipeline that PayPal, Google Pay, and card payments already use. Looking at the diagram: the bottom stage, “Order / commerce pipeline,” doesn’t know or care which stage above it the order came through.
This matters for two reasons:
Looking at the diagram, the unglamorous middle stage — the merchant validation API talking to Apple Pay servers over mutual TLS — is where almost all the real effort landed. Everything above and below it (the browser button, the gateway charge, the order pipeline) is comparatively well-trodden ground.
Mutual TLS authentication using a certificate issued to your specific merchant ID is unforgiving: the failure mode is a generic handshake error with no actionable detail from either side. Diagnosing it meant building out certificate-pipeline logging (subject, thumbprint, private key validity, which crypto API actually returns a usable key) before the network call, because once the handshake fails, there’s no further diagnostic surface to lean on. That’s the kind of thing that’s invisible in a project plan (“integrate Apple Pay” — one line) and accounts for a disproportionate share of the actual calendar time.
The practical takeaway for anyone scoping similar work: budget the certificate/TLS handshake as its own line item, separate from “build the button” and “wire up the gateway.” It is not the same size of task as the rest combined.
Two things that didn’t show up in the original ticket but turned out to matter:
Building this yourself? Part 2 has the actual code — certificate reassembly, the TLS handshake checklist, the controller, the .well-known static file gotcha.
Testing this on a project? Part 3 covers how to verify merchant validation, simulate failure states, and the device/browser matrix you actually need (it’s smaller than people assume).
Quick Links
Legal Stuff