Home
Documentation
Resources
Partners
Community

Resources

Check for updates on our solutions and system performance, or request technical support.

Partners

Discover our program for agencies or developers that offer integration services and sellers who want to hire them.

Community

Get the latest news, ask others for help and share your knowledge.

Create order - Online payments - Mercado Pago Developers

Intelligent search powered by OpenAI 

Create order

POST

https://api.mercadopago.com/v1/orders
This endpoint allows to create orders in "automatic" (processing the transaction in a single stage) or "manual" (processing the transaction in stages that can be configured and executed incrementally) mode for payment and cashout transactions. In case of success, the request will return a response with status 201.
Request's parameters
HEADER
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. To ensure that eac...View more
BODY
type
string

REQUIRED

Order type, associated with the Mercado Pago solution for which it is created. For online card payments, the only possible value is "online".
online: Value associated with the creation of orders for online payments.
external_reference
string

REQUIRED

It is an external reference of the order. It can be, for example, a hashcode from the Central Bank, functioning as an identifier of the transaction origin. This field must have a maximum of 64 characters and can only be ...View more
transactions
object

REQUIRED

Contains information about the transactions associated with the order. It can contain up to 2 transactions. For example, if you want to create an order with two cards, you can add another item to the array "payments" nod...View more
payer
object
Payer information
Response parameters
id
string
Identifier of the order created in the request, automatically generated by Mercado Pago.
processing_mode
string
Order processing mode
manual: Order's processing will be made manually. It is the processing mode used for the "manual" option, as it sets the processing to be made afterwards, by using the "Process order by ID" endpoint.
automatic: Order's processing will be made instantly. It is the capture mode used for the "automatic" option.
external_reference
string

REQUIRED

It is an external reference of the order. It can be, for example, a hashcode from the Central Bank, functioning as an identifier of the transaction origin. This field must have a maximum of 64 characters and can only be ...View more
total_amount
string
Total amount to be paid. It must be sent with two decimals.
Errors

400Error.

empty_required_header

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

required_properties

There are some required properties missing. Check the message returned in the error details to find out what the problem was and try again.

unsupported_properties

An unsupported property was sent. Check the message returned in the error details to find out what the problem was and try again.

minimum_properties

The minimum number of properties required to execute the request was not sent. Check the message returned in the error details to find out what the problem was and try again.

property_type

The wrong property type was submitted. For example, an 'integer' value for a 'string' property. Check the message returned in the error details to find out what the problem was and try again.

minimum_items

The minimum number of items for some property was not sent. Check the message returned in the error details to find out what the problem was and try again.

maximum_items

A greater number of items were sent than allowed for some property. Check the message returned in the error details to find out what the problem was and try again.

property_value

An incorrect value for some property was sent. Check the message returned in the error details to find out what the problem was and try again.

json_syntax_error

An incorrect JSON was sent. Check the message returned in the error details to find out what the problem was and try again.

invalid_properties

Incorrect information was sent. Check the message returned in the error details to find out what the problem was and try again.

invalid_total_amount

The value entered in "total_amount" is not equivalent to the sum of the "transactions.payments.amount" field of the total transactions. Please verify if the values ​​are correct.

invalid_email_for_sandbox

Email format is invalid for sandbox environment, must contains "@testuser.com".

401Error. Access Token not authorized.

401

The value sent as Access Token is incorrect. Please check and try again with the correct value.

409Some specific system rule does not allow the action to be performed due to defined restrictions.

idempotency_key_already_used

The value sent as the idempotency header has already been used. Please try the request again sending a new value.

500Error.

idempotency_validation_failed

Validation fail. Please try submitting the request again.

500

Generic error. Please try submitting the request again.

Request
curl -X POST \
    'https://api.mercadopago.com/v1/orders'\
    -H 'Content-Type: application/json' \
       -H 'X-Idempotency-Key: 0d5020ed-1af6-469c-ae06-c3bec19954bb' \
       -H 'Authorization: Bearer TEST-7434*********159-03141*********cee51edf8*********f94f589-1*********' \
    -d '{
  "type": "online",
  "external_reference": "ext_ref_1234",
  "transactions": {
    "payments": [
      {
        "amount": "24.90",
        "payment_method": {
          "id": "visa",
          "type": "credit_card",
          "token": "12345",
          "installments": 1,
          "statement_descriptor": "approved"
        }
      }
    ]
  },
  "payer": {
    "email": "test@test.com",
    "first_name": "John",
    "last_name": "Doe",
    "identification": {
      "type": "CPF",
      "number": "99999999999"
    },
    "phone": {
      "area_code": "11",
      "number": "987654321"
    },
    "address": {
      "zip_code": "12345678",
      "street_name": "Rua Teste",
      "street_number": "123"
    }
  },
  "total_amount": "24.90",
  "capture_mode": "manual",
  "processing_mode": "automatic",
  "description": "Point Mini",
  "marketplace": "MERCADOLIVRE",
  "integration_data": {
    "integrator_id": "dev_123",
    "platform_id": "1234567890",
    "sponsor": {
      "id": "446566691"
    }
  },
  "items": [
    {
      "title": "Point Mini",
      "unit_price": "12.90",
      "quantity": 4,
      "description": "Point product for card payments via Bluetooth.",
      "id": "1234",
      "picture_url": "https://http2.mlstatic.com/resources/frontend/statics/growth-sellers-landings/device-mlb-point-i_medium2x.png",
      "category_id": "MLB1055"
    }
  ],
  "expiration_time": "P3Y6M4DT12H30M5S"
}'
Sample answer
{
  "id": "123",
  "processing_mode": "automatic",
  "external_reference": "ext_ref_1234",
  "total_amount": "24.90",
  "integration_data": {
    "application_id": "1234",
    "integrator_id": "dev_123",
    "platform_id": "1234567890",
    "sponsor": {
      "id": "446566691"
    }
  },
  "created_date": "2024-08-26T13:06:51.045317772Z",
  "last_updated_date": "2024-08-26T13:06:51.045317772Z",
  "country_code": "BRA",
  "type": "online",
  "status": "processed",
  "status_detail": "accredited",
  "capture_mode": "manual",
  "payer": {
    "email": "test@test.com",
    "first_name": "John",
    "last_name": "Doe",
    "identification": {
      "type": "CPF",
      "number": "99999999999"
    },
    "phone": {
      "area_code": "11",
      "number": "987654321"
    },
    "address": {
      "zip_code": "12345678",
      "street_name": "Rua Teste",
      "street_number": "123"
    }
  },
  "transactions": {
    "payments": [
      {
        "id": "pay_01J67CQQH5904WDBVZEM4JMEP3",
        "amount": "24.90",
        "status": "processed",
        "status_detail": "accredited",
        "payment_method": {
          "id": "visa",
          "type": "credit_card",
          "token": "12345",
          "installments": 1,
          "statement_descriptor": "approved"
        }
      }
    ]
  },
  "description": "Point Mini",
  "marketplace": "MERCADOLIVRE",
  "items": [
    {
      "title": "Point Mini",
      "unit_price": "12.90",
      "quantity": 4,
      "description": "Point product for card payments via Bluetooth.",
      "id": "1234",
      "picture_url": "https://http2.mlstatic.com/resources/frontend/statics/growth-sellers-landings/device-mlb-point-i_medium2x.png",
      "category_id": "MLB1055"
    }
  ],
  "expiration_time": "P3Y6M4DT12H30M5S"
}