# 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](/developers/en/reference/online-payments/checkout-api/create-order/post). **POST** `/platforms/pci/applepay/v1/tokenize` ## Request parameters ### Header - `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 > Credentials. - `X-Request-ID` (string, optional) Request identifier for tracing purposes. - `X-Test-Status` (string, optional) Header used only in the test environment to simulate a payment result. Required for test requests, not applicable in production. - `payment_method` (object, optional) Payment method information. - `payment_method.type` (string, optional) Fixed value 'applepay'. - `payment_method.payment_data` (string, optional) Encrypted payment data that Apple returns when the buyer authorizes the payment on their device. You do not generate this value: take the payment token Apple delivers to your application and send it here encoded in Base64, without modifying its content. See [Integration via Mercado Pago](/developers/en/docs/apple-pay/attached-model-integration/web-integration) for the full flow. - `transaction_identifier` (string, optional) Unique transaction identifier generated by Apple for each transaction. - `device` (object, optional) Device information for fraud prevention. - `device.fingerprint` (object, optional) Device fingerprint information. - `device.fingerprint.os` (string, optional) Operating system. - `device.fingerprint.system_version` (string, optional) OS version. - `device.fingerprint.model` (string, optional) Device model. - `device.fingerprint.resolution` (string, optional) Screen resolution. - `device.fingerprint.ram` (integer, optional) RAM in bytes. - `device.fingerprint.disk_space` (integer, optional) Total disk space in bytes. - `device.fingerprint.free_disk_space` (integer, optional) Free disk space in bytes. - `device.meli` (object, optional) - `device.meli.session_id` (string, optional) Device session identifier. Must be initialized on the page before clicking the Apple Pay button. Available in the global variable 'window.MP_DEVICE_SESSION_ID', provided by Mercado Pago's device fingerprint SDK (Armor). ## Response parameters - `id` (string, optional) Card token. Send it as `payment_method.token` when creating the payment with the [Orders API](/developers/en/reference/online-payments/checkout-api/create-order/post). - `bin` (string, optional) First digits of the card. ## Errors | Status | Error | Description | | ------- | ------- | ----------- | | 400 | invalid_request | The request body is malformed or a required field is missing. Check the JSON structure and the required parameters. | | 400 | invalid_parameter | One of the parameters has an invalid value or format. Check the accepted values for each field. | | 401 | unauthorized | The credentials sent are invalid or absent. Check that you are sending valid credentials for the environment you are using. | | 424 | failed_dependency | An external dependency required to complete the operation failed. Wait a moment and try again. | | 500 | 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. | | 502 | bad_gateway | An invalid response was received from an upstream service. Wait a moment and try again. | | 503 | service_unavailable | The service is temporarily unavailable. Wait a moment and try again. | ## Request example ### cURL ```bash curl -X POST \ 'https://api.mercadopago.com/platforms/pci/applepay/v1/tokenize' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ -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 example ```json { "id": "5c055ff0d...00b888c85c64e", "bin": "44...49" } ```