Crear orden - Órdenes comerciales - Mercado Pago Developers
Crear orden

POST

/merchant_orders
Genera una orden para asociarla a la preferencia de pago y obtén la URL necesaria para iniciar el flujo de pago.
Parámetros para la solicitud
additional_info
string
Localización: bodyInformación adicional
application_id
string
Localización: bodyIdentificador de aplicación
external_reference
string
Localización: bodyIdentificador único que envía el vendedor para relacionar la order_id generada por Mercado Pago, con el id de su sistema de pagos
items
array
Localización: bodyInformación de los ítems
Parámetros de respuesta
id
number
Localización: bodyIdentificador único de la orden generada por Mercado Pago
status
string
Localización: bodyMuestra el estado actual de la orden
opened: Order without payments.
closed: Order with payments covering total amount.
expired: Canceled order that does not have approved or pending payments (all rejected or returned).
external_reference
string
Localización: bodyIdentificador único que envía el vendedor para relacionar la order_id generada por Mercado Pago, con el id de su sistema de pagos
preference_id
string
Localización: bodyIdentificador de la preferencia de pago asociado a la orden
Solicitud
curl
curl -X POST \
    'https://api.mercadopago.com/merchant_orders' \
    -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{
  "external_reference": "default",
  "preference_id": "Preference identification",
  "payer": {
    "id": 123,
    "nickname": "JOHN"
  },
  "site_id": "MLA",
  "items": [
    {
      "id": "item id",
      "category_id": "item category",
      "currency_id": "BRL",
      "description": "item description",
      "picture_url": "item picture",
      "quantity": 1,
      "unit_price": 5,
      "title": "item title"
    }
  ],
  "application_id": 10000000000000000
}'
Respuesta
json
{
  "id": 9999999999,
  "status": "closed",
  "external_reference": "default",
  "preference_id": "Preference identification",
  "collector": {
    "id": 999999999
  },
  "marketplace": "NONE",
  "date_created": "2018-09-14T17:11:31.000Z",
  "last_updated": "2018-09-14T17:11:43.000Z",
  "shipping_cost": 0,
  "total_amount": 5,
  "site_id": "MLA",
  "paid_amount": 5,
  "refunded_amount": 0,
  "payer": {
    "id": 999999999
  },
  "items": [
    {
      "id": "item id",
      "category_id": "item category",
      "currency_id": "BRL",
      "description": "item description",
      "picture_url": "item picture url",
      "title": "item title",
      "quantity": 1,
      "unit_price": 5
    }
  ],
  "additional_info": "additional information",
  "application_id": 10000000000000000,
  "order_status": "paid"
}
Errores
400bad_request
invalid_user_idinvalid users involved.
invalid_order_statethe action requested is not valid for the current merchant order state.
invalid_stringstring too long.
invalid_application_idinternal server error.
invalid_itemsinvalid unit_price.
user_not_alloweduser not allowed to operate.
invalid_operation_typeinvalid operation type.
invalid_payerinvalid payer identifier.
invalid_idinvalid preference_id.
invalid_expiredthe preference_id has expired.
invalid_sponsor_idinvalid sponsor_id.
invalid_marketplaceinvalid marketplace.
unmarshal_errorcould not unmarshal request body into merchant order struct.
invalid_urlinvalid URL. Isn't HTTP or HTTPS.
communication_errorError when calling...
401bad_request
invalid_tokenaccess denied.
invalid_caller_idinvalid caller_id