Through the preference, it is possible to create a payment with an associated shipment. This way, you can offer customers home delivery of purchased products leveraging Mercado Libre's logistics without extra effort from the business.
Creating payments with shipments is only available for integrators who have Mercado Pago authorization. If you don't have this functionality, you can request it from your Sales Advisor.
To create a payment with an associated shipment, create a preference by sending a POST to the endpoint /checkout/preferences, including your Access TokenPrivate key of the application created in Mercado Pago, used in the backend. You can access it through Your integrations > Application details > Testing > Test credentials. and the items and shipments nodes as indicated in the table below.
Reference that you can synchronize with your payment system to identify the shipment. This field must have a maximum of 64 characters and should only contain numbers, letters, hyphens (-) and underscores (_). Special characters like ([ ], (), '', @) are not allowed.
String
Optional
items
Information about the items sold to be shipped.
Array
Required
items.title
Item title that will be displayed during the payment process, in the checkout, activities and emails.
String
Required
items.description
Item description.
String
Optional
items.picture_url
Item image URL.
String
Optional
items.quantity
Quantity of items. This property is used to calculate the total purchase cost.
Number
Required
items.currency_id
Unique identifier of the currency involved in the transaction. The only possible value is Mexican pesos (MXN).
String
Optional
items.unit_price
Unit price of the item. This property is used together with the quantity property to determine the purchase cost.
Number
Required
items.fiscal_data
Object containing the product's fiscal data.
Object
Required to create shipments. If you send it, you must also include the shipments attribute.
items.fiscal_data.sat
SAT category of the item. Check the possible values by accessing the following link.
String
Required
items.fiscal_data.sat_measurement_id
Unique identifier of the product's unit of measurement.
String
Required
items.fiscal_data.measurement_unit
Product unit of measurement according to SAT Units
String
Required
items.fiscal_data.package_id
Identifier of the product's packaging type.
String
Required
items.fiscal_data.dangerous_material_id
Identifier for dangerous products.
String
Optional
items.dimensions
Object containing information about the item's size.
Object
Optional
items.dimensions.unit
Unit of measurement for the item. Must be cm (centimeters).
String
Required
items.dimensions.height
Item height in centimeters.
Number
Required
items.dimensions.width
Item width in centimeters.
Number
Required
items.dimensions.length
Item length in centimeters.
Number
Required
items.dimensions.weight
Item weight in grams.
Number
Required
shipments
Shipment information.
Object
Required
shipments.dimensions
Package size, which will be used to define the shipping cost. The format must be cm x cm x cm, g. If it contains more than one item, its size should be calculated considering the sum of the dimensions of all items, always ensuring that the maximum allowed dimensions per package are not exceeded. Check the best practices for sizing by accessing the documentation.
String
Required
shipments.free_methods_type
Shipping method identifier. Should only be sent when offering free shipping, with the value standard. This free shipping is only possible when the sale value is greater than the shipping cost. If the shipping cost is borne by the buyer, the field should not be sent.
String
Optional
shipments.local_pickup
Indicates whether you want to offer package pickup at a branch. For this solution, enter false.
Boolean
Required
shipments.mode
Shipping mode. For this solution, enter me2.
String
Required
shipments.stock_origin_id
Identifier of the package's origin address, which must be requested from the Mercado Pago team. If there is more than one pickup address, the stock_origin_id of the origin address must be informed.
String
Optional
shipments.receiver_address
Details of the destination address. Sending it is recommended to offer the best shopping experience and, if necessary, the data can be reused.
Object
Optional
shipments.receiver_address.zip_code
Postal code of the destination address.
String
Optional
shipments.receiver_address.street_name
Destination street name.
String
Optional
shipments.receiver_address.street_number
Destination address number.
String
Optional
shipments.receiver_address.floor
Destination apartment floor.
String
Optional
shipments.receiver_address.apartment
Destination apartment number.
String
Optional
shipments.receiver_address.neighborhood
Destination address neighborhood.
String
Optional
shipments.receiver_address.city_name
Destination address city.
String
Optional
shipments.receiver_address.state_name
Destination address state.
String
Optional
shipments.receiver_address.country_name
Destination address country.
String
Optional
If the request is sent successfully, the payment with shipment will have been created and the response will look like the example below.
If necessary, it is possible to cancel the created shipment. To do so, you must cancel the payment to which it is associated in its entirety.
Manage shipments
If you choose to create payments with shipments, you can use our shipment management APIs, which will allow you to optimize your pre and post-sale experience.
To rate a shipment, send a POST to the endpoint /shipping/v1/shipments-rates including your Access TokenPrivate key of the application created in Mercado Pago, used in the backend. You can access it through Your integrations > Application details > Testing > Test credentials. and the parameters described in the table below. Keep in mind that only one package can be quoted at a time.
Contains the package information for the shipping rate.
Array
Required
packages.declared_value
Value of the package to be shipped. Does not include the estimated shipping cost.
Number
Required
packages.quantity
Number of packages. The only allowed value is 1.
Number
Required
packages.dimensions
Object containing the package dimensions. The allowed maximums are: - Each side must have a maximum of 150 cm. - The total dimension limit must not exceed 330 cm. - The maximum weight is 30 kg (actual or volumetric).
Object
Required
packages.dimensions.height
Package height in centimeters.
Number
Required
packages.dimensions.width
Package width in centimeters.
Number
Required
packages.dimensions.length
Package length in centimeters.
Number
Required
packages.dimensions.weight
Package weight in grams.
Number
Required
shipping_from.zip_code
Postal code of the origin address. If this value is provided, it will be used to calculate the offer. Otherwise, the Shipping data configured in Mercado Pago will be applied.
String
Optional
shipping_to.zip_code
Postal code of the destination address.
String
Required
If the request is correct, the response will return the shipping rate, which may contain more than one option varying in price and/or delivery time.
Rate identifier. Use this value as shipment_rate_id when creating the shipment.
String
rates
List of rates for the package based on the provided address.
Array
options
List of available rate options.
Array
id
Shipping option identifier. Use this value as option_id when creating the shipment from the rate.
String
base_price
Gross shipping value.
Number
price
Net shipping value.
Number
method
Delivery method. The only possible response to this field is standard, for free shipping.
String
pay_before
Expected payment date to ensure the generated shipping promise.
Date
delivery_promise.shipping_from
Initial date of the delivery promise.
String
delivery_promise.shipping_to
Final date of the delivery promise.
String
delivery_days.from
Minimum business days for the delivery promise.
Integer
delivery_days.to
Maximum business days for the delivery promise.
Integer
packages.quantity
Number of rated packages.
Number
packages.dimensions
Rated package dimensions.
Object
packages.dimensions.height
Package height.
Number
packages.dimensions.width
Package width.
Number
packages.dimensions.length
Package length.
Number
packages.dimensions.weight
Package weight.
Number
shipping_to.zip_code
Postal code of the destination address.
String
shipping_to.city_id
City identifier of the destination address.
String
shipping_to.state_id
State abbreviation of the destination address.
String
shipping_to.country_id
Country abbreviation of the destination address.
String
To learn about the errors this request may return, go to our API Reference.
It is possible to query a shipment and obtain its complete data once created. This query will allow you to access the package identifier (packages.id) and the tracking number (tracking_number), among other data.
To do so, send a GET with your Access TokenPrivate key of the application created in Mercado Pago, used in the backend. You can access it through Your integrations > Application details > Testing > Test credentials. to the endpoint /shipping/v1/shipments/{shipment_id} including the shipment identifier (shipment_id) in the request path.
Active shipment phase: forward (delivery to customer) or reverse (return).
String
created_at
Shipment creation date and time.
Date
shipping_to
Destination address information with complete recipient details.
Object
shipping_from
Origin address information with sender details.
Object
packages
Packages included in the shipment.
Array
packages.id
Package identifier. Use this value to generate labels.
String
packages.dimensions
Package dimensions (height, length, width, weight and volume).
Object
packages.items
Items included in the package.
Array
packages.price
Package price information.
Object
packages.tracking_info
Package tracking information.
Object
packages.tracking_info.tracking_number
Package tracking number. Use this value to track the shipment.
String
packages.tracking_info.last_status
Last recorded package status.
String
origin
Origin address information.
Object
dispatch_date
Estimated shipment dispatch date.
Object
With the Labels API, you can generate labels containing all the necessary information to dispatch packages of your sold products. You can choose whether you want this label to be generated in PDF, ZIP or ZPL format for download, or in JSON format.
If when querying a shipment, the dispatch-date parameter is present, labels can only be generated 24 hours before the date and time defined in that field. Access Shipment query for more information.
To generate the label, send a GET with your Access TokenPrivate key of the application created in Mercado Pago, used in the backend. You can access it through Your integrations > Application details > Testing > Test credentials. and the parameters indicated in the table below to the endpoint /shipping/v1/shipments/{id}/packages/{package_id}/label.
Path. Shipment identifier, which can be obtained by querying the shipment information or through the Webhook notification.
String
Required
package_id
Path. Package identifier, which can be obtained by querying the shipment information or through the Webhook notification.
String
Required
X-Content-Type
Header. Desired output format for the label. Possible formats are: pdf, zpl, zip, json.
String
Required
The response may vary depending on the output format specified in the request, but it will always contain a label identifier (id) and its content (label). If requested to be generated as a PDF, ZIP or ZPL file, it will contain the downloadable file.
json
[
{
"id": 43539204818,
"label": "String"
}
]
To learn about the errors this request may return, go to our API Reference.
With the Shipments API you can track dispatched packages using their tracking number. To do so, send a GET to the endpoint /shipping/v1/shipments-tracking/{tracking_number}, including only the package's tracking number (tracking_number) in the request path.
Package dimensions (height, length, width, weight and volume).
Object
package.dimensions.height
Package height.
Number
package.dimensions.width
Package width.
Number
package.dimensions.length
Package length.
Number
package.dimensions.weight
Package weight.
Number
package.items
Information on items included in the package.
Array
package.items.title
Title of the item shipped in the package.
String
package.items.description
Description of the item shipped in the package.
String
package.items.unit_price
Value of the item shipped in the package.
Number
package.price
Package shipping price data.
Object
package.price.amount
Shipping value.
Number
package.price.currency
Currency used.
String
tracking
Shipment history details.
Array
tracking.type
Direction in which the shipment is moving: forward when the package is on its way to the customer; reverse when the package is heading back to the origin address.
String
tracking.events
List of shipment events.
Array
tracking.events.status
Shipment event status. See possible statuses in the section below.
String
tracking.events.date
Event status update date.
String
tracking.events.event_name
Event name (when available).
String
tracking.events.event_date
Event date (when available).
String
To learn about the errors this request may return, go to our API Reference.
Possible shipment statuses
Below you can consult the possible shipment statuses along with their description and association with the direction in which the shipment moves.
Status
Description
Phase
created
The shipment was created (once the payment was made).
Forward / Reverse
ready
The shipment label can now be generated. When dispatch-date is present, you can only generate the label 24 hours before this date and time.
Forward
label_printed
The label was generated.
Forward / Reverse
shipped
The package was picked up and is on its way to its destination.
Forward / Reverse
out_for_delivery
The package left the origin location to the destination address.
Forward
soon_deliver
The package is near its destination.
Forward
delivered
The package was delivered.
Forward
not_delivered
The package was not delivered.
Forward / Reverse
canceled
The shipment was canceled.
Forward
in_hub
The package is in a warehouse.
Forward
rejected_in_hub
The package was rejected at the warehouse.
Forward
discarded
The package was discarded and will not return to the sender.
Reverse
outbounded
The package left the warehouse.
Forward
impassable_area
The shipment route has an impassable area.
Forward
receiver_absent
The package recipient is absent.
Forward
refused_delivery
Package delivery was refused.
Forward
bad_address
The carrier could not find the destination address or it was invalid.
Forward / Reverse
damaged
The package was damaged.
Forward / Reverse
lost
The package was lost.
Forward / Reverse
stolen
The package was stolen.
Forward / Reverse
delayed
The package is delayed.
Forward
estimated_delivery_updated
Estimated delivery date updated.
Forward
returned
The package was returned to the sender.
Reverse
on_route
The package is on route.
Forward
failed
Shipment initialization failed.
-
redirected
The shipment was redirected (changed phase).
Reverse
stuck
The shipment is stuck (phase change failed).
Forward / Reverse
picked_up
Package picked up.
Reverse
carrier_logistic_center_inbound
The package entered a warehouse.
Forward / Reverse
carrier_logistic_center_outbound
The package left a warehouse.
Forward / Reverse
sender_absent
Seller absent for pickup.
Reverse
refused_pickup
Package pickup was refused.
Forward
sender_not_visited
Package pickup could not be completed.
Forward
Configure shipment notifications
Configure Webhook notifications to receive alerts about shipments and their status changes.
To do so, you need to indicate the URLs to which they will be sent by following the step-by-step below:
Go to Your integrations and select the application integrated with Checkout Pro for which you want to activate notifications.
In the left menu, select Webhooks > Configure notifications.
Select the Production mode tab and provide an HTTPS URL to receive notifications with your production integration.
Select the Shipments (Mercado Pago) event to receive notifications, which will be sent in JSON format via an HTTPS POST to the URL specified above.
Finally, click Save configuration. This will generate a secret key exclusive to the application, which will allow you to validate the authenticity of the received notifications, ensuring they were sent by Mercado Pago. Keep in mind that this generated key has no expiration date and its periodic renewal is not mandatory, although it is recommended. To do so, just click the Reset button.
If you want more information on how to simulate sending a notification, validate its origin, or what actions are necessary after receiving them, go to Configure notifications.