AI resources
Tokenize Apple Pay payment

Receives encrypted Apple Pay payment data, decrypts it, tokenizes the card information, and returns a card token for further payment processing with the Orders API. In case of success, the request will return a response with status 200. Then use the returned card token to create the payment with the Orders API.

POST

https://api.mercadopago.com/platforms/pci/applepay/v1/tokenize
Request parameters
Header
Authorization
string

REQUIRED

Access Token obtained through the developer panel. Must be sent in all requests.
X-Product-ID
string

REQUIRED

Product identifier.
X-Public-Key
string

REQUIRED

Public Key of your Mercado Pago application, used on the frontend. Use the test Public Key in the test environment and the production one in production. You can find it in Your integrations > Application details > Creden
X-Request-ID
string
Request identifier for tracing purposes.
Body
payment_method
object

REQUIRED

Payment method information.
transaction_identifier
string

REQUIRED

Unique transaction identifier generated by Apple for each transaction.
device
object
Device information for fraud prevention.
Response parameters
id
string
Card token. Send it as payment_method.token when creating the payment with the Orders API.
bin
string
First digits of the card.
Errors

400Request error.

invalid_request

The request body is malformed or a required field is missing. Check the JSON structure and the required parameters.

invalid_parameter

One of the parameters has an invalid value or format. Check the accepted values for each field.

401Authentication error.

unauthorized

The credentials sent are invalid or absent. Check that you are sending valid credentials for the environment you are using.

424Dependency error.

failed_dependency

An external dependency required to complete the operation failed. Wait a moment and try again.

500Server error.

internal_server_error

An internal server error occurred. Wait a moment and try again. If the problem persists, contact Support with the x-request-id.

502Gateway error.

bad_gateway

An invalid response was received from an upstream service. Wait a moment and try again.

503Service unavailable.

service_unavailable

The service is temporarily unavailable. Wait a moment and try again.

Request
curl -X POST \
    'https://api.mercadopago.com/platforms/pci/applepay/v1/tokenize'\
    -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer APP_USR-1*********685765-12*********1b4332e5c*********e077d7679*********664' \
       -H 'X-Product-ID: YOUR_PRODUCT_ID' \
       -H 'X-Public-Key: TEST-1234' \
       -H 'X-Request-ID: deb61aaa-ac8f-4404-9e9f-4466f7cb9c8d' \
       -H 'X-Test-Status: APRO' \
    -d '{
  "payment_method": {
    "type": "applepay",
    "payment_data": "PAYMENT_DATA_FROM_APPLE_BASE64"
  },
  "transaction_identifier": "test-applepay-transaction-12345",
  "device": {
    "fingerprint": {
      "os": "iOS",
      "system_version": "17.0",
      "model": "iPhone15,2",
      "resolution": "2532x1170",
      "ram": 4294967296,
      "disk_space": 128849018880,
      "free_disk_space": 107374182400
    },
    "meli": {
      "session_id": "session-123456789"
    }
  }
}'
Response
{
  "id": "5c055ff0d...00b888c85c64e",
  "bin": "44...49"
}