GoDaddy

How to set up Apple Pay

View as Markdown

Register 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:

Register a domain

The following procedure registers a checkout domain for Apple Pay.

  1. 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
  2. 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 400 when Apple can't fetch the file.

  3. 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"'"]
      }'
  4. 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.

  1. 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-association on the new hostname before the move can succeed.

  2. 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"'"]
      }'
  3. 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:

StatusMost likely causeNote
400The 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.
401The PAT is missing, expired, or lacks the required scope.POST needs commerce.store.apple-pay:write. Both GET calls need commerce.store:read.
403Apple Pay isn't enabled for the store.This API doesn't enable Apple Pay.
404The store doesn't exist.Confirm storeId.
429The call exceeded the rate limit.Wait, then retry the same request.
500The API returned an internal server error.Retry the same call.
502Apple returned a server error on POST.Retry the register call.
504The 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?

On this page