---
updatedAt: 2025-07-17T05:21:10.000Z
agentTools:
  projectIndex: https://developers.tap.company/llms.txt
---

# Apple Pay (Decrypted Payload)

This documentation provides instructions for making a payment using decrypted data obtained from an Apple Pay payload.

This document assumes that you have access to the decrypted data from the Apple Pay payload.

# Step 1: Obtain Decrypted Data

Ensure that you have decrypted data from the Apple Pay payload, which should include the necessary card information.

# Step 2: Format the Decrypted Data

The decrypted data must be structured in a JSON format, containing the following key information:

**applicationPrimaryAccountNumber**: The primary account number of the card.

**applicationExpirationDate**: The expiration date of the card.

**cardholderName**: The name of the cardholder.

**paymentData**: A nested object that includes the onlinePaymentCryptogram and eciIndicator.

**currencyCode**: The currency code associated with the transaction.

**transactionAmount**: The amount of the transaction in the specified currency.

**deviceManufacturerIdentifier**: A unique identifier for the device manufacturer involved in the transaction.

**paymentDataType**: The type of payment data, such as "3DSecure" for 3D Secure transactions.

## Example JSON Structure

Below is an example of how the decrypted data should be formatted:

```json
{
	"applicationPrimaryAccountNumber": "46751XXXXXX0031147",
	"applicationExpirationDate": "300930",
	"currencyCode": "414",
	"transactionAmount": 100,
	"deviceManufacturerIdentifier": "040010030273",
	"paymentDataType": "3DSecure",
	"paymentData": {
		"onlinePaymentCryptogram": "/wAAAAAAIDcU544AAAAAgMBgAoA=",
		"eciIndicator": "5"
	}
}
```

# Step 3: Encrypt Decrypted Data

Encrypt the formatted JSON data (from step 2) with the RSA algorithm, using the provided Tap public key.

Refer this doc for steps to encrypt <Anchor label="RSA Encryption" target="_blank" href="https://developers.tap.company/docs/encrypted-card-flow-pci#/obtain-the-rsa-public-key-from-tap">RSA Encryption</Anchor>

# Step 4: Make API Request to Authorize/Charge

Use the following cURL request to send the encrypted data to the Tap API:

```json
curl --location 'https://api.tap.company/v2/charges' \
--header 'Authorization: Bearer sk_test_eUf******AuFDiLIqlwg9' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
    "amount": 1,
    "currency": "SAR",
    "customer_initiated": "true",
    "threeDSecure": true,
    "save_card": false,
    "metadata": {
        "udf1": "test_data_1",
        "udf2": "test_data_2",
        "udf3": "test_data_3"
    },
    "reference": {
        "transaction": "txn_0001",
        "order": "ord_0001"
        
    },
    "receipt": {
        "email": true,
        "sms": true
    },
    "customer": {
        "id": "cus_TS07A5420232136o2K52709053"
    },
    "source": {
        "card": "AdBC71Gu4vrTBCNEYecQnfItSxJhBYHNHWjDSYvPKEN+E07311K44m1KOubIH053jiyOIu6oNPmhd9Bl7ouy6lZJ14EHq6a7hv/24+e14ELOPqg5RKkpAobqNIS/ty172T0zzXO70B9PIiIq9YsQ/vmbNFJGYVi9pVp7vH7LlPrxTm4JWsIx81qm3A8+8h5FzCwxGdnR+ikAE8GEOUO4+8gWD4WvuZbr8vBrrtSIFQCeFkPXP+dy1yBp2RBgDkXIV7E3f91tEJR7iML9vldmQ5uo627WotvF4igAVdg+DuJUI268EsFmCv3dBXGEpec6Bin6psR9miK596VAo4TDPA=="
    },
    "merchant": {
        "id": "25145693"
    },
    "post": {
        "url": "http://your_website1.com/posturl"
    },
    "redirect": {
        "url": "http://your_website.com/redirecturl"
    }
}'
```