Mercadopago.API (MercadopagoAPI v0.2.1)

Documentation for Mercadopago.API. This module is about the base HTTP functionality

Link to this section Summary

Functions

Requests an OAuth token from Mercadopago, returns a tuple containing the token and seconds till expiry.

Make an HTTP DELETE request to the correct API, adding the authentication required header.

Make an HTTP GET request to the correct API, adding the authentication required header.

Make an HTTP POST request to the correct API, adding the authentication required header.

Make an HTTP PUT request to the correct API, adding the authentication required header.

Link to this section Functions

Requests an OAuth token from Mercadopago, returns a tuple containing the token and seconds till expiry.

Possible returns:

  • {:ok, data}

  • {:error, reason}

examples

Examples

iex> Mercadopago.API.create_token()
{:ok, {..}}

Make an HTTP DELETE request to the correct API, adding the authentication required header.

examples

Examples

iex> Mercadopago.API.delete(url)
{:ok, {...}}

Make an HTTP GET request to the correct API, adding the authentication required header.

Possible returns:

  • {:ok, data}

  • {:ok, :not_found}

  • {:ok, :no_content}

  • {:error, :bad_network}

  • {:error, reason}

examples

Examples

iex> Mercadopago.API.get(url)
{:ok, {...}}
Link to this function

post(url, data)

@spec post(String.t(), map() | list() | nil) ::
  {:ok, map() | :not_found | :no_content | nil}
  | {:error, :unauthorised | :bad_network | any()}

Make an HTTP POST request to the correct API, adding the authentication required header.

examples

Examples

iex> Mercadopago.API.post(url, data)
{:ok, {...}}
@spec put(String.t(), map() | list() | nil) ::
  {:ok, map() | :not_found | :no_content | nil}
  | {:error, :unauthorised | :bad_network | any()}

Make an HTTP PUT request to the correct API, adding the authentication required header.

examples

Examples

iex> Mercadopago.API.put(url, data)
{:ok, {...}}