# Generate certificate CSR Generates a new Certificate Signing Request (CSR) for Apple Pay integration. Use it to generate both the Merchant Identity Certificate (type 'merchant') and the Payment Processing Certificate (type 'payment'). In case of success, the request will return a response with status 200. After signing the CSR in the Apple Developer Portal, send the certificate to [/certificates/certificate/upload](/developers/en/reference/apple-pay/upload-certificate/post). **POST** `/certificates/csr/generate` ## Request parameters - `type` (string, optional) Certificate type to generate. Save the `certificate_id` returned in the response: you will need it to [create the Apple Pay session](/developers/en/reference/apple-pay/create-session/post) and to [upload the signed certificate](/developers/en/reference/apple-pay/upload-certificate/post). Possible enum values: - `merchant` Generates the CSR for the Merchant Identity Certificate, which validates the Apple Pay session with Apple. - `payment` Generates the CSR for the Payment Processing Certificate, which allows decrypting the Apple Pay payment token. - `flow` (string, optional) Fixed value 'apple_pay'. - `merchantIdentifier` (string, optional) Merchant ID configured in the Apple Developer Portal. - `organization` (string, optional) Legal or trade name of your business, used as the organization name in the certificate signing request. - `country` (string, optional) Two-letter country code of your business, in ISO 3166-1 alpha-2 format. - `locality` (string, optional) City where your business is located, used as the locality in the certificate signing request. - `province` (string, optional) State or province where your business is located, used as the province in the certificate signing request. ## Response parameters - `certificate_id` (string, optional) Unique identifier for the certificate. Save it to use in subsequent steps. - `certificate` (string, optional) Certificate content in PEM format. Save it as a .pem file to upload to the Apple Developer Portal, then send the signed certificate to [/certificates/certificate/upload](/developers/en/reference/apple-pay/upload-certificate/post). ## 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/certificates/csr/generate' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ -d '{ "type": "merchant", "flow": "apple_pay", "merchantIdentifier": "merchant.com.example", "organization": "Example Corp", "country": "AR", "locality": "Buenos Aires", "province": "CABA" }' ``` ## Response example ```json { "certificate_id": "cert_123456789", "certificate": "-----BEGIN CERTIFICATE-----" } ```