Stripy v2.1.0 Stripy View Source
Stripy is a micro wrapper intended to be used for sending requests to Stripe's REST API. It is made for developers who prefer to work directly with the official API and provide their own abstractions on top if such are needed.
Stripy takes care of setting headers, encoding the data,
configuration settings, etc (the usual boring boilerplate);
it also provides a parse/1
helper function for decoding.
Some basic examples:
iex> Stripy.req(:get, "subscriptions")
{:ok, %HTTPoison.Response{...}}
iex> Stripy.req(:post, "customers", %{"email" => "a@b.c", "metadata[user_id]" => 1})
{:ok, %HTTPoison.Response{...}}
You are expected to build your business logic on top of Stripy and abstract things such as Subscriptions and Customers; if that's not your cup of tea, check out "stripity_stripe" or "stripe_elixir" on Hex.
Link to this section Summary
Functions
Parses an HTTPoison response from a Stripe API call.
Makes request to the Stripe API.
Constructs url with query params from given data.
Link to this section Functions
Parses an HTTPoison response from a Stripe API call.
Makes request to the Stripe API.
Will return an HTTPoison standard response; see parse/1
for decoding the response body.
You can specify custom headers to be included in the request
to Stripe, such as Idempotency-Key
, Stripe-Account
or any
other header. Just pass a map as the fourth argument.
See example below.
Examples
iex> Stripy.req(:get, "subscriptions")
{:ok, %HTTPoison.Response{...}}
iex> Stripy.req(:post, "customers", %{"email" => "a@b.c", "metadata[user_id]" => 1})
{:ok, %HTTPoison.Response{...}}
iex> Stripy.req(:post, "customers", %{"email" => "a@b.c"}, %{"Idempotency-Key" => "ABC"})
{:ok, %HTTPoison.Response{...}}
Constructs url with query params from given data.