pay_pal v0.0.2 PayPal.API
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
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:
- {:ok, {“XXXXXXXXXXXXXX”, 32000}}
- {:error, :unauthorised}
- {:error, :bad_network}
Examples
iex> PayPal.API.get_oauth_token {:ok, {“XXXXXXXXXXXXXX”, 32000}}
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}}
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}}