AI resources
Create payment

This endpoint creates an advanced payment for Wallet Connect. During the agreement process, the integrator receives a payer token from the buyer. This token allows the integrator to execute the payment directly from the buyer's wallet. To apply discounts, create a discount promise before using this endpoint. In case of success, the request will return a response with status 201.

POST

https://api.mercadopago.com/v1/advanced_payments
Request parameters
Header
Authorization
string

REQUIRED

Access Token obtained through the developer panel. Must be sent in all requests.
X-Idempotency-Key
string

REQUIRED

This feature allows you to safely retry requests without the risk of accidentally performing the same action more than once. This is useful for avoiding errors, such as creating two identical payments, for example. To en
X-Meli-Session-Id
string
Device identifier used to improve security and increase the payment approval rate. It represents a unique identifier for the buyer's device at the time of purchase.
Body
wallet_payment
object

REQUIRED

Payment data from a seller with a prior Wallet Connect agreement.
payer
object

REQUIRED

Buyer information required to process the payment.
binary_mode
boolean
When enabled, the payment can only be approved or rejected. Otherwise, the payment may remain pending.
capture
boolean
Indicates whether to capture the payment immediately. In two-step payments, set to "false" to reserve the amount first, then capture it by sending "true" in a separate request.
Response parameters
id
number
Unique identifier of the advanced payment.
payments
array
List of payments generated within the advanced payment.
wallet_payment
object
Wallet payment data from a seller with a prior Wallet Connect agreement.
disbursements
array
List of disbursements distributed among the sellers.
Errors

400Request error.

empty_required_header

The "X-Idempotency-Key" header is required and was not sent. Make the request again including it.

500Processing error.

internal_error

Some error occurred on our side while attempting to process the request. Please try again later.

Request
curl -X POST \
    'https://api.mercadopago.com/v1/advanced_payments'\
    -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer APP_USR-1*********550113-12*********b4773884a*********e8df16347*********786' \
       -H 'X-Idempotency-Key: 9ed64462-3876-4e19-8c41-fab341e438b4' \
       -H 'X-Meli-Session-Id: DEVICE_ID' \
    -d '{
  "wallet_payment": {
    "transaction_amount": 24.5,
    "description": "Payment for the purchase of furniture",
    "external_reference": "Payment_seller_123",
    "statement_descriptor": "descriptor",
    "forward_data": {
      "sub_merchant": {
        "sub_merchant_id": 123123,
        "mcc": "5462",
        "country": "PE",
        "address_door_number": 276,
        "zip": "15073",
        "document_number": "222222222222222",
        "city": "Lima",
        "address_street": "RUA A",
        "legal_name": "LOJINHA DO ZÉ",
        "region_code_iso": "BR-MG",
        "region_code": "BR",
        "document_type": "RUC",
        "url": "www.nomedofacilitador.com.br"
      }
    },
    "discount": {
      "amount": 10,
      "description": "DESC20",
      "detail": {
        "cap": 1000000,
        "type": "percentage",
        "value": 10
      }
    }
  },
  "payer": {
    "token": "abcdef1e23f4567d8e9123eb6591ff68df74c57930551ed980239f4538a7e530",
    "type_token": "wallet-tokens"
  },
  "binary_mode": false,
  "capture": false
}'
Response
{
  "id": 10267812,
  "payments": [
    {
      "id": 3870106238,
      "status_detail": "accredited",
      "payment_method_id": "credit_card",
      "transaction_amount": "24.50",
      "installments": 1,
      "description": "Payment for the purchase of furniture",
      "capture": true,
      "external_reference": "payment_123"
    }
  ],
  "wallet_payment": {
    "transaction_amount": "24.50",
    "description": "Payment for the purchase of furniture",
    "external_reference": "Payment_seller_123",
    "discount": {
      "amount": 10,
      "code": "WALLET10"
    }
  },
  "disbursements": [
    {
      "collector_id": "collectorId"
    }
  ],
  "payer": {
    "id": 8879
  },
  "site_id": "MPE",
  "binary_mode": true,
  "date_created": "2018-10-20T09:34:20.518-04:00",
  "date_last_updated": "2018-10-20T09:34:20.518-04:00"
}