Mercado Pago via API
Integrate Mercado Pago in your application via API.
1. Create and order
To make a purchase, create an order in DEUNA.
Make a request to the Create an Order endpoint.
The API returns an order_token that is used throughout the flow.
For a detailed information about the description of each field refer to Create an Order.
Request example
{
    "order_type": "AIRLINE_ORDER",
    "order": {
        ....
        "statement_descriptor": "DEUNA_TICKET",
        "store_code": "all",
        "airline_information": {
            "booking_items": [
                {
                    "passenger": {
                        "first_name": "Jhon",
                        "middle_name": "Paul",
                        "last_name": "Smith",
                        "date_of_birth": "2000-06-27"
                    },
                    "legs": [
                        {
                            "carrier_name": "Aeromexico",
                            "sub_total_amount": 900,
                            "tax_amount": 600,
                            "total_amount": 1500,
                            "origin": {
                                "date": "2020-02-15",
                                "time": "15:30",
                                "iata_code": "SFO"
                            },
                            "destination": {
                                "iata_code": "DBX",
                                "date": "2020-02-15",
                                "time": "15:30"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
total_amountis equal tosub_total_amount + tax_amountinorder.airline_information.booking_items.legs.
Field description
Learn how all fields must be filled in the Mercado Pago order via API.
Common fields in all orders:
| Field Path | Description | Example Value | 
|---|---|---|
| order_type | Type of the order (it must be AIRLINE_ORDER if airline information is present) | AIRLINE_ORDER | 
| order.statement_descriptor | Statement description for payment. Maximum length accepted by Mercado Pago: 13 characters. | DEUNA*SHOP123 | 
Passenger required fields
For each passenger, fill in personal information and each of the purchased leg.
If airline information is not included, a collection of items must be provided:
| Field Path | Description | Example Value | Required | 
|---|---|---|---|
| order.airline_information.booking_items[0].passenger.first_name | Passenger first name | John | |
| order.airline_information.booking_items[0].passenger.middle_name | Passenger middle name (if applicable) | Paul | Optional | 
| order.airline_information.booking_items[0].passenger.last_name | Passenger last name | Smith | |
| order.airline_information.booking_items[0].passenger.date_of_birth | Passenger date of birth | 2000-06-27 | Optional | 
| order.airline_information.booking_items[0].legs[0].carrier_name | Airline carrier code | Aeroméxico | Default value "Unknown" | 
| order.airline_information.booking_items[0].legs[0].total_amount | Total amount for the leg | 1000 | |
| order.airline_information.booking_items[0].legs[0].sub_total_amount | Subtotal for the leg without taxes | 1000 | |
| order.airline_information.booking_items[0].legs[0].tax_amount | Tax amount | 0 | Optional | 
| order.airline_information.booking_items[0].legs[0].origin.date | Origin date | 2020-02-15 | |
| order.airline_information.booking_items[0].legs[0].origin.time | Origin time | 15:30 | |
| order.airline_information.booking_items[0].legs[0].origin.iata_code | Origin airport IATA code | SFO | Default value "N/A” | 
| order.airline_information.booking_items[0].legs[0].destination.iata_code | Destination airport IATA code | DBX | Default value "N/A” | 
| order.airline_information.booking_items[0].legs[0].destination.date | Destination date | 2020-02-15 | |
| order.airline_information.booking_items[0].legs[0].destination.time | Destination time | 15:30 | 
All amounts must be expressed in cents
Order fields
| Field | Description | Example Value | Required | 
|---|---|---|---|
| order.store_code | Unique store code (value “all”) | all | |
| order.items | Collection of items. Check | Create an Order | Required if airline information is not included. | 
| order.statement_descriptor | Statement description for payment. Maximum length accepted by Mercado Pago: 13 characters. | DEUNA\SHOP123 | 
General considerations:
- About order.items:- total_amount.original_amountmust be- unit_price.amount * quantity.
- total_amount.amountmust be- ((unit_price.amount + tax_amount.amount) * quantity) - total_amount.total_discounts.
- total_amount.total_discountsis the total value of discounts for the quantity of items.
 
- order.items_total_amountis the sum of the unit prices of the items. This amount, plus- order.total_tax_amountand minus- order.discount_amount, must match- order.total_amount.
- order.sub_totalis the sum of the unit price of the items minus the discounts. This amount, plus- order.total_tax_amount, must match- order.total_amount.
2. Process the order
Make a request to the V2 Purchase endpoint an process the payment.
Updated about 1 month ago