Apple Pay on Your Website
When you embed the Checkout component on your own website, Apple Pay only appears there once Apple has verified your domain. Apple does this by fetching a small file from your site, so there are two things to set up: serve that file, and register your domain with ClientLoop.
Nothing is needed for payments taken on ClientLoop's hosted checkout page; it is already set up. Apple Pay must also be enabled for your organization — contact ClientLoop if it is not.
Apple Pay is not offered when Checkout runs inside an iframe on another domain, such as a GoHighLevel invoice. Safari validates Apple Pay against the domain of the page the shopper is on, and that domain belongs to the site embedding the iframe, so it cannot be registered. Shoppers there can still pay with the checkout's other methods.
1. Serve the domain association file
Download ClientLoop's domain association file: apple-developer-merchantid-domain-association
Apple fetches this exact path on your domain:
https://YOUR-DOMAIN/.well-known/apple-developer-merchantid-domain-associationServe the file you downloaded there, unchanged. A browser shows the file as
text rather than downloading it; if you save it from the browser, make sure it
is saved with no extension (not as .txt). Or fetch it with:
curl -o apple-developer-merchantid-domain-association https://checkout.clientloop.com/.well-known/apple-developer-merchantid-domain-associationApple only accepts the file if it is served:
- at exactly that path, with no file extension on the name;
- with the header
Content-Type: text/plain; - over HTTPS, to anyone, with no login, password or IP restriction;
- directly, with no redirect.
Serve it on every domain where Checkout appears, including each subdomain:
shop.example.com and www.shop.example.com are separate domains to Apple.
Serve it on your stage and test domains as well as production, so every
environment is set up the same way; the same file works in all of them. Each
environment still needs its own origin registered in its own portal (step 2).
The file has no extension, so many web servers and storage buckets send it with
the wrong content type. Set the header explicitly — for example, as a route in
your application that returns the file's contents with text/plain. Check it
with:
curl -i https://YOUR-DOMAIN/.well-known/apple-developer-merchantid-domain-associationThe response should be 200, with content-type: text/plain, and a body
identical to ClientLoop's copy.
2. Register your domain in the portal
In the ClientLoop portal, open Developers → Manage origins for your
organization and add your site's origin: https:// followed by the domain, with
no path — for example https://shop.example.com. Select Use for Apple Pay
before saving.
This is the same registration that lets Checkout run on your site. With Use for Apple Pay selected, ClientLoop fetches the domain association file from your origin when you save, and refuses the origin if the file is missing or differs from ClientLoop's copy — so serve the file first. Once the origin is saved, ClientLoop registers it for Apple Pay on your account. An origin saved without the option is not registered for Apple Pay.
The option only appears once Apple Pay is enabled for your organization. To use an origin you already added for Apple Pay, remove it and add it again with the option selected.
Register a public domain name. Apple Pay cannot run on localhost, so it cannot
be tried from a local development server.
Removing a domain
Removing an origin from Manage origins stops Checkout from running on that site, but does not remove the domain from Apple Pay. If you need it removed there too, contact ClientLoop.
Testing
Apple Pay appears for shoppers using Safari on an Apple device with a card in Apple Wallet. In other browsers it shows a code to scan with an iPhone, which completes the payment on the phone.
On stage, Apple Pay only works with an Apple Sandbox tester account and Apple's test cards. A device signed in with a real Apple Account, or a real card in Apple Wallet, is refused. To set one up:
- Create a Sandbox Apple Account in App Store Connect, under Users and Access → Sandbox. App Store Connect needs a paid Apple Developer Program membership, or an invitation to a team that has one. The email address must never have been used for an Apple Account. See Apple's Create a Sandbox Apple Account.
- On the test iPhone or Mac, sign in with the sandbox account and set the device's region to one where Apple Pay is supported.
- In Wallet, add one of the test cards listed on Apple's Sandbox Testing page, which also covers steps 1 and 2. American Express test cards only work with the region set to the United States or United Kingdom.
See Testing for how to get a stage account and point Checkout at stage.