pkrawat1

pkrawat1

Hey guyz

We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it.
Have a look at it in development here GitHub - aviabird/gringotts: A complete payment library for Elixir and Phoenix Framework · GitHub.

Thanks

Showing Posts 1 to 10

michalmuskala

michalmuskala

I had a quick look at the library. I think this is an awesome project and something very needed in the community. I have some some remarks, though.

Why are floats used for money? This is a complete no-go for me since floating point arithmetic is inherently inacurate. I haven’t looked in depth if this is actually the case, but that’s what is presented in the examples.

Why is the project using GenServers in the middle? It should be perfectly enough to have “just” modules and functions. The worker process does not use the state in any way, so the only thing it does, is creating a bottleneck in the system.

16
Post #1
AstonJ

AstonJ

Yup - decimals or integers.

Also worth checking out this post.

kip

kip

ex_cldr Core Team

There are a few libs that provide Money functions. money, ex_money and monetized (the first 3 on hex.pm) each seem to represent Money as a struct with a currency which is an ISO 4217 code and amount which is a Decimal.

It would be useful if Gringotts could support an abstraction for money types so that integration would be straight forward given than there’s a reasonable likelihood that someone using Gringotts is probably also using a Money lib. Maybe a Money protocol?

(disclaimer: I’m the author or ex_money)

11
Post #3
sztosz

sztosz

I’ll just “upvote” this, because if this library is going to use floats internally it will be unreliable. The simplest way is to just use integers and have everything in “cents”, not “dollars” (that is if you don’t need to support currencies like the old pounds divisions in UK http://projectbritain.com/moneyold.htm).

James-Byrne

James-Byrne

What parts of the payment gateways are you targeting? Is it just plain payments or are you attempting to support Hosted Payment Pages, subscriptions, refunds, betting? Do you have a list of gateways your looking to support or some kind of roadmap?

kip

kip

ex_cldr Core Team

Just noting even “cents” needs care since an implied decimal place of fixed size (cents == 100) is also problematic for the 52 currencies that have no decimal places, the 6 that have 3 decimal places and the one that has 4 decimal places.

10
Post #6
AstonJ

AstonJ

I had no idea such currencies exist :lol:

kip

kip

ex_cldr Core Team

3 decimal places: Libyan dinar, Bahraini Dinar and Omani rial
4 decimal places: Chilean unit of account (UF) which is a legal tender (Unidad de Fomento - Wikipedia)

Money stuff is fun! :slight_smile:

NobbZ

NobbZ

And all those digital or cryptocurrencies? Don’t they have 6 and more decimals?

kip

kip

ex_cldr Core Team

ISO 4217 will probably take quite a while to catch up with those :slight_smile:

Either way, assumptions about money need care - including the assumption of how many decimal places a given currency may have. Even ISO 4217 allows the creation of private-use codes and they can have whatever digits and rounding strategy you want.

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
rodloboz
I’ve started working on a new library to run SQL queries and do basic business intelligence. Think “Blazer for Elixir.” Currently it fe...
New

Other Trending Topics Top

mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
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
CodeSync
:microphone: ElixirConf 2026 - Call for Talks is open! We’re heading to Chicago :united_states: :round_pushpin: In person + virtual :d...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews