PayPal.API (pay_pal v0.0.7)
Documentation for PayPal.API. This module is about the base HTTP functionality
Summary
Functions
Make a HTTP GET request to the correct API depending on environment, adding needed auth header.
Requests an OAuth token from PayPal, returns a tuple containing the token and seconds till expiry.
Make a HTTP PATCH request to the correct API depending on environment, adding needed auth header.
Make a HTTP POST request to the correct API depending on environment, adding needed auth header.
Functions
@spec get(String.t()) :: {:ok, map() | :not_found | :no_content} | {:error, :unauthorised | :bad_network | any()}
Make a HTTP GET request to the correct API depending on environment, adding needed auth header.
Note: If your name is not Zen and you're reading this, unless you're sending me a PR (thanks!), you probably don't need this.
Possible returns:
{:ok, data}
{:ok, :not_found}
{:ok, :no_content}
{:error, :bad_network}
{:error, reason}
Examples
iex> PayPal.API.get(url) {:ok, {"XXXXXXXXXXXXXX", 32000}}
Requests an OAuth token from PayPal, returns a tuple containing the token and seconds till expiry.
Note: If your name is not Zen and you're reading this, unless you're sending me a PR (thanks!), you probably don't need this.
Possible returns:
- }
{:error, :unauthorised}
{:error, :bad_network}
Examples
iex> PayPal.API.get_oauth_token {:ok, {"XXXXXXXXXXXXXX", 32000}}
@spec patch(String.t(), map() | list()) :: {:ok, map() | nil | :not_found | :no_content} | {:error, :unauthorised | :bad_network | any()}
Make a HTTP PATCH request to the correct API depending on environment, adding needed auth header.
Note: If your name is not Zen and you're reading this, unless you're sending me a PR (thanks!), you probably don't need this.
Possible returns:
{:ok, data}
{:ok, :not_found}
{:ok, :no_content}
{:error, :bad_network}
{:error, reason}
Examples
iex> PayPal.API.patch(url, data) {:ok, {"XXXXXXXXXXXXXX", 32000}}
@spec post(String.t(), map() | list() | nil) :: {:ok, map() | :not_found | :no_content | nil} | {:error, :unauthorised | :bad_network | any()}
Make a HTTP POST request to the correct API depending on environment, adding needed auth header.
Note: If your name is not Zen and you're reading this, unless you're sending me a PR (thanks!), you probably don't need this.
Possible returns:
{:ok, data}
{:ok, :not_found}
{:ok, :no_content}
{:error, :bad_network}
{:error, reason}
Examples
iex> PayPal.API.post(url, data) {:ok, {"XXXXXXXXXXXXXX", 32000}}