Programmatically register multiple domains for Apple Pay to accept digital wallet payments with the Square payment form.
Square Payment Form

Programmatically Register Multiple Domains for Apple Pay Deprecated
This component is deprecated. See below for guidance about what to use instead.

Note

The Square payment form is deprecated and replaced by the Web Payments SDK.

You should use the Web Payments SDK to take payments on a web client. The Web Payments SDK uses modern web styling as shown in the following image:

A graphic showing the five visual elements of the Card payment method, which are represented as selectors that you specify in a card option styling object.

Enable Apple Pay in multiple domains by registering domains programmatically with Square.

Before you start Permalink Get a link to this section

Programmatically register multiple domains Permalink Get a link to this section

You can use the RegisterDomain endpoint to activate multiple domains and subdomains.

Bulk registering domains can save you time if you are using SqPaymentForm as part of a platform where payments are processed on multiple subdomains. For example, you might be building a shop platform (platform.com), where sellers can create their own shops and take payments (shoes.platform.com and plants.platform.com). All these individual subdomains need to be registered to enable Web Apple Pay with Square.

To programmatically register a client domain:

  1. Download Square's copy of Apple's merchant domain verification file.

  2. Host the verification file at: https://{CLIENT DOMAIN}/.well-known/apple-developer-merchantid-domain-association.

  3. Use the RegisterDomain endpoint of the Square Apple Pay API to register and validate the domain.

The following example registers example.com:

Register Domain
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
curl https://connect.squareup.com/v2/apple-pay/domains \
  -X POST \
  -H 'Square-Version: 2022-06-16' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "domain_name": "example.com"
  }'

The response JSON:

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.