# MD for: https://www.mercadopago.com.br/developers/pt/docs/automatic-payments-orders/register-first-payment.md \# Registration with a first payment with CVV If your integration requires the customer to make a first purchase, you must: 1\. Create the customer to register them in your system. 2\. Create the payment using the customer identifier and the card \_token\_, created during the payment method tokenization stage. 3\. Associate that card with the customer. 4\. Create a payment profile based on the customer's information, which will centralize the associated payment methods and allow them to be reused in future charges. To register a payment method with a first payment with CVV, follow the steps below. :::AccordionComponent{title="Create customer" pill="1"} Start by creating the customer in your system by sending a \*\*POST\*\* to the endpoint :TagComponent{tag="API" text="/v1/customers" href="/developers/en/reference/online-payments/automatic-payments/customers/create-customer/post"}, making sure to include the data collected in your frontend in the request, especially their email, which is required to create the registration. \`\`\`curl curl -X POST \\ 'https://api.mercadopago.com/v1/customers' \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer {{ACCESS\_TOKEN}}' \\ -d '{ "email": "jhon@doe.com", "first\_name": "Jhon", "last\_name": "Doe", "phone": { "area\_code": "55", "number": "991234567" }, "identification": { "type": "CPF", "number": "12345678900" }, "default\_address": "Home", "address": { "id": "123123", "zip\_code": "01234567", "street\_name": "Rua Exemplo", "street\_number": 123, "city": {} }, "date\_registered": "2021-10-20T11:37:30.000-04:00", "description": "Description del user", "default\_card": "None" }' \`\`\` The response to this request will return the unique identifier for this customer under the \`id\` parameter, which you must use in the following stages when the \`customer\_id\` is required. \`\`\`json { "id": "000000001-sT93QZFAsfxU9P5", "email": "jhon@doe.com", "first\_name": "Bruce", "last\_name": "Wayne", "phone": { "area\_code": 23, "number": 12345678 }, "identification": { "type": "DNI", "number": 12345678 }, "address": { "id": "1162600094", "zip\_code": "SG1 2AX", "street\_name": "Old Knebworth Ln" }, "description": "This is my description", "date\_created": "2018-02-20T15:36:23.541Z", "metadata": { "source\_sync": "source\_ws" }, "default\_address": "1162600094", "cards": \[ {} \], "addresses": \[ {} \], "live\_mode": true } \`\`\` ::: :::AccordionComponent{title="Create the payment" pill="2"} Use the customer identification and the card token, obtained during the payment method tokenization stage, to create the payment using the Orders API. To do this, send a \*\*POST\*\* to the endpoint :TagComponent{tag="API" text="/v1/orders" href="/developers/en/reference/online-payments/checkout-api/create-order/post"} using your :toolTipComponent\[Access Token\]{content="Private key of the application created in Mercado Pago, used in the \_backend\_. You can access it through \*Your integrations > Application details\*."} and following the instructions for the required parameters detailed in the table below. \`\`\`curl curl -X POST \\ 'https://api.mercadopago.com/v1/orders' \\ -H 'Content-Type: application/json' \\ -H 'X-Idempotency-Key: {{SOME\_UNIQUE\_VALUE}}' \\ -H 'Authorization: Bearer {{YOUR\_ACCESS\_TOKEN}}' \\ -d '{ "type": "online", "processing\_mode": "automatic", "total\_amount": "200.00", "external\_reference": "ext\_ref\_1234", "payer": { "customer\_id": "1234567890" }, "transactions": { "payments": \[ { "amount": "200.00", "payment\_method": { "id": "master", "type": "credit\_card", "token": "1223123", "installments": 1 } } \] } }' \`\`\` | Attribute | Type | Description | Required | | :--- | :--- | :--- | :--- | | \`Authorization\` | \_Header\_ | Refers to your private key, the test Access Token. | Required | | \`X-Idempotency-Key\` | \_Header\_ | Idempotency key. This key ensures that each request is processed only once, avoiding duplicates. Use a unique value in your request header, such as a UUID V4 or random \_strings\_. | Required | | \`processing\_mode\` | \_Body. String\_ | Order processing mode. Possible values are: \`automatic\`, to create and process the order in automatic mode. \`automatic\_assync\`, to create the order with retry logic. For more information, access \[Order processing modes\](https://www.mercadopago.com.br/developers/en/docs/automatic-payments-orders/process-payments#bookmark\_orders\_processing\_modes). | Required | | \`total\_amount\` | \_Body. String\_ | Total transaction amount. | Required | | \`payer.customer\_id\` | \_Body. String\_ | Customer identifier created in the previous stage. | Required | | \`transaction.payments.payment\_method.id\` | \_Body. String\_ | Payment method identifier. In this case, it is the card brand. For more information, check the list of \[Available payment methods\](https://www.mercadopago.com.br/developers/en/docs/automatic-payments-orders/available-payment-methods). | Required | | \`transaction.payments.payment\_method.type\` | \_Body. String\_ | Payment method type. For credit card payments, it must be \`credit\_card\`, for debit card payments, it must be \`debit\_card\`, and for prepaid cards, \`prepaid\_card\`. | Required | | \`payment\_method.token\` | \_Body. String\_ | Card token, obtained during the payment method tokenization stage. | Required | > SUCCESS\_MESSAGE > > For detailed information on all parameters to be sent in this request, check our :TagComponent{tag="API" text="API Reference" href="/developers/en/reference/online-payments/checkout-api/create-order/post"}. Additionally, if you receive an error when sending the payment, you can check our \[possible errors list\](https://www.mercadopago.com.br/developers/en/docs/automatic-payments-orders/possible-errors). In case of success, the response will look like the example below, and the first payment will have been processed. \`\`\`json { "id": "ORD01JS2V6CM8KJ0EC4H502TGK1WP", "type": "online", "processing\_mode": "automatic", "external\_reference": "ext\_ref\_1234", "total\_amount": "200.00", "total\_paid\_amount": "200.00", "country\_code": "BRA", "user\_id": "2021490138", "status": "processed", "status\_detail": "accredited", "capture\_mode": "automatic\_async", "created\_date": "2025-04-17T21:41:33.96Z", "last\_updated\_date": "2025-04-17T21:41:35.144Z", "integration\_data": { "application\_id": "874202490252970" }, "transactions": { "payments": \[ { "id": "PAY01JS2V6CM8KJ0EC4H504R7YE34", "amount": "200.00", "paid\_amount": "200.00", "reference\_id": "0002yjis6j", "status": "processed", "status\_detail": "accredited", "payment\_method": { "id": "elo", "type": "credit\_card", "token": "1223123", "installments": 1 } } \] } } \`\`\` ::: :::AccordionComponent{title="Associate card to customer" pill="3"} Once the first payment has been processed and the payment method validated, you must use the same card token sent in the payment to associate it with the previously created customer, in order to store the information for use in future payments. To do this, send a \*\*POST\*\* to the endpoint :TagComponent{tag="API" text="/v1/customers/{customer\_id}/cards" href="/developers/en/reference/online-payments/automatic-payments/cards/save-card/post"}, including the \`customer\_id\` in the request \_path\_ and the card \`token\` in the \_body\_, as indicated below. Make sure to also send your :toolTipComponent\[Access Token\]{content="Private key of the application created in Mercado Pago, used in the \_backend\_. You can access it through \*Your integrations > Application details\*."}. \`\`\`curl curl -X POST \\ 'https://api.mercadopago.com/v1/customers/{{CUSTOMER\_ID}}/cards' \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer {{ACCESS\_TOKEN}}' \\ -d '{ "token": "1223123" }' \`\`\` If the request was successful, the response will return an \`id\`, which is the card identifier. You must use it to complete the payment method registration stage from a first charge. \`\`\`json { "id": 1562188766852, "expiration\_month": 6, "expiration\_year": 2023, "first\_six\_digits": 423564, "last\_four\_digits": 5682, "payment\_method": { "id": "visa", "name": "visa", "payment\_type\_id": "credit\_card", "thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/visa.gif", "secure\_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/visa.gif" }, "date\_created": "2019-07-03T21:15:35.000Z", "date\_last\_updated": "2019-07-03T21:19:18.000Z", "customer\_id": "448870796-7ZjwhKGxILixxN", "user\_id": 448870796, "live\_mode": true } \`\`\` ::: :::AccordionComponent{title="Create payment profile for customer" pill="4"} To store the customer's data and their card for future payments, you need to create a payment profile. This profile will be the structure that contains the payment data to be used in your system and will facilitate its reuse for future charges. To create the customer's payment profile, send a \*\*POST\*\* to the endpoint \[/v1/customers/{customer\_id}/payment-profiles\](https://www.mercadopago.com.br/developers/en/reference/automatic-payments/payment-profiles/post). In the request \_path\_, include the \`customer\_id\` obtained when creating the customer. In the \_body\_, provide the card \`id\` generated when associating the card to the customer. Below, you can see in the table how to send each of the required parameters. \`\`\`curl curl --location 'https://api.mercadopago.com/v1/customers/{{CUSTOMER\_ID}}/payment-profiles' \\ --header 'X-Idempotency-Key: {{X\_IDEMPOTENCY\_KEY}}' \\ --header 'Authorization: Bearer {{ACCESS\_TOKEN}}' \\ --header 'Content-Type: application/json' \\ --data '{ "description": "Test", "payment\_methods": \[ { "id": "master", "type": "credit\_card", "card\_id": {{CARD\_ID}}, "default\_method": false } \] }' \`\`\` | Field | Type and description | Required | | :--- | :--- | :--- | | \`customer\_id\` | \_Path\_. Customer identifier, obtained when creating the customer in the previous stage. | 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 | | \`payment\_methods\` | \_Body, object\_. Contains the payment method information. During profile creation, it does not allow more than two payment methods. When there are two cards, only one will be identified with the \`token\`, and the other must be identified with the \`card\_id\`. 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\_. Customer's card identifier, obtained in the previous stage. | Required | | \`payment\_methods.default\_method\` | \_Body, boolean\_. Identifies whether the payment method is the default for payment attempts for that customer. | Optional | > SUCCESS\_MESSAGE > > For detailed information on all parameters to be sent in this request, check our \[API Reference\](https://www.mercadopago.com.br/developers/en/reference/automatic-payments/payment-profiles/post). Additionally, you can check the documentation on \[Orders processing modes\](https://www.mercadopago.com.br/developers/en/docs/automatic-payments-orders/process-payments#bookmark\_orders\_processing\_modes) to get specific information on how Profiles work within the Orders API. If the request is successful, the response will return \`status = READY\` and the payment profile identifier for that customer, under the \`id\` parameter. This \`profile\_id\` must be used to process payments with the Orders API. \`\`\`json { "id": "7036b192b541454fa9b9990660dfa1b5", "created\_date": "2024-05-22T14:03:28.653Z", "last\_updated\_date": "2024-05-22T14:03:28.653Z", "description": "Test payment profile", "max\_day\_overdue": 5, "statement\_descriptor": "Test Descriptor", "status": "READY", "sequence\_control": "AUTO", "payment\_methods": \[ { "payment\_method\_id": "64abf0f5-3e15-48a5-9be0-a8ac56bbd87a", "id": "visa", "type": "credit\_card", "card\_id": 1234567890, "status": "READY", "default\_method": true } \] } \`\`\` > SUCCESS\_MESSAGE > > If you want to check the main statuses that a payment profile can have, as well as the statuses of its associated payment methods, access the \[documentation\](https://www.mercadopago.com.br/developers/en/docs/automatic-payments-orders/profile-payment-methods-status). If needed, you can later update the customer's payment profile, add new payment methods, or even delete it. Check \[Profile management\](https://www.mercadopago.com.br/developers/en/docs/automatic-payments-orders/manage-profiles) for more information. :::