If you would like to use headless Apple Pay via the Meld Checkout, all you have to do is make sure Mercuryo is enabled for your account.
If you have built your own UI and would like to enable headless Apple Pay, you must follow these setup steps:
Phase 1 — Domain registration (one-time, with Meld)
- Pick the domain where the Apple Pay sheet will run (e.g., pay.yourcompany.com). It must be HTTPS with a valid certificate. Subdomains are fine, but each one is registered separately.
- Send the domain to Meld via your integration contact.
- Meld adds your domain to our Apple Pay Merchant ID (merchant.io.meld.cryptowidget) in Apple Developer.
- Meld sends you the domain association file — a small binary blob Apple issues for your specific domain.
- You host the file at the exact path:
Requirements:
- HTTP 200, no redirects.
- Bytes returned must be byte-for-byte identical to the file we sent — no minification, no whitespace tweaks, no transformation.
- Content-Type doesn’t strictly matter but text/plain or application/octet-stream is safe.
- Publicly reachable (no auth, no IP restrictions).
- Confirm with Meld the file is live. Meld clicks Verify in Apple Developer → status goes from Pending to Verified.
- Meld asks Mercuryo to add your domain to the NAP widget’s Additional URL list. (Once.)
Phase 2 — Implement Apple Pay on your domain (one-time, in your frontend)
- Call our session endpoint when the user is ready to pay:
In the response, check isNativeApplePaySupported (or equivalently look at whether serviceProviderWidgetUrl points at meldcrypto.com vs exchange.mercuryo.io).
- If isNativeApplePaySupported: true — your page implements Apple Pay JS:
- From a user click handler, construct new ApplePaySession(version, paymentRequest).
- Implement onmerchantvalidation:
- POST the validationURL (Apple gives you in the event) to our endpoint:
- Pass the returned merchantSession to session.completeMerchantValidation(merchantSession).
- POST the validationURL (Apple gives you in the event) to our endpoint:
- Implement onpaymentauthorized:
- POST the encrypted Apple Pay token + buyer info to:
- On success (status is pending / paid / completed) → call session.completePayment(ApplePaySession.STATUS_SUCCESS).
- If response includes redirect_url → call session.completePayment(ApplePaySession.STATUS_FAILURE) and redirect the user to that URL (Mercuryo’s hosted widget, where they finish the payment).
- On any other failure → STATUS_FAILURE and show an error.
- POST the encrypted Apple Pay token + buyer info to:
- If isNativeApplePaySupported: false — no Apple Pay JS needed. Just open the serviceProviderWidgetUrl from the session response (it’ll point to Mercuryo’s hosted widget). User completes the payment there.
What Meld handles for you (so you don’t have to)
- mTLS to Apple’s startSession endpoint (your onmerchantvalidation POSTs to us, we do the secure call to Apple, we return merchantSession).
- Forwarding the Apple Pay token to Mercuryo’s /native-mobile-pay endpoint.
- Handling Mercuryo’s response shape (success vs redirect_url).
- Renewing the Merchant Identity cert and Apple’s annual cert chain rotations.