Stripy v1.2.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

Constructs HTTPoison header list with auth

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

Constructs HTTPoison header list with auth.

Parses an HTTPoison response from a Stripe API call.

Link to this function req(action, resource, data \\ %{}) View Source

Makes request to the Stripe API.

Will return an HTTPoison standard response; see parse/1 for decoding the response body.

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{...}}
Link to this function url(api_url, resource, data) View Source

Constructs url with query params from given data.