Create Apple Pay token | Moov Documentation

Create Apple Pay token

Connect an Apple Pay token to the specified account.

Read our Apple Pay tutorial to learn more. The token data is defined by Apple Pay and should be passed through from Apple Pay's response unmodified.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/cards.write scope.

POST

/accounts/{accountID}/apple-pay/tokens

Request Example

curl -X POST "https://api.moov.io/accounts/{accountID}/apple-pay/tokens" \
  -H "Authorization: Bearer {token}" \
  -H "X-Moov-Version: v2026.07.00" \
  -d '{
  "token": {
    "paymentData": {
      "version": "EC_v1",
      "data": "3+f4oOTwPa6f1UZ6tG...CE=", 
      "signature": "MIAGCSqGSIb3DQ.AAAA==",
      "header": {
        "publicKeyHash": "l0CnXdMv...D1I=",
        "transactionId": "32b...4f3"
      }
    },
    "paymentMethod": {
      "displayName": "Visa 1234",
      "network": "Visa",
      "type": "debit"
    },
    "transactionIdentifier": "32b...4f3"
  }
}'

Go Example

mc, _ := moov.NewClient()

var accountID string

address := moov.ApplePayBillingContact{
  AddressLines: []string{
    "123 Sesame Street",
  },
  Locality:           "Phoenix",
  PostalCode:         "30345",
  AdministrativeArea: "AZ",
  CountryCode:        "US",
}

token := moov.ApplePayToken{
  PaymentData: moov.ApplePaymentData{
    Version:   "EC_v1",
    Data:      "3+f4oOTwPa6f1UZ6tG...CE=",
    Signature: "MIAGCSqGSIb3DQ.AAAA==",
    Header: moov.ApplePaymentDataHeader{
      EphemeralPublicKey: "MFkwEK...Md==",
      PublicKeyHash:      "l0CnXdMv...D1I=",
      TransactionId:      "32b...4f3",
    },
  },
  PaymentMethod: moov.ApplePaymentMethod{
    DisplayName: "Visa 1234",
    Network:     "Visa",
    Type:        "debit",
  },
  TransactionIdentifier: "32b...4f3",
}

mc.LinkApplePayToken(ctx, accountID,
  moov.LinkApplePay{
    Token:          token,
    BillingContact: address,
  })

TypeScript Example

import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.applePay.linkToken({
    accountID: "bf498c07-3852-4060-b561-bf992e26a851",
    linkApplePay: {
      token: {
        paymentData: {
          version: "EC_v1",
          data: "3+f4oOTwPa6f1UZ6tG...CE=",
          signature: "MIAGCSqGSIb3DQ.AAAA==",
          header: {
            ephemeralPublicKey: "MFkwEK...Md==",
            publicKeyHash: "l0CnXdMv...D1I=",
            transactionId: "32b...4f3",
          },
        },
        paymentMethod: {
          displayName: "Visa 1234",
          network: "Visa",
          type: "debit",
        },
        transactionIdentifier: "32b...4f3",
      },
      billingContact: {
        addressLines: [
          "123 Sesame Street",
        ],
        locality: "Phoenix",
        postalCode: "30345",
        administrativeArea: "AZ",
        countryCode: "US",
      },
    },
  });

console.log(result);
}

run();

PHP Example

declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\