svilen

svilen

Author of Concurrent Data Processing in Elixir

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. · GitHub

Showing Posts 1 to 6

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 : QuickDBD

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

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.
svilen

svilen OP

Author of Concurrent Data Processing in Elixir

@soundstruck Glad to hear :thumbsup:

@christopheradams Thank you for the kind words, and feedback is much appreciated! About your last point on the HTTPoison struct, do you mean returning a custom struct when there’s an error, successful response, or both?

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 OP

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:

soundstruck

soundstruck

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

— All posts loaded —

Where Next? Top

Trending in Announcing Top

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 11030 135
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews