How to set up Apple Pay
View as MarkdownRegister your website domain for Apple Pay so Unified Checkout can offer it on web checkout.
Overview
This page covers the steps to register a website hostname with Apple so Unified Checkout can offer Apple Pay. It uses the Apple Pay API at https://api.godaddy.com/v1/commerce. Terminal payments through Payment Requests don't need domain registration.
Your server downloads a domain association file with GET /stores/{storeId}/apple-pay/domain-association-file, hosts the file unchanged on the checkout hostname, and registers that hostname with POST /stores/{storeId}/apple-pay/registration. The same POST can remove an old hostname, and GET /stores/{storeId}/apple-pay/registration returns the registered domains. Send each hostname in registerDomains and unregisterDomains with no scheme or path. shop.example.com is valid, and registerDomains accepts at most 99 hostnames per call. The body needs at least one of registerDomains, unregisterDomains, or merchantName. Omit merchantName and the store keeps its current Apple Pay name, or uses the business's doing-business-as or legal name. merchantUrl is an absolute URL, like https://shop.example.com. reason is optional.
Go to How to configure checkout for the applePay payment method. Go to Register domains for Apple Pay for the request and response schemas.
Prerequisites
You need the following before you can set up Apple Pay:
-
a GoDaddy Payments account on the business that owns the store
Create a GoDaddy Payments account
Go to Set up a GoDaddy Payments account for account creation and store activation.
-
a Personal Access Token (PAT) with the
commerce.store:readandcommerce.store.apple-pay:writescopes, created on the account that owns the store -
your
storeIdFind your store ID
Sign in to your GoDaddy account. Go to About the Commerce API for your
storeId. -
a public HTTPS domain where web checkout is offered
Register a domain
The following procedure registers a checkout domain for Apple Pay.
-
Download the domain association file:
Save the response unchanged
The response body is
text/plain. Host that file unchanged.curl -fsS "https://api.godaddy.com/v1/commerce/stores/$STORE_ID/apple-pay/domain-association-file" \ -H "Authorization: Bearer $GODADDY_PAT" \ -o apple-developer-merchantid-domain-association -
Host the downloaded file unchanged at
/.well-known/apple-developer-merchantid-domain-association:Apple checks the file in production
Apple fetches this file in production before registration can succeed. The register call returns
400when Apple can't fetch the file. -
Register the domain:
curl -s -X POST "https://api.godaddy.com/v1/commerce/stores/$STORE_ID/apple-pay/registration" \ -H "Authorization: Bearer $GODADDY_PAT" \ -H "Content-Type: application/json" \ -d '{ "registerDomains": ["'"$DOMAIN"'"] }' -
Check the registration:
curl -s -w "\n%{http_code}\n" "https://api.godaddy.com/v1/commerce/stores/$STORE_ID/apple-pay/registration" \ -H "Authorization: Bearer $GODADDY_PAT"
Move to a new domain
The following procedure moves Apple Pay to a new domain.
-
Host the same domain association file, unchanged, on the new domain:
Apple checks the new domain in production
Apple fetches
/.well-known/apple-developer-merchantid-domain-associationon the new hostname before the move can succeed. -
Register the new domain and remove the old one:
curl -s -w "\n%{http_code}\n" -X POST "https://api.godaddy.com/v1/commerce/stores/$STORE_ID/apple-pay/registration" \ -H "Authorization: Bearer $GODADDY_PAT" \ -H "Content-Type: application/json" \ -d '{ "registerDomains": ["'"$DOMAIN"'"], "unregisterDomains": ["'"$OLD_DOMAIN"'"] }' -
Go to Register a domain for the registration check.
Example responses
The following examples show trimmed 200 responses.
Register domains
200 returns the store's current registration. The response omits merchantUrl when you don't send it.
No registration body
204 has no body when the store has no registration left, or when a domain in unregisterDomains isn't registered.
The following example shows a 200 response:
{
"domains": ["$DOMAIN"],
"merchantName": "$MERCHANT_NAME"
}Get the registration
The hostname you registered appears in domains on a 200 response. A missing hostname in that body means the register call didn't add it.
The following example shows a 200 response with the registered domains and merchant name:
{
"domains": ["$DOMAIN"],
"merchantName": "$MERCHANT_NAME"
}Common errors
The following table lists common errors for these calls:
| Status | Most likely cause | Note |
|---|---|---|
400 | The input is invalid. On POST, Apple can't fetch the domain association file. | Host the file at /.well-known/apple-developer-merchantid-domain-association before POST. Send hostnames with no scheme or path. registerDomains accepts at most 99 hostnames per call. Send at least one of registerDomains, unregisterDomains, or merchantName. |
401 | The PAT is missing, expired, or lacks the required scope. | POST needs commerce.store.apple-pay:write. Both GET calls need commerce.store:read. |
403 | Apple Pay isn't enabled for the store. | This API doesn't enable Apple Pay. |
404 | The store doesn't exist. | Confirm storeId. |
429 | The call exceeded the rate limit. | Wait, then retry the same request. |
500 | The API returned an internal server error. | Retry the same call. |
502 | Apple returned a server error on POST. | Retry the register call. |
504 | The call to Apple timed out on POST. | Retry the register call. |
Go to Register domains for Apple Pay for the full schemas.
Last updated on
How is this guide?