Mercadopago.Order (mercadopago_sdk_elixir v0.2.1)

Copy Markdown View Source

Order lifecycle: create, process, capture, refund, cancel, and search.

These endpoints are the Checkout API via Orders, which MercadoPago documents separately from Checkout Pro. If you want the hosted flow where the buyer is redirected to MercadoPago, you want Mercadopago.Preference instead — the similar shape of the two payloads makes them easy to confuse.

Summary

Functions

Captures an authorized order.

Creates an order from order_data.

Creates an online order processed in stages (Checkout API via Orders).

Fetches an order by id.

Processes a previously created order.

Refunds an order, fully or partially via refund_data.

Searches orders matching filters (query-string parameters).

Functions

cancel(client, order_id, opts \\ [])

Cancels an order.

capture(client, order_id, opts \\ [])

Captures an authorized order.

create(client, order_data, opts \\ [])

Creates an order from order_data.

create_checkout_pro(client, order_data, opts \\ [])

This function is deprecated. Use create_online/3, or Mercadopago.Preference.create/3 for Checkout Pro.
@spec create_checkout_pro(Mercadopago.Client.t(), map(), keyword()) ::
  Mercadopago.HTTP.response()

Deprecated alias for create_online/3.

The name is inherited from the Ruby SDK but is a misnomer: POST /v1/orders with type: "online" is the Checkout API (via Orders), which MercadoPago documents separately from Checkout Pro. Checkout Pro lives in Mercadopago.Preference.

create_online(client, order_data, opts \\ [])

@spec create_online(Mercadopago.Client.t(), map(), keyword()) ::
  Mercadopago.HTTP.response()

Creates an online order processed in stages (Checkout API via Orders).

Convenience wrapper over create/3 that applies the two-step defaults: type "online" and processing_mode "manual" when omitted. Follow it with process/3 to settle the order. If those fields are provided (atom or string key), they must already match this flow; otherwise an ArgumentError is raised.

This is not Checkout Pro. For the hosted Checkout Pro flow, create a payment preference with Mercadopago.Preference.create/3 instead.

get(client, order_id, opts \\ [])

Fetches an order by id.

process(client, order_id, opts \\ [])

Processes a previously created order.

refund(client, order_id, refund_data \\ nil, opts \\ [])

Refunds an order, fully or partially via refund_data.

search(client, filters \\ nil, opts \\ [])

@spec search(Mercadopago.Client.t(), map() | nil, keyword()) ::
  Mercadopago.HTTP.response()

Searches orders matching filters (query-string parameters).