# MD for: https://www.mercadopago.com.ar/developers/es/docs/automatic-payments-orders/migrate-payments-to-orders.md \# How to migrate from the Payments API to the Orders API The migration of Automatic Payments integrations from the Payments API to the Orders API involves \*\*transferring the management of Customers and Cards to the Profiles structure\*\*, initially, and then \*\*using the Orders API for payment processing\*\*. See below how to perform this migration correctly. ## Create profiles for already stored customers Previously, in the Payments flow, customer data and their tokenized cards were stored and managed only through the :TagComponent{tag="API" text="Customers" href="/developers/en/reference/online-payments/automatic-payments/customers/create-customer/post"} and :TagComponent{tag="API" text="Cards" href="/developers/en/reference/online-payments/automatic-payments/cards/save-card/post"} APIs. The new Orders API for Automatic Payments, on the other hand, requires the creation of a payment \`profile\` for each customer when sending recurring payments, retrieving the information stored by Customers and Cards. These profiles simplify the reuse of payment data: they contain the payment methods associated with a customer and function as a template for future automatic charges. Additionally, the Profiles structure performs automatic validation of a customer's payment methods, avoiding the need to process validation payments and, in case of rejected payments, makes new processing attempts with the remaining payment methods that compose it, improving the approval rate. It is possible to create profiles for previously stored customers using the \`customer\_id\` and the \`card\_id\` of their saved cards by following the steps below. :::AccordionComponent{title="Get Customer and Card information" pill="1"} Start by obtaining the \`customer\_id\` of a customer by sending a \*\*GET\*\* with their registered email to the endpoint :TagComponent{tag="API" text="/v1/customers/search" href="/developers/en/reference/online-payments/automatic-payments/customers/search-customer/get"}. \`\`\`curl curl -X GET \\ -H 'Authorization: Bearer {{ACCESS\_TOKEN}}' \\ 'https://api.mercadopago.com/v1/customers/search' \\ -d '{ "email": "test@testuser.com" }' \`\`\` If the request is successful, in the response you will find the \`customer\_id\` identified as \`id\`, as shown in the example below. \`\`\`json { "paging": { "limit": 10, "offset": 0, "total": 1 }, "results": \[ { "address": { "id": null, "street\_name": null, "street\_number": null, "zip\_code": null }, "addresses": \[\], "cards": \[ { ... } \], "date\_created": "2017-05-05T00:00:00.000-04:00", "date\_last\_updated": "2017-05-05T09:23:25.021-04:00", "date\_registered": null, "default\_address": null, "default\_card": "1493990563105", "description": null, "email": "test\_payer@testuser.com", "first\_name": null, "id": "123456789-jxOV430go9fx2e", "identification": { "number": null, "type": null }, "last\_name": null, "live\_mode": false, "metadata": {}, "phone": { "area\_code": null, "number": null } } \] } \`\`\` Then, query the list of stored cards for this customer by sending a \*\*GET\*\* with the \`customer\_id\` obtained in the previous request to the endpoint :TagComponent{tag="API" text="/v1/customers/{customer\_id}/cards" href="/developers/en/reference/online-payments/automatic-payments/cards/get-customer-cards/get"}. \`\`\`curl curl -X GET \\ -H 'Authorization: Bearer {{ACCESS\_TOKEN}}' \\ 'https://api.mercadopago.com/v1/customers/{{CUSTOMER\_ID}}/cards' \`\`\` If the request is successful, the response will return all stored cards for that customer. Each one will have its \`card\_id\` identified as \`id\`, as shown in the example below. \`\`\`json \[ { "id": "1490022319978", "expiration\_month": 12, "expiration\_year": 2020, "first\_six\_digits": "415231", "last\_four\_digits": "0001" } \] \`\`\` > NOTE > > If the response to this query does not return any payment method, it is because a card was never added to that customer. You must store both identifications, the customer's and the card's, to be able to incorporate them into the Profiles API. ::: :::AccordionComponent{title="Create the Payment Profile" pill="2"} To create a payment profile for a customer by migrating the Customers and Cards data, send a \*\*POST\*\* to the endpoint \`/v1/customers/{customer\_id}/payment-profiles\` including the \`customer\_id\` in the request \_path\_, the \`card\_id\` in the \_body\_, and following the specifications in the table below. \`\`\`curl curl -X POST \\ 'https://api.mercadopago.com/v1/customers/123456789-jxOV430go9fx2e/payment-profiles'\\ -H 'Content-Type: application/json' \\ -H 'X-Idempotency-Key: 0d5020ed-1af6-469c-ae06-c3bec19954bb' \\ -H 'Authorization: Bearer YOUR\_ACCESS\_TOKEN \\ -d '{ "description": "Test payment profile", "max\_day\_overdue": 5, "statement\_descriptor": "Test Descriptor", "sequence\_control": "MANUAL", "payment\_methods": \[ { "id": "visa", "type": "credit\_card", "token": "12345", "default\_method": false } \] }' \`\`\` | Field | Type and description | Required | | :--- | :--- | :--- | | \`customer\_id\` | \_Path\_. Identifier of the customer being migrated, obtained in the query to the Customers API in the previous step. | Required | | \`description\` | \_Body, string\_. Description of the payment profile. We recommend using this field to categorize contracted service types, plans, or business model frequency. | Optional | | \`max\_day\_overdue\` | \_Body, integer\_. Sets the number of days to retry the payment processing in case of failure or initial rejection. For example, if you send "5" as value, new processing attempts will be made for the next 5 days after the first failure. In case the payment is processed before the set days, the retry logic will be stopped. Value between 1 and 10\. | Optional | | \`statement\_descriptor\` | \_Body, string\_. Description that will appear on the customer's payment method statement. Useful for identifying the transaction. Example: \`MERCADOPAGO\`. | Optional | | \`sequence\_control\` | \_Body, string\_. Payment sequence control mode. Values can be: \`AUTO\` (automatic, retries payment with other methods) or \`MANUAL\` (requires manual intervention). | Optional | | \`payment\_methods\` | \_Body, object\_. Contains the payment method information to migrate. Does not allow more than two payment methods. If there is more than one method, it accepts a maximum of two cards (credit or debit). | Required | | \`payment\_methods.id\` | \_Body, string\_. Payment method identifier or card brand. Example: \`visa\`, \`master\`. | Required | | \`payment\_methods.type\` | \_Body, string\_. Payment method type. Values can be \`credit\_card\`, \`debit\_card\`, or \`prepaid\_card\`. | Required | | \`payment\_methods.card\_id\` | \_Body, string\_. Card identifier of the customer being migrated, obtained in the query to the Cards API in the previous step. | Required | > SUCCESS\_MESSAGE > > Check the detail of all parameters to be sent in this request in the \[API Reference\](https://www.mercadopago.com.ar/developers/en/reference/automatic-payments/payment-profiles/post) If the request is successful, the response will look like the example below. \`\`\`json { "id": "PROFILE\_ID", "created\_date": "2025-09-05T18:35:39.000Z", "last\_updated\_date": "2025-09-05T18:35:39.000Z", "description": "Test", "status": "READY", "sequence\_control": "AUTO", "payment\_methods": \[ { "payment\_method\_id": "a6e5fe16-3ed9-4826-b5a1-875e7b9973af", "id": "master", "type": "credit\_card", "status": "READY", "card\_id": 9264694962, "default\_method": false } \] } \`\`\` The \`status\` field will indicate the state of the profile creation: | Status | Description | | :--- | :--- | | \`PENDING\` | This is the initial status when creating the profile with cards as payment method, or if it is created without any payment method. It will remain in this status until the test payment is made, when it will change to \`READY\` or \`CANCELLED\` status. | | \`READY\` | This status indicates that the profile has a valid card identification and was created successfully. This status may change in the future: it can change to \`CANCELLED\` or return to \`PENDING\` status if all payment methods are modified or removed. | | \`CANCELLED\` | Status indicating that the profile was canceled due to not having an approved payment method, being unable to query the associated payment method, or, in the case of Fintoc, because the cancellation was requested by the customer. This status cannot be modified. | If you wish, after this creation, you can add more payment methods to a profile, or create multiple profiles for the same user, identified with the same email. Check all possible operations by accessing \[Profile management\](https://www.mercadopago.com.ar/developers/en/docs/automatic-payments-orders/manage-profiles). > WARNING > > If you delete a \`card\_id\` or a \`customer\_id\` from the Customers and Cards API after associating it with a profile, operations with that profile may fail. It is important to maintain data integrity between both APIs during the transition period. ::: Upon completing these steps for all your pre-existing customers, they will be properly configured in the Profiles API and you can start making automatic charges efficiently through the Orders API. Go to the documentation to learn how to \[process payments\](https://www.mercadopago.com.ar/developers/en/docs/automatic-payments-orders/process-payments).