Payabli has simplified the process of getting ready to accept Apple Pay. You don’t need to create your own Apple developer account, encryption keys, certificates, or merchant identifiers.

This guide walks through how to enable Apple Pay for your organization via the API.

Enabling Apple Pay via the API has several steps.

  1. Add the domain.
  2. Validate domain ownership.
  3. Cascade the domain.
  4. Activate the Apple Pay service for your org.

The following sections go over each step in detail.

Add payment method domains

Payment method domains are the web domains where you can accept Apple Pay payments. Payabli needs to know which payment domains should accept Apple Pay payments to mitigate risk and make sure that transactions are coming from known websites. Managing your payment method domains involves configuring them in Payabli, and then verifying domain ownership with Apple.

To add a domain via the API, make a POST request to the /PaymentMethodDomain endpoint.

Payment method domain examples

The following example walks through the general structure of payment method domains.

Pretend that you own the domain example.com, and you want to accept Apple Pay on a number of different pages on your various subdomains. You must set up payment method domains for each of your target domains and subdomains.

Page URLPayment Method Domain
https://www.example.com/monthlydueswww.example.com
https://subdomain1.example.com/paymentssubdomain1.example.com
https://subdomain2.example.com/donations/paysubdomain2.example.com
https://subdomain3.example.com/ordersubdomain3.example.com

Verify domain ownership

Before you can accept Apple Pay, you must verify your ownership of a payment method domain using something called a domain-verification file. This process has two main steps: get the file, and host the file on your domain.

1

Download the domain-verification file

You must download the domain-verification file from these links. Choose the correct file for your Payabli environment.

2

Host the file on target domains

After you’ve downloaded your domain-verification file, you need to host it on the path /.well-known/apple-developer-merchantid-domain-association for each the domains you want to use to accept Apple Pay.

For example:

  • https://www.example.com/.well-known/apple-developer-merchantid-domain-association
  • https://subdomain1.example.com/.well-known/apple-developer-merchantid-domain-association
  • https://subdomain2.example.com/.well-known/apple-developer-merchantid-domain-association
  • https://subdomain3.example.com/.well-known/apple-developer-merchantid-domain-association

Payabli automatically checks for the domain-verification file. If verification succeeds, the domain is activated in Payabli. If verification fails, the domain is added but remains inactive. You can verify the domain later.

Cascade domains

You have the option to cascade domains. When you cascade a domain, all of the organization’s children, including suborganizations and paypoints, inherit the domain. This reduces future operational overhead by automatically adding verified domains to all new suborganizations and paypoints. Payabli strongly recommends cascading domains.

Cascade a domain via the API by sending a POST request to /PaymentMethodDomain/{domainId}/cascade.

You can run a GET request to /PaymentMethodDomain/{domainId} to check the cascade status.

The cascades.jobStatus field indicates whether the cascade process is complete, failed, or in progress.

 // response truncated 
    "cascades": [
      {
        "jobId": "550139",
        "jobStatus": "completed",
        "jobErrorMessage": null,
        "createdAt": "2024-09-05T14:13:54.698Z",
        "updatedAt": "2024-09-05T14:13:54.698Z"
      }
    ],

Payabli recommends a 10 second polling interval when checking domain cascade status.

Activate Apple Pay

To activate Apple Pay for an organization, make a POST request to the /Wallet/applepay/configure-organization.

In the body, send isEnabled as true to activate the Apple Pay for the organization. Send cascade as true to activate Apple Pay for the organization’s children (including suborganizations and paypoints).

Example activation request
  curl --request POST \
    --url https://api-sandbox.payabli.com/api/Wallet/applepay/configure-organization \
    --header 'Content-Type: application/json' \
    --header 'requestToken: <api-key>' \
    --data '{
    "orgId": 123,
    "isEnabled": true,
    "cascade": true
}'

After you’ve sent the activation request, Payabli will enable the service and cascade the settings, if applicable. This can take a few minutes, depending on how your entities are structured.

To check whether Apple Pay is activated, send a GET request to /api/Organization/settings/. Check the response for forWallets, when Apple Pay is active, you’ll see the following in the response:

 "forWallets": [
    {
      "key": "IsApplePayEnabled",
      "value": "true",
      "readOnly": true
    }
  ]