AI resources

How to migrate from the Dynamic QR Model API to the Orders API

The Orders API unifies payment processing with QR Code in Mercado Pago, consolidating the two creation methods of the Dynamic QR Model API into a single endpoint and extending query and cancellation resources to both modes. In addition, all new Mercado Pago features will be developed on the Orders API.

The Dynamic QR Model API had two creation methods with distinct behaviors:

  • POST /qrs, dynamic QR mode: creates an order and returns a unique QR string per transaction in the qr_data field, without associating it with any checkout. The application is responsible for converting qr_data into a QR Code and displaying it to the customer.
  • PUT /qrs, hybrid QR mode: creates an order, associates it with the checkout identified by {external_pos_id}, updating the linked static QR, and also returns the dynamic QR in the qr_data field.

The Orders API unifies these two methods into a single endpoint POST /v1/ordersAPI, differentiating behavior via the config.qr.mode parameter: the dynamic value corresponds to the legacy POST flow and the hybrid value corresponds to the legacy PUT flow.

This distinction also affected query and cancellation resources, which were available in the Dynamic QR Model API only for the PUT flow. In the Orders API, these resources become available for both flows via order_id.

To migrate your integration from the Dynamic QR Model API to the Orders API, follow the steps below.

Map endpoint changes

Before starting the migration steps, review the table below for an overview of all endpoint changes. The Orders API unifies the two creation methods into a single POST /v1/ordersAPI and extends query and cancellation resources to both modes.

OperationDynamic QR Model APIOrders API
Create order (dynamic mode)POST /instore/orders/qr/seller/collectors/{user_id}/pos/{external_pos_id}/qrsAPIPOST /v1/ordersAPI with config.qr.mode: dynamic
Create order (hybrid mode)PUT /instore/orders/qr/seller/collectors/{user_id}/pos/{external_pos_id}/qrsAPIPOST /v1/ordersAPI with config.qr.mode: hybrid
Get orderGET /instore/qr/seller/collectors/{user_id}/pos/{external_pos_id}/ordersAPI (PUT flow only)GET /v1/orders/{order_id}API (both modes)
Cancel orderDELETE /instore/orders/qr/seller/collectors/{user_id}/pos/{external_pos_id}/qrsAPI (PUT flow only)POST /v1/orders/{order_id}/cancelAPI (both modes)
Refund orderVia Payments API (no dedicated endpoint in the Dynamic QR Model API)POST /v1/orders/{order_id}/refundAPI

Update the status and notifications model

One of the most significant changes between the Dynamic QR Model API and the Orders API is the status model. In the Dynamic QR Model API, the state of a transaction was determined by monitoring notifications from two independent topics , payments and merchant_orders, with different fields and values for each. The Orders API unifies this behavior into a single status field on the order. See the complete mapping below.

In addition, the Orders API also introduces the status_detail field, which provides greater detail on the transaction state. The possible values are created, canceled, accredited, refunded, and expired.

Adapt headers

The Orders API introduces a mandatory header change that affects all endpoints. The Access Token must be sent via the Authorization header. Apply the following change before testing any other resource.

Migrate order creation

The Orders API unifies the two creation methods into a single POST /v1/ordersAPI, differentiating behavior via the config.qr.mode parameter. The POST /qrs endpoint, dynamic QR mode, is equivalent to config.qr.mode: dynamic, and the PUT /qrs endpoint, hybrid QR mode, is equivalent to config.qr.mode: hybrid. In both cases, {user_id} is no longer a path parameter, {external_pos_id} moves to the body, and the type: "qr" field becomes required. Follow the steps below to adapt the request, the response, and error handling for each mode.

In the Dynamic QR Model API, the order identifier was returned in the in_store_order_id field. In the Orders API, that identifier moves to the id field, with an alphanumeric format (e.g., ORD00001111222233334444555566). Capture the id value from the creation response, as it is required for subsequent queries, cancellations, and refunds.

Update order queries

The GET /v1/orders/{order_id}API query endpoint is available for both dynamic and hybrid modes in the Orders API. In the Dynamic QR Model API, queries were available only for the PUT flow and queried by checkout, not by order. The POST flow had no query endpoint. State was obtained exclusively via payments and merchant_orders notifications.

The Orders API allows querying the complete order state directly by order_id, including status, payments, refunds, and payment method data.

curl

curl -X GET \
  'https://api.mercadopago.com/v1/orders/{{ORDER_ID}}' \
  -H 'Authorization: Bearer {{ACCESS_TOKEN}}'

Update order cancellations

The POST /v1/orders/{order_id}/cancelAPI cancellation endpoint is available for both modes in the Orders API. In the Dynamic QR Model API, cancellation was available only for the PUT flow and canceled the order associated with the checkout via DELETE. The POST flow had no cancellation endpoint.

The HTTP method changes from DELETE to POST, {user_id} and {external_pos_id} are removed from the path, and the operation now identifies the order by order_id. The response changed from empty (HTTP 204) to the full order object with status: "canceled" (HTTP 200).

Implement refunds with the dedicated endpoint

The Orders API introduces the dedicated POST /v1/orders/{order_id}/refundAPI endpoint for refunds, which did not exist in the Dynamic QR Model API in either flow. Previously, it was necessary to receive the payment webhook, obtain the payment_id, and execute the refund through the Payments API separately. Now, the refund is performed directly on the order, for both modes.

Validate the migration

After applying the changes, verify that the integration operates correctly across all flows before going to production.

The X-Idempotency-Key header must be present in all creation, cancellation, and refund operations.

Orders successfully created via the POST /v1/ordersAPI endpoint with config.qr.mode: dynamic (equivalent to the POST flow of the legacy API).

Orders successfully created via the POST /v1/ordersAPI endpoint with config.qr.mode: hybrid (equivalent to the PUT flow of the legacy API).

The id field was captured from the creation response for use in subsequent queries, cancellations, and refunds.

Orders successfully queried via the GET /v1/orders/{order_id}API endpoint in both modes.

Order status monitored via webhook with the "Order (Mercado Pago)" topic and the new values: created, processed, canceled, refunded, and expired.

Orders successfully canceled via the POST /v1/orders/{order_id}/cancelAPI endpoint in both modes.

Refunds executed via the dedicated POST /v1/orders/{order_id}/refundAPI endpoint.

See the documentation to learn how to test the integration.