Packages
stripity_stripe
0.4.0
3.3.2
3.3.1
3.2.0
3.1.1
3.1.0
3.0.0
2.17.3
2.17.2
2.17.1
2.17.0
2.16.0
2.15.1
2.15.0
2.14.1
2.14.0
2.13.0
2.12.1
2.12.0
2.11.0
2.10.0
2.9.0
2.8.0
2.7.2
2.7.1
2.7.0
2.6.0
2.5.0
2.4.0
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.1.0
2.0.1
2.0.0
2.0.0-alpha.11
2.0.0-alpha.10
2.0.0-alpha.9
2.0.0-alpha.8
2.0.0-alpha.7
2.0.0-alpha.6
2.0.0-alpha.5
2.0.0-alpha.4
2.0.0-alpha.3
2.0.0-alpha.2
2.0.0-alpha.1
1.6.2
1.6.1
1.6.0
1.4.0
1.3.0
1.2.0
1.1.0
0.5.0
0.4.0
0.3.0
0.2.0
A Stripe client for Elixir.
Current section
Files
Jump to
Current section
Files
stripity_stripe
README.md
README.md
# Stripe for Elixir
An Elixir 1.0.5 library for working with Stripe. With this library you can:
- manage Customers
- Create, list, cancel, update and delete Subscriptions
- Create, list, update and delete Plans
- Create, list, and update Invoices
- And yes, run charges with or without an existing Customer
Why another Stripe Library? Currently there are a number of them in the Elixir world that are, well just not "done" yet. I started to fork/help but soon it became clear to me that what I wanted was:
- An existing/better test story
- An API that didn't just mimic a REST interaction
- A library that was up to date with Elixir > 1.0 and would, you know, actually *compile*.
- Function calls that returned a standard `{:ok, result}` or `{:error, message}` response
As I began digging things up with these other libraries it became rather apparent that I was not only tweaking the API, but also ripping out a lot of the existing code... and that usually means I should probably do my own thing. So I did.
## Stripe API
I've tested this library against Stripe API v1 and above. [The docs are up at Hex](http://hexdocs.pm/stripity_stripe/0.2.0/extra-api-reference.html)
## Usage
Install the dependency:
```
{:stripity_stripe, "~> 0.3.0"}
```
Then create a config folder and add a Stripe secret key:
```
use Mix.Config
config :stripe, secret_key: "YOUR SECRET KEY"
```
Then add Stripe to your supervisor tree or, to play around, make sure you start it up:
```
Stripe.start
```
## The API
I've tried to make the API somewhat comprehensive and intuitive. If you'd like to see things in detail be sure to have a look at the tests - they show (generally) the way the API goes together.
In general, if Stripe requires some information for a given API call, you'll find that as part of the arrity of the given function. For instance if you want to delete a Customer, you'll find that you *must* pass the id along:
```
{:ok, result} = Stripe.Customers.delete "some_id"
```
For optional arguments, you can send in a Keyword list that will get translated to parameters. So if you want to update a Subscription, for instance, you must send in the `customer_id` and `subscription_id` with the list of changes:
```
#Change customer to the Premium subscription
{:ok, result} = Stripe.Customers.change_subscription "customer_id", "sub_id", plan: "premium"
```
That's the rule of thumb with this library. If there are any errors with your call, they will bubble up to you in the `{:error, message}` match.