---
title: "Decrypt Apple Pay tokens"
description: "Learn how to decrypt Apple Pay tokens."
url: "https://docs.adyen.com/payment-methods/apple-pay/api-only/apple-pay-token-decryption"
source_url: "https://docs.adyen.com/payment-methods/apple-pay/api-only/apple-pay-token-decryption.md"
canonical: "https://docs.adyen.com/payment-methods/apple-pay/api-only/apple-pay-token-decryption"
last_modified: "2024-11-26T14:42:00+01:00"
language: "en"
---

# Decrypt Apple Pay tokens

Learn how to decrypt Apple Pay tokens.

[View source](/payment-methods/apple-pay/api-only/apple-pay-token-decryption.md)

An Apple Pay token contains encrypted data of a transaction performed with Apple Pay. Apple Pay tokens enable you to securely pass the data of your shoppers to a payment service provider, like Adyen.

## Choose a decryption method

If you are [PCI-compliant](https://docs.adyen.com/get-started-with-adyen/adyen-glossary/#pci-compliance) you have a choice of letting Adyen handle the token decryption, or handling it on your own.

Only handle the token decryption on your own in advanced setup scenarios, like when you have to submit Merchant Plug-In (MPI) data in an Apple Pay request.

A benefit of handling the decryption on your own is that the auditing of transactions becomes easier with the availability of transaction data like shopper names.

If you are not PCI-compliant you must let Adyen handle the decryption.

## Let Adyen handle the decryption

### In-app

After initiating the Apple Pay payment on your mobile application, you receive a callback that includes a `PKPayment`. This includes `paymentData`, a stringified version of the payment token. You need to submit this data in your [payment request to Adyen](#step-2-submit-the-api-request1).

1. Stringify the paymentData from the token

   When the request is completed, you receive a [PKPayment](https://developer.apple.com/documentation/passkit/pkpayment?changes=latest_ma_8\&language=objc) which contains `paymentData`. Apple Pay returns more data than we need for authorization, for example a shipping address, but only the `paymentData` is necessary for authorization.

   Convert the `paymentData` to a String:

   ```swift
   func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) {
   let token = payment.token.paymentData.base64EncodedString()
   }
   ```

2. Submit the API request

   Include the encoded token from step 1 as the value of `applePayToken` in the `paymentMethod` object of your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request:

   #### curl

   ```bash
   curl https://checkout-test.adyen.com/v72/payments \
   -H 'x-api-key: ADYEN_API_KEY' \
   -H 'content-type: application/json' \
   -d '{
       "amount": {
       "currency": "EUR",
       "value": 2000
       },
       "reference": "YOUR_REFERENCE",
       "paymentMethod": {
       "type": "applepay",
       "applePayToken": "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU..."
       },
       "returnUrl": "https://your-company.example.com/...",
       "merchantAccount": "ADYEN_MERCHANT_ACCOUNT"
       }'
   ```

   #### Java

   ```java
   // Adyen Java API Library v27.0.0
   import com.adyen.Client;
   import com.adyen.enums.Environment;
   import com.adyen.model.checkout.*;
   import java.time.OffsetDateTime;
   import java.util.*;
   import com.adyen.model.RequestOptions;
   import com.adyen.service.checkout.*;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   Client client = new Client("ADYEN_API_KEY", Environment.TEST);

   // Create the request object(s)
   Amount amount = new Amount()
     .currency("EUR")
     .value(2000L);

   ApplePayDetails applePayDetails = new ApplePayDetails()
     .applePayToken("VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...")
     .type(ApplePayDetails.TypeEnum.APPLEPAY);

   PaymentRequest paymentRequest = new PaymentRequest()
     .reference("YOUR_REFERENCE")
     .amount(amount)
     .merchantAccount("ADYEN_MERCHANT_ACCOUNT")
     .paymentMethod(new CheckoutPaymentMethod(applePayDetails))
     .returnUrl("https://your-company.example.com/...");

   // Send the request
   PaymentsApi service = new PaymentsApi(client);
   PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
   ```

   #### PHP

   ```php
   // Adyen PHP API Library v19.0.0
   use Adyen\Client;
   use Adyen\Environment;
   use Adyen\Model\Checkout\Amount;
   use Adyen\Model\Checkout\CheckoutPaymentMethod;
   use Adyen\Model\Checkout\PaymentRequest;
   use Adyen\Service\Checkout\PaymentsApi;

   $client = new Client();
   $client->setXApiKey("ADYEN_API_KEY");
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   $client->setEnvironment(Environment::TEST);


   // Create the request object(s)
   $amount = new Amount();
   $amount
     ->setCurrency("EUR")
     ->setValue(2000);

   $checkoutPaymentMethod = new CheckoutPaymentMethod();
   $checkoutPaymentMethod
     ->setApplePayToken("VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...")
     ->setType("applepay");

   $paymentRequest = new PaymentRequest();
   $paymentRequest
     ->setReference("YOUR_REFERENCE")
     ->setAmount($amount)
     ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT")
     ->setPaymentMethod($checkoutPaymentMethod)
     ->setReturnUrl("https://your-company.example.com/...");

   $requestOptions['idempotencyKey'] = 'UUID';

   // Send the request
   $service = new PaymentsApi($client);
   $response = $service->payments($paymentRequest, $requestOptions);
   ```

   #### C\#

   ```cs
   // Adyen .net API Library v17.0.0
   using Adyen;
   using Environment = Adyen.Model.Environment;
   using Adyen.Model;
   using Adyen.Model.Checkout;
   using Adyen.Service.Checkout;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   var config = new Config()
   {
       XApiKey = "ADYEN_API_KEY",
       Environment = Environment.Test
   };
   var client = new Client(config);

   // Create the request object(s)
   Amount amount = new Amount
   {
     Currency = "EUR",
     Value = 2000
   };

   ApplePayDetails applePayDetails = new ApplePayDetails
   {
     ApplePayToken = "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...",
     Type = ApplePayDetails.TypeEnum.Applepay
   };

   PaymentRequest paymentRequest = new PaymentRequest
   {
     Reference = "YOUR_REFERENCE",
     Amount = amount,
     MerchantAccount = "ADYEN_MERCHANT_ACCOUNT",
     PaymentMethod = new CheckoutPaymentMethod(applePayDetails),
     ReturnUrl = "https://your-company.example.com/..."
   };

   // Send the request
   var service = new PaymentsService(client);
   var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
   ```

   #### NodeJS (JavaScript)

   ```js
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   const { Client, CheckoutAPI } = require('@adyen/api-library');
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const paymentRequest = {
     amount: {
       currency: "EUR",
       value: 2000
     },
     reference: "YOUR_REFERENCE",
     paymentMethod: {
       type: "applepay",
       applePayToken: "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU..."
     },
     returnUrl: "https://your-company.example.com/...",
     merchantAccount: "ADYEN_MERCHANT_ACCOUNT"
   }

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

   #### Go

   ```go
   // Adyen Go API Library v10.4.0
   import (
     "context"
     "github.com/adyen/adyen-go-api-library/v9/src/common"
     "github.com/adyen/adyen-go-api-library/v9/src/adyen"
     "github.com/adyen/adyen-go-api-library/v9/src/checkout"
   )
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   client := adyen.NewClient(&common.Config{
     ApiKey:      "ADYEN_API_KEY",
     Environment: common.TestEnv,
   })

   // Create the request object(s)
   amount := checkout.Amount{
     Currency: "EUR",
     Value: 2000,
   }

   applePayDetails := checkout.ApplePayDetails{
     ApplePayToken: "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...",
     Type: common.PtrString("applepay"),
   }

   paymentRequest := checkout.PaymentRequest{
     Reference: "YOUR_REFERENCE",
     Amount: amount,
     MerchantAccount: "ADYEN_MERCHANT_ACCOUNT",
     PaymentMethod: checkout.ApplePayDetailsAsCheckoutPaymentMethod(&applePayDetails),
     ReturnUrl: "https://your-company.example.com/...",
   }

   // Send the request
   service := client.Checkout()
   req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
   res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
   ```

   #### Python

   ```py
   # Adyen Python API Library v12.5.1
   import Adyen

   adyen = Adyen.Adyen()
   adyen.client.xapikey = "ADYEN_API_KEY"
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.client.platform = "test" # The environment to use library in.

   # Create the request object(s)
   json_request = {
     "amount": {
       "currency": "EUR",
       "value": 2000
     },
     "reference": "YOUR_REFERENCE",
     "paymentMethod": {
       "type": "applepay",
       "applePayToken": "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU..."
     },
     "returnUrl": "https://your-company.example.com/...",
     "merchantAccount": "ADYEN_MERCHANT_ACCOUNT"
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
   ```

   #### Ruby

   ```rb
   # Adyen Ruby API Library v9.5.1
   require "adyen-ruby-api-library"

   adyen = Adyen::Client.new
   adyen.api_key = 'ADYEN_API_KEY'
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.env = :test # Set to "live" for live environment

   # Create the request object(s)
   request_body = {
     :amount => {
       :currency => 'EUR',
       :value => 2000
     },
     :reference => 'YOUR_REFERENCE',
     :paymentMethod => {
       :type => 'applepay',
       :applePayToken => 'VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...'
     },
     :returnUrl => 'https://your-company.example.com/...',
     :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT'
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
   ```

   #### NodeJS (TypeScript)

   ```ts
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   import { Client, CheckoutAPI, Types } from "@adyen/api-library";
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const amount: Types.checkout.Amount = {
     currency: "EUR",
     value: 2000
   };

   const applePayDetails: Types.checkout.ApplePayDetails = {
     applePayToken: "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...",
     type: Types.checkout.ApplePayDetails.TypeEnum.Applepay
   };

   const paymentRequest: Types.checkout.PaymentRequest = {
     reference: "YOUR_REFERENCE",
     amount: amount,
     merchantAccount: "ADYEN_MERCHANT_ACCOUNT",
     paymentMethod: applePayDetails,
     returnUrl: "https://your-company.example.com/..."
   };

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

### Web

After initiating the Apple Pay payment on your website you receive a token in the [onPaymentAuthorized](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778020-onpaymentauthorized) event.

Retrieve the `paymentData` from the token and convert it to a string. Pass this to your server, and then submit it in a `/payments` request to Adyen.

1. Stringify the paymentData from the token

   Apple Pay returns more data than we need for authorization, for example a shipping address, but only the `PaymentData` is necessary for authorization. Take this data from the token and convert the JSON to a String and base64-encoded:

   ```js
   session.onpaymentauthorized = function(event) {
   var token = btoa(JSON.stringify(event.payment.token.paymentData));
   };
   ```

2. Submit the API request

   Include the encoded token from step 1 as the value of `applePayToken` in the `paymentMethod` object of your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request:

   #### curl

   ```bash
   curl https://checkout-test.adyen.com/v72/payments \
   -H 'x-api-key: ADYEN_API_KEY' \
   -H 'content-type: application/json' \
   -d '{
         "amount": {
           "currency": "USD",
           "value": 1000
         },
         "reference": "Your order number",
         "paymentMethod": {
           "type": "applepay",
           "applePayToken": "{hint:token from step 1}VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...{/hint}"
         },
         "returnUrl": "https://your-company.example.com/...",
         "merchantAccount": "ADYEN_MERCHANT_ACCOUNT"
       }'
   ```

   #### Java

   ```java
   // Adyen Java API Library v27.0.0
   import com.adyen.Client;
   import com.adyen.enums.Environment;
   import com.adyen.model.checkout.*;
   import java.time.OffsetDateTime;
   import java.util.*;
   import com.adyen.model.RequestOptions;
   import com.adyen.service.checkout.*;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   Client client = new Client("ADYEN_API_KEY", Environment.TEST);

   // Create the request object(s)
   Amount amount = new Amount()
     .currency("USD")
     .value(1000L);

   ApplePayDetails applePayDetails = new ApplePayDetails()
     .applePayToken("VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...")
     .type(ApplePayDetails.TypeEnum.APPLEPAY);

   PaymentRequest paymentRequest = new PaymentRequest()
     .reference("Your order number")
     .amount(amount)
     .merchantAccount("ADYEN_MERCHANT_ACCOUNT")
     .paymentMethod(new CheckoutPaymentMethod(applePayDetails))
     .returnUrl("https://your-company.example.com/...");

   // Send the request
   PaymentsApi service = new PaymentsApi(client);
   PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
   ```

   #### PHP

   ```php
   // Adyen PHP API Library v19.0.0
   use Adyen\Client;
   use Adyen\Environment;
   use Adyen\Model\Checkout\Amount;
   use Adyen\Model\Checkout\CheckoutPaymentMethod;
   use Adyen\Model\Checkout\PaymentRequest;
   use Adyen\Service\Checkout\PaymentsApi;

   $client = new Client();
   $client->setXApiKey("ADYEN_API_KEY");
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   $client->setEnvironment(Environment::TEST);


   // Create the request object(s)
   $amount = new Amount();
   $amount
     ->setCurrency("USD")
     ->setValue(1000);

   $checkoutPaymentMethod = new CheckoutPaymentMethod();
   $checkoutPaymentMethod
     ->setApplePayToken("VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...")
     ->setType("applepay");

   $paymentRequest = new PaymentRequest();
   $paymentRequest
     ->setReference("Your order number")
     ->setAmount($amount)
     ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT")
     ->setPaymentMethod($checkoutPaymentMethod)
     ->setReturnUrl("https://your-company.example.com/...");

   $requestOptions['idempotencyKey'] = 'UUID';

   // Send the request
   $service = new PaymentsApi($client);
   $response = $service->payments($paymentRequest, $requestOptions);
   ```

   #### C\#

   ```cs
   // Adyen .net API Library v17.0.0
   using Adyen;
   using Environment = Adyen.Model.Environment;
   using Adyen.Model;
   using Adyen.Model.Checkout;
   using Adyen.Service.Checkout;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   var config = new Config()
   {
       XApiKey = "ADYEN_API_KEY",
       Environment = Environment.Test
   };
   var client = new Client(config);

   // Create the request object(s)
   Amount amount = new Amount
   {
     Currency = "USD",
     Value = 1000
   };

   ApplePayDetails applePayDetails = new ApplePayDetails
   {
     ApplePayToken = "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...",
     Type = ApplePayDetails.TypeEnum.Applepay
   };

   PaymentRequest paymentRequest = new PaymentRequest
   {
     Reference = "Your order number",
     Amount = amount,
     MerchantAccount = "ADYEN_MERCHANT_ACCOUNT",
     PaymentMethod = new CheckoutPaymentMethod(applePayDetails),
     ReturnUrl = "https://your-company.example.com/..."
   };

   // Send the request
   var service = new PaymentsService(client);
   var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
   ```

   #### NodeJS (JavaScript)

   ```js
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   const { Client, CheckoutAPI } = require('@adyen/api-library');
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const paymentRequest = {
     amount: {
       currency: "USD",
       value: 1000
     },
     reference: "Your order number",
     paymentMethod: {
       type: "applepay",
       applePayToken: "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU..."
     },
     returnUrl: "https://your-company.example.com/...",
     merchantAccount: "ADYEN_MERCHANT_ACCOUNT"
   }

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

   #### Go

   ```go
   // Adyen Go API Library v10.4.0
   import (
     "context"
     "github.com/adyen/adyen-go-api-library/v9/src/common"
     "github.com/adyen/adyen-go-api-library/v9/src/adyen"
     "github.com/adyen/adyen-go-api-library/v9/src/checkout"
   )
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   client := adyen.NewClient(&common.Config{
     ApiKey:      "ADYEN_API_KEY",
     Environment: common.TestEnv,
   })

   // Create the request object(s)
   amount := checkout.Amount{
     Currency: "USD",
     Value: 1000,
   }

   applePayDetails := checkout.ApplePayDetails{
     ApplePayToken: "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...",
     Type: common.PtrString("applepay"),
   }

   paymentRequest := checkout.PaymentRequest{
     Reference: "Your order number",
     Amount: amount,
     MerchantAccount: "ADYEN_MERCHANT_ACCOUNT",
     PaymentMethod: checkout.ApplePayDetailsAsCheckoutPaymentMethod(&applePayDetails),
     ReturnUrl: "https://your-company.example.com/...",
   }

   // Send the request
   service := client.Checkout()
   req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
   res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
   ```

   #### Python

   ```py
   # Adyen Python API Library v12.5.1
   import Adyen

   adyen = Adyen.Adyen()
   adyen.client.xapikey = "ADYEN_API_KEY"
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.client.platform = "test" # The environment to use library in.

   # Create the request object(s)
   json_request = {
     "amount": {
       "currency": "USD",
       "value": 1000
     },
     "reference": "Your order number",
     "paymentMethod": {
       "type": "applepay",
       "applePayToken": "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU..."
     },
     "returnUrl": "https://your-company.example.com/...",
     "merchantAccount": "ADYEN_MERCHANT_ACCOUNT"
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
   ```

   #### Ruby

   ```rb
   # Adyen Ruby API Library v9.5.1
   require "adyen-ruby-api-library"

   adyen = Adyen::Client.new
   adyen.api_key = 'ADYEN_API_KEY'
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.env = :test # Set to "live" for live environment

   # Create the request object(s)
   request_body = {
     :amount => {
       :currency => 'USD',
       :value => 1000
     },
     :reference => 'Your order number',
     :paymentMethod => {
       :type => 'applepay',
       :applePayToken => 'VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...'
     },
     :returnUrl => 'https://your-company.example.com/...',
     :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT'
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
   ```

   #### NodeJS (TypeScript)

   ```ts
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   import { Client, CheckoutAPI, Types } from "@adyen/api-library";
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const amount: Types.checkout.Amount = {
     currency: "USD",
     value: 1000
   };

   const applePayDetails: Types.checkout.ApplePayDetails = {
     applePayToken: "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU...",
     type: Types.checkout.ApplePayDetails.TypeEnum.Applepay
   };

   const paymentRequest: Types.checkout.PaymentRequest = {
     reference: "Your order number",
     amount: amount,
     merchantAccount: "ADYEN_MERCHANT_ACCOUNT",
     paymentMethod: applePayDetails,
     returnUrl: "https://your-company.example.com/..."
   };

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

## Handle the decryption on your own

### Requirements

To decrypt Apple Pay tokens on your own, you must:

* Have an [Apple Developer account](https://developer.apple.com/) that is associated with either the [Apple Developer Program](https://developer.apple.com/programs/), or the [Apple Developer Enterprise Program](https://developer.apple.com/programs/enterprise/).
* Use your own Apple Pay certificate.
* Be PCI-compliant to handle unencrypted card details.
* Have an API-only integration.

### Decryption process

Verify the Apple Pay certificate before proceeding to token decryption.

To decrypt Apple Pay tokens, follow the [detailed steps as outlined on the Apple developer portal](https://developer.apple.com/documentation/passkit/apple_pay/payment_token_format_reference#//apple_ref/doc/uid/TP40014929-CH8-SW1).

Overview:

1. Use the value of publicKeyHash to determine which merchant public key Apple used, and then retrieve the corresponding merchant public key certificate and private key.
2. Restore the symmetric key.
3. Use the symmetric key to decrypt the value of the data key.
4. Confirm that you have not already credited this payment by verifying that no payment with the same `transactionId` shows as processed.
5. Verify the original transaction details of the Apple Pay payment request.
6. Use the decrypted payment data to process the payment. See the API reference section below for details.

### API reference

The parameters listed in this section are specific to using decrypted Apple Pay tokens. For descriptions of other parameters go to [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments).

There are two types of transactions, namely customer initiated and merchant initiated transactions, each with a specific set of parameters.

### Tab: Customer initiated transaction

| Parameter name                                                                                                                               | Required                                                                                    | Description                                                                                                                                                                              |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [paymentMethod.expiryMonth](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-expiryMonth) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **applicationExpirationDate** value contained in the Apple Pay token.                                                                                                            |
| [paymentMethod.expiryYear](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-expiryYear)   | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **applicationExpirationDate** value contained in the Apple Pay token.                                                                                                            |
| [paymentMethod.holderName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-holderName)   | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **cardholderName** value contained in the Apple Pay token.                                                                                                                       |
| [paymentMethod.number](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-number)           | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **applicationPrimaryAccountNumber** value contained in the Apple Pay token.                                                                                                      |
| [paymentMethod.brand](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-brand)             |                                                                                             | This field is relevant for reconciliation.                                                                                                                                               |
| [mpiData.authenticationResponse](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mpiData-authenticationResponse)   | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to "**Y**".                                                                                                                                                                          |
| [mpiData.cavv](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mpiData-cavv)                                       | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **onlinePaymentCryptogram** value contained in the Apple Pay token.                                                                                                              |
| [mpiData.directoryResponse](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mpiData-directoryResponse)             | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to "**Y**".                                                                                                                                                                          |
| [mpiData.eci](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mpiData-eci)                                         | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **eciIndicator** value contained in the Apple Pay token. If you do not receive the `eciIndicator` variable in the Apple Pay token, you can omit this parameter from the request. |

```curl
curl https://checkout-test.adyen.com/v72/payments \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
    "amount": {
            "currency": "USD",
            "value": 1000
        },
    "reference": "Your order number",
    "paymentMethod": {
            "type": "scheme",
            "brand": "applepay",
            "number": "************1234",
            "expiryMonth": "12",
            "expiryYear": "24",
            "holderName": "ApplePay"
        },
    "mpiData": {
            "authenticationResponse": "Y",
            "cavv": "II67QpgqW/llYxZSBACWojEBhgA=",
            "directoryResponse": "Y",
            "eci": "07"
        },
    "returnUrl": "https://your-company.example.com/...",
    "merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}'
```

### Tab: Merchant initiated transaction

| Parameter name                                                                                                                               | Required                                                                                    | Description                                                                         |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [paymentMethod.expiryMonth](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-expiryMonth) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **applicationExpirationDate** value contained in the Apple Pay token.       |
| [paymentMethod.expiryYear](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-expiryYear)   | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **applicationExpirationDate** value contained in the Apple Pay token.       |
| [paymentMethod.holderName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-holderName)   | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **cardholderName** value contained in the Apple Pay token.                  |
| [paymentMethod.number](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-number)           | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use the **applicationPrimaryAccountNumber** value contained in the Apple Pay token. |
| [paymentMethod.brand](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-brand)             |                                                                                             | This field is relevant for reconciliation.                                          |

```curl
curl https://checkout-test.adyen.com/v72/payments \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
    "reference" : "MY_REFERENCE",
    "merchantOrderReference" : "MY_ORDER_REFERENCE",
    "amount" : {
            "currency" : "EUR",
            "value" : "50000"
        },
    "merchantAccount" : "ADYEN_MERCHANT_ACCOUNT",
    "recurringProcessingModel" : "Subscription",
    "paymentMethod" : {
            "number" : "************1234",
            "expiryMonth" : "12",
            "expiryYear" : "2024",
            "type" : "scheme",
            "brand" : "applepay"
        },
    "shopperInteraction" : "ContAuth",
    "shopperIP" : "1.1.1.1",
    "additionalData" : {
            "networkTxReference" : "ABCDEF0GH1234"
        },
    "billingAddress" : {
            "country" : "DE",
            "city" : "Berlin",
            "street" : "Friedrichstr.",
            "houseNumberOrName" : "63",
            "postalCode" : "10117"
        }
}'
```
