Skip to main content
Apple Pay needs an https page and a browser that can pay. Elements loads Apple’s SDK from applepay.cdn-apple.com. In Safari on an Apple device the customer pays on that device. In other browsers they scan a code with an iPhone on iOS 18 or later. Elements asks only whether the device can pay, not whether the customer has a card set up. On your own page the domain must be registered first.

Register your domains

Apple verifies the page’s domain every time the sheet opens. Elements asks Payra for a merchant session, Apple’s signed proof that the page belongs to a registered merchant, for window.location.hostname. Payra’s processor signs one only for the domains registered to your workspace. On any other host, tapping the button answers error with wallet_domain_not_allowed and the sheet closes without taking a payment. To register, send your Payra contact the exact hostnames that will show the button, such as checkout.example.com and www.example.com. Wildcards are not accepted, so list each subdomain.
Registering a new merchant with Apple takes 3 to 4 weeks, even if you have accepted Apple Pay before. Send your hostnames well ahead of launch.
Then host the domain association file Payra gives you at
served with 200, as text/plain, without a login, a proxy or a redirect. Apple reads it at registration and again later, so keep it in place. localhost cannot be registered, so try Apple Pay on a real hostname.

Apple Pay errors

Apple closes its sheet after a failure. When Payra refused the token, cancel follows error. When the merchant session failed, error comes alone. Besides the shared codes, the merchant session can answer:

Test Apple Pay

Payments in sandbox run in Apple’s sandbox. Sign the test device in with an Apple sandbox tester account and add one of Apple’s test cards to its Wallet. A real card does not pay there.