# MD for: https://www.mercadopago.com.ar/developers/es/docs/wallet-connect/process-payments-legacy.md \# Process payments (via Advanced Payments API) > WARNING > > The :TagComponent{tag="/v1/advanced\_payments" text="Advanced Payments API" href="/developers/en/reference/online-payments/wallet-connect/advanced-payments-legacy/create-payment/post" color="green"} is a legacy API and will soon stop receiving new updates. The recommended integration flow is via the :TagComponent{tag="/v1/orders" text="Orders API" href="/developers/en/docs/wallet-connect/process-payments" color="accent"}. With the \*\*Advanced Payments API\*\*, payments are processed using the \`payer\_token\` obtained in the agreement, debiting the amount directly from the buyer's wallet. Before processing payments, you must have completed the agreement flow and obtained the \`payer\_token\`. If you have not done so yet, see the \[Configure agreements\](https://www.mercadopago.com.ar/developers/en/docs/wallet-connect/configure-agreements) section. :::AccordionComponent{title="Process payment" pill="1"} To process a payment, send a request to the endpoint :TagComponent{tag="POST" text="/v1/advanced\_payments" href="/developers/en/reference/online-payments/wallet-connect/advanced-payments-legacy/create-payment/post" color="green"}, including your :toolTipComponent\[test Access Token\]{content="Private key used in the backend to authenticate the requests. In the Wallet Connect integration, your Access Token will initially be provided by the team responsible for creating your application in Mercado Pago, but once you have access to that application you will be able to view it in \*Your integrations > Integration data > Tests > Test credentials\*. The test Access Token starts with the prefix \`APP\_USR\`."} and the buyer's payment token. \`\`\`curl curl -X POST \\ 'https://api.mercadopago.com/v1/advanced\_payments' \\ -H 'Content-Type: application/json' \\ -H 'X-Idempotency-Key: {{SOME\_UNIQUE\_VALUE}}' \\ -H 'Authorization: Bearer {{YOUR\_ACCESS\_TOKEN}}' \\ -d '{ "wallet\_payment": { "transaction\_amount": 550, "description": "Smartphone", "external\_reference": "Payment\_seller\_123" }, "payer": { "token": "PAYER\_TOKEN", "type\_token": "wallet-tokens" }, "capture": true }' \`\`\` See the table below for descriptions of the parameters that are mandatory in the request and those that, although optional, have some important particularity that should be highlighted. | Parameter | Type | Description | Requirement | |---|---|---|---| | \`X-Idempotency-Key\` | \_Header\_ | Idempotency key. This key ensures that each request is processed only once, avoiding the creation of two identical payments. Use a unique value in the request \`header\`, such as a UUID V4 or a random string. | Required | | \`Authorization\` | \_Header\_ | Refers to your :toolTipComponent\[test Access Token\]{content="Private key used in the backend to authenticate the requests. In the Wallet Connect integration, your Access Token will initially be provided by the team responsible for creating your application in Mercado Pago, but once you have access to that application you will be able to view it in \*Your integrations > Integration data > Tests > Test credentials\*. The test Access Token starts with the prefix \`APP\_USR\`."}. | Required | | \`X-Meli-Session-Id\` | \_Header\_ | Identifier of the buyer's device at the time of purchase, used to improve security and increase the payment approval rate. | Optional | | \`wallet\_payment.transaction\_amount\` | \_Body. Number\_ | Payment amount. | Required | | \`wallet\_payment.description\` | \_Body. String\_ | Brief description of the payment. | Optional | | \`wallet\_payment.external\_reference\` | \_Body. String\_ | Custom seller reference, used to correlate a Mercado Pago payment with an internal order. | Optional | | \`wallet\_payment.statement\_descriptor\` | \_Body. String\_ | Text that appears on the buyer's statement along with the amount and date of the charge. Accepts a maximum of 50 alphanumeric characters. | Optional | | \`payer.token\` | \_Body. String\_ | Payment token (\`payer\_token\`) obtained in the agreement flow, used to charge the buyer's wallet. | Required | | \`payer.type\_token\` | \_Body. String\_ | Type of the token. For Wallet Connect payments, the value must be \`wallet-tokens\`. | Required | | \`capture\` | \_Body. Boolean\_ | Indicates whether the payment should be captured immediately. In two-step payments, send \`false\` to reserve the amount and capture it later by sending \`true\` in a separate request. | Optional | | \`binary\_mode\` | \_Body. Boolean\_ | When enabled, the payment can only be approved or rejected. Otherwise, the payment may remain pending. | Optional | If the request is successful, the response will return status 201 with the created payment. \`\`\`json { "id": 10267812, "payments": \[ { "id": 3870106238, "status": "approved", "status\_detail": "accredited", "payment\_type\_id": "account\_money", "transaction\_amount": 550.0 } \], "wallet\_payment": { "transaction\_amount": 550.0, "description": "Smartphone", "external\_reference": "Payment\_seller\_123" } } \`\`\` Among the returned parameters, we have those indicated in the table below. | Parameter | Type | Description | |---|---|---| | \`id\` | \_Number\_ | Unique identifier of the created payment. Use it to query, capture or refund the payment. | | \`payments.status\` | \_String\_ | Returns the payment status. The possible values are \`approved\`, \`in\_process\` and \`rejected\`. | | \`payments.status\_detail\` | \_String\_ | Details the reason for the payment status. For approved payments, it returns \`accredited\`. | | \`payments.transaction\_amount\` | \_Number\_ | Amount charged to the buyer. | > WARNING > > The status returned in the \`payments\` array may be \`rejected\` depending on the state of the buyer's account, even when the request returns 201\. Always check the \`status\` of each payment before confirming the purchase to the buyer. ::: :::AccordionComponent{title="Get payment data" pill="2"} The query allows you to obtain the updated data of a payment made through the Advanced Payments API, including its status. To perform the query, send a request to the endpoint :TagComponent{tag="GET" text="/v1/advanced\_payments/{advanced\_payment\_id}" href="/developers/en/reference/online-payments/wallet-connect/advanced-payments-legacy/get-payment/get" color="accent"}, including your :toolTipComponent\[test Access Token\]{content="Private key used in the backend to authenticate the requests. In the Wallet Connect integration, your Access Token will initially be provided by the team responsible for creating your application in Mercado Pago, but once you have access to that application you will be able to view it in \*Your integrations > Integration data > Tests > Test credentials\*. The test Access Token starts with the prefix \`APP\_USR\`."} and the \`advanced\_payment\_id\` obtained in the response to its creation. \`\`\`curl curl -X GET \\ 'https://api.mercadopago.com/v1/advanced\_payments/{{ADVANCED\_PAYMENT\_ID}}' \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer {{YOUR\_ACCESS\_TOKEN}}' \`\`\` | Parameter | Type | Description | Requirement | |---|---|---|---| | \`advanced\_payment\_id\` | \_Path. Number\_ | Unique identifier of the payment you want to query, obtained in the response to its creation. | Required | | \`Authorization\` | \_Header\_ | Refers to your :toolTipComponent\[test Access Token\]{content="Private key used in the backend to authenticate the requests. In the Wallet Connect integration, your Access Token will initially be provided by the team responsible for creating your application in Mercado Pago, but once you have access to that application you will be able to view it in \*Your integrations > Integration data > Tests > Test credentials\*. The test Access Token starts with the prefix \`APP\_USR\`."}. | Required | If the request is successful, the response will return status 200 with the updated payment data. \`\`\`json { "id": 10267812, "wallet\_payment": { "transaction\_amount": 550.0, "description": "Smartphone", "external\_reference": "Payment\_seller\_123" }, "payments": \[ { "id": 3870106238, "status": "approved", "status\_detail": "accredited", "payment\_type\_id": "account\_money", "transaction\_amount": 550.0 } \] } \`\`\` ::: > SUCCESS\_MESSAGE > > To learn in detail about all the parameters sent and returned in these requests, please refer to our :TagComponent{tag="API" text="API Reference" href="/developers/en/reference/online-payments/wallet-connect/overview" color="accent"}. Additionally, if you receive an error when processing the payment, consult the \[Possible errors\](https://www.mercadopago.com.ar/developers/en/docs/wallet-connect/integration-errors) section for more information.