Mercadopago (mercadopago_sdk_elixir v0.2.0)

Copy Markdown View Source

Entry point for the MercadoPago Elixir SDK.

Create a client with new/2, then pass it to any resource module:

client = Mercadopago.new("YOUR_ACCESS_TOKEN")
{:ok, %{status: 201, response: payment}} = Mercadopago.Payment.create(client, payment_data)

Every resource call accepts per-call options that override the client configuration for that request only:

Mercadopago.Payment.get(client, id, access_token: "OTHER_TOKEN")
Mercadopago.Payment.create(client, data, custom_headers: %{"x-idempotency-key" => key})
Mercadopago.Payment.search(client, filters, timeout: 5_000, max_retries: 1)

Summary

Functions

Creates a new SDK client.

Functions

new(access_token, opts \\ [])

@spec new(
  String.t(),
  keyword()
) :: Mercadopago.Client.t()

Creates a new SDK client.

Options

  • :timeout - HTTP timeout in milliseconds (default: 60_000)
  • :max_retries - max retries for GET on transient errors (default: 3)
  • :custom_headers - extra headers merged into every request, overriding generated headers case-insensitively (default: %{})
  • :corporation_id - MercadoPago x-corporation-id header
  • :integrator_id - MercadoPago x-integrator-id header
  • :platform_id - MercadoPago x-platform-id header
  • :finch - name of a Finch pool started by the host application, for dedicated connection pooling; nil uses Req's default pool
  • :plug - Req plug for testing (e.g. {Req.Test, :my_stub}); nil in production