Docs/Wallets/Apple Pay

Apple Pay

Accept Apple Pay via moat. Customer authenticates on their device; you receive a tokenized payment you can charge like any other.

Apple Pay lets customers authorize a payment with Face ID or Touch ID on a supported Apple device. On the web, the flow is initiated with Apple Pay JS; the browser returns a payment token, which moat accepts in place of a card.

Two integration paths

You can integrate Apple Pay directly using Apple's Payment Request JS API and forward the token to moat, or use moat's WalletJS which wraps Apple Pay and Google Pay behind a single call. WalletJS is the recommended path unless you have specific reasons to go direct.

Prerequisites

  1. Apple Developer account — required to register domains and generate a merchant identifier.
  2. Merchant identifier — created at developer.apple.com. Format: merchant.com.yourcompany.
  3. Domain verification — Apple requires each domain that initiates Apple Pay to be verified. You host a verification file at /.well-known/apple-developer-merchantid-domain-association.
  4. HTTPS — Apple Pay JS only works over HTTPS, including on your development and staging domains.

Configure on moat

In the Control Panel, go to Settings → Wallets → Apple Pay and:

  1. Enter your Apple merchant identifier.
  2. Upload the Payment Processing Certificate (.pem) issued by Apple and paired with your merchant ID. moat uses this to decrypt Apple Pay tokens.
  3. Add each domain that will initiate Apple Pay. Download the verification file for each and host it at the well-known path described above.

Direct integration

If you are integrating Apple Pay JS directly (rather than via WalletJS), the flow is:

  1. Detect Apple Pay availability with ApplePaySession.canMakePayments().
  2. Render an Apple Pay button.
  3. On click, create an ApplePaySession with your request details.
  4. Handle onvalidatemerchant — call moat's validation endpoint and return the result to Apple.
  5. Handle onpaymentauthorized — you receive an encrypted Apple Pay token. Send it to moat to charge.

Merchant validation

POST /api/wallet/apple-pay/validate
{
  "validation_url": "https://apple-pay-gateway.apple.com/...",  // from Apple session
  "domain": "checkout.yoursite.com",
  "display_name": "Your Store"
}

moat returns a merchant session object — pass it back to Apple via session.completeMerchantValidation(merchantSession).

Charging the Apple Pay token

When Apple calls your onpaymentauthorized handler, you receive an encrypted Apple Pay payment token. Send it to moat as the payment method:

{
  "type": "sale",
  "amount": 2500,
  "payment_method": {
    "apple_pay_token": {
      "token": {
        "paymentData": { ... },
        "paymentMethod": { ... },
        "transactionIdentifier": "..."
      }
    }
  }
}

moat decrypts the token using the merchant certificate, extracts the DPAN, and submits it to the card network as a card-present transaction. You get the standard transaction response back.

Supported regions and cards

Apple Pay is available in most markets where moat processes. Card support depends on the issuer — Apple publishes the full list at apple.com/apple-pay. Test cards for Apple Pay differ from raw card test data: use Apple's sandbox testers (created in App Store Connect) on a test device.

Common issues

SymptomLikely cause
Button does not appearDomain not verified, or user is not on a supported device / browser.
Merchant validation failsCertificate not uploaded to moat, or not paired with the configured merchant ID.
"Payment not completed" on deviceUsually a decline downstream — check the moat transaction log for the decline reason.