# Create Apple Pay session Creates a new Apple Pay payment session for processing payments through Apple Pay gateway. In case of success, the request will return a response with status 201. **POST** `/applepay/v1/session` ## 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. - `id` (string, optional) Certificate ID of the *merchant* type certificate. This value is returned in the response to the [/certificates/csr/generate](/developers/en/reference/apple-pay/generate-csr/post) request. - `merchantIdentifier` (string, optional) Merchant ID configured in the Apple Developer Portal. - `domainName` (string, optional) Domain name where the payment session will be used. Must match the domain verified in the Apple Developer Portal. - `displayName` (string, optional) Name of your store or business shown to the buyer in the Apple Pay payment flow. - `initiative` (string, optional) Type of Apple Pay integration. Fixed value 'web'. - `initiativeContext` (string, optional) Additional context for the payment initiative. Must match domainName. - `validationURL` (string, optional) URL Apple sends to your frontend when the flow starts. Send it here unmodified. ## Response parameters - `epochTimestamp` (integer, optional) Date and time the session was created, as a Unix timestamp in milliseconds (milliseconds elapsed since January 1, 1970 UTC). - `expiresAt` (integer, optional) Date and time the session expires, as a Unix timestamp in milliseconds (milliseconds elapsed since January 1, 1970 UTC). - `merchantSessionIdentifier` (string, optional) Apple Pay session identifier. Send it to your frontend to complete the payment flow with Apple. - `nonce` (string, optional) Random value used for security purposes. - `merchantIdentifier` (string, optional) Merchant identifier returned by Apple. - `domainName` (string, optional) Validated domain name for the session. - `displayName` (string, optional) Merchant display name for the session. - `signature` (string, optional) Cryptographic signature from Apple for session validation. - `operationalAnalyticsIdentifier` (string, optional) Identifier used for Apple's operational analytics. - `pspId` (string, optional) Payment service provider identifier. - `retries` (integer, optional) Number of retry attempts for the session. ## 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. | | 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. | ## Request example ### cURL ```bash curl -X POST \ 'https://api.mercadopago.com/applepay/v1/session' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ -d '{ "id": "CERTIFICATE_ID_MERCHANT", "merchantIdentifier": "merchant.your-identifier", "domainName": "your-domain.com", "displayName": "My store", "initiative": "web", "initiativeContext": "your-domain.com", "validationURL": "https://apple-pay-gateway.apple.com/paymentservices/startSession" }' ``` ## Response example ```json { "epochTimestamp": 1768253984908, "expiresAt": 1768257584908, "merchantSessionIdentifier": "SSH1920C0C97402...7B1B1A97F33C9C3", "nonce": "124074e7", "merchantIdentifier": "10DDB60D113BB4...CDF76292133", "domainName": "your-domain.com", "displayName": "My store", "signature": "308006092...2f5d0c8000000000000", "operationalAnalyticsIdentifier": "My store:10DDB60D113BB4...CDF76292133", "pspId": "psp-id-value", "retries": 0 } ```