Create order - Merchant Orders - Mercado Pago Developers
What are you looking for?

Do not know how to start integrating? 

Check the first steps
Create order

POST

https://api.mercadopago.com/merchant_orders
Generate an order to associate it with the payment preference and obtain the necessary URL to start the payment flow.
Request's parameters
BODY
additional_info
string
Additional information.
application_id
string
application identifier.
external_reference
string
Unique identifier sent by the seller to relate the order_id generated by Mercado Pago, with the id of their payment system
items
array
items information.
Response parameters
id
number
Unique identifier of the order generated by Mercado Pago
status
string
Show the current merchant order state.
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
Unique identifier sent by the seller to relate the order_id generated by Mercado Pago, with the id of their payment system
preference_id
string
Identifier of the payment preference associated to the order
Errors

400Error

invalid_user_id

invalid users involved.

invalid_order_state

the action requested is not valid for the current merchant order state.

invalid_string

string too long.

invalid_application_id

internal server error.

invalid_items

invalid unit_price.

user_not_allowed

user not allowed to operate.

invalid_operation_type

invalid operation type.

invalid_payer

invalid payer identifier.

invalid_id

invalid preference_id.

invalid_expired

the preference_id has expired.

invalid_sponsor_id

invalid sponsor_id.

invalid_marketplace

invalid marketplace.

unmarshal_error

could not unmarshal request body into merchant order struct.

invalid_url

invalid URL. Isn't HTTP or HTTPS.

communication_error

Error when calling...

401Error

invalid_token

access denied.

invalid_caller_id

invalid caller_id

Request
curl -X POST \
    'https://api.mercadopago.com/merchant_orders'\
    -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer TEST-7719*********832-03141*********ec9309854*********f1e54b5-1*********' \
    -d '{
  "application_id": "10000000000000000",
  "external_reference": "default",
  "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"
    }
  ],
  "payer": {
    "id": 123,
    "nickname": "JOHN"
  },
  "preference_id": "Preference identification",
  "site_id": "MLA",
  "sponsor_id": null
}'
Sample answer
{
  "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"
}