Join Discord
Powered by
Im sorry to ask this but im being confuse what to ...
# help
u
__ianjasper
08/31/2021, 4:51 AM
Im sorry to ask this but im being confuse what to use as datatype when we talk about wallets?? Is it decimal? Money? or what Thanksss...
j
jason-lynx
08/31/2021, 8:03 AM
there are a few options suggested here:
https://stackoverflow.com/questions/15726535/postgresql-which-datatype-should-be-used-for-currency
jason-lynx
08/31/2021, 8:05 AM
seems like if u dont have the concept of fractional cents, then using a
bigint
for cents sounds nice, otherwise `numeric`/`decimal`
j
j-k
08/31/2021, 8:32 AM
There's a nextjs supabase stripe example for some kind of subscription store thing
https://github.com/vercel/nextjs-subscription-payments
It stores the unit_amount in an int8 and then a currency in a string so $10 or $10.00 is 1000 and ¥500 is 500
https://stripe.com/docs/currencies#zero-decimal
k
Kylar
08/31/2021, 9:28 AM
https://github.com/dinerojs/dinero.js
Previous
Next