svilen

svilen

Author of Concurrent Data Processing in Elixir

Stripy — micro wrapper for Stripe's REST API

Hey all,

We (Heresy) recently open-sourced a tiny library for working with Stripe’s REST API. From the official package description:

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.

There are currently a bunch of other Stripe libraries available, but we didn’t like the provided abstractions on top of the official API, so we ended up with something fairly simple that works well for us and allows us to upgrade to newer Stripe API versions easily.

Hope someone else finds it useful!

Hex: stripy | Hex
Hexdocs: Stripy — Stripy v2.1.0
Source: GitHub - svileng/stripy: Micro wrapper for Stripe's REST API.

Most Liked

christopheradams

christopheradams

You get high marks for simplicity. :slight_smile: Very good Mixfile too with nice docs links. I encourage all package makers to follow this example.

If you’re open to some feedback:

  • Document parse/1 with examples in the README and module, since it’s intended to be used.
  • Both headers/1 and url/3 don’t necessarily need to be public, since they’re not used by the user.
  • Let req/3 take config options to override the Application env, to make it more adaptable and testable. This is the most important point I can make.
  • Don’t return an HTTPoison struct, since it’s leaky, just use your own. If you drop down to pure Hackney or switch to another HTTP package, the user shouldn’t necessarily be bothered.
soundstruck

soundstruck

I’m using Stripy in production now. So far, so good! :slight_smile:

soundstruck

soundstruck

Interesting. I’m in the planning stages of integrating Stripe/subscriptions into my app, so this is quite timely for me.

I wasn’t thinking about a lag in the versions between library -> api…that makes sense. I’ll definitely have a good look at Stripy. I did something very basic and similar with the Spotify API, but mostly because I was using so little of the api.

I’m trying to work out the database side to support Stripe at the moment. If anyone has implemented stripe subscriptions and wouldn’t mind taking a look and giving feedback it would be greatly appreciated.

Here’s where I’m at with it : https://app.quickdatabasediagrams.com/#/schema/JK2qGbfjvUe8q5aLMWcE2Q

btw, sidenote, I love that app ^ for sketching out db thoughts! :smiley:

christopheradams

christopheradams

One or both. It’s not a terribly important issue; the idea is to keep your client code decoupled from the underlying HTTP package. If you have your own %Stripy.Response{} you can really own it and provide good documentation and typespecs.

This is not a universal recommendation. For example if your package works with %Plug.Conn{} there would be little advantage to re-creating your own version of it.

svilen

svilen

Author of Concurrent Data Processing in Elixir

Some recent updates to Stripy (latest: v1.2.0):

  • Ability to pass options directly to HTTPoison
  • testing mode that doesn’t fire HTTP requests
  • Support for providing your own mock server and responses in testing mode

There’s a detailed example in the readme regarding testing mode/mock server. :beers:

Where Next?

Popular in Libraries Top

hpopp
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
ericlathrop
I built a silly site for Halloween that uses Phoenix Channels on the backend, and React on the frontend. I had many problems integrating ...
New
anshuman23
Hello all, I have been working on my proposed project called Tensorflex as part of Google Summer of Code 2018.. Tensorflex can be used f...
New
versilov
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

Sub Categories:

We're in Beta

About us Mission Statement