Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blakewilliams/elixir-stripe
A work in progress wrapper around the Stripe API in Elixir.
https://github.com/blakewilliams/elixir-stripe
Last synced: 16 days ago
JSON representation
A work in progress wrapper around the Stripe API in Elixir.
- Host: GitHub
- URL: https://github.com/blakewilliams/elixir-stripe
- Owner: BlakeWilliams
- Created: 2014-03-01T04:22:46.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-03-06T03:52:56.000Z (almost 11 years ago)
- Last Synced: 2024-12-15T14:57:09.915Z (19 days ago)
- Language: Elixir
- Size: 188 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stripe
A work in progress for using Elixir with the Stripe API.Since this is only a thing wrapper around Stripe everything passed to and returned by
Stripe should be a HashDict.## Usage
Before you do anything you have to set your API token. If you're running the tests
(they actually hit the API at the moment) you need to set an environment variable called
`STRIPE_SECRET_KEY` before you run the tests. You can also just modify the test_helper and
pass the key there.```elixir
Stripe.set_secret("Your Secret Here")
```### Creating a Customer
```elixir
attrs = HashDict.new([
email: '[email protected]',
description: 'New user'
]){:ok, customer} = Stripe.Customer.create(attrs)
IO.puts HashDict.get(customer, "email") # [email protected]
```### Updating a Customer
```elixir
attrs = HashDict.new([
email: '[email protected]',
description: 'Updated description'
]){:ok, customer} = Stripe.Customer.update("cus_3aDRxsZH8sTV6F", attrs)
```### Deleting a Customer
```elixir
id = "cus_3aDRxsZH8sTV6F"
{:ok, message} = Stripe.Customer.delete(id)
```### Retrieving a Customer
```elixir
id = "cus_3aDRxsZH8sTV6F"
{:ok, customer} = Stripe.Customer.retrieve(id)
```### Listing Customers
```elixir
{:ok, customers} = Stripe.Customer.list
customers = HashDict.get(customers, "data")Enum.each customers, fn customer ->
IO.puts HashDict.get(customer, "id")
end
```All implemented API methods use the same names as above when applicable except
Cards, Discounts, and Subscriptions which each take a `customer_id` as their
first argument.## Todo
* Document existing code
The following parts of the API need to be implemented
* ~~Charges~~
* ~~Customers~~
* ~~Cards~~
* Subscriptions
* ~~Plans~~
* Coupons
* Discounts
* Invoices
* Invoice Items
* Disputes
* Transfers
* Recipients
* Application Fees
* Account
* Balance
* Events
* ~~Tokens~~