Really, wow this is SO bizarre
Everyone using Stripe has to multiply some currencies by 100 (ex USD) but some others stay the same (ex JPY)? That’s insanity for anyone accepting global currencies.
But to the point, our query selects the amount directly from the database and passes the query to the checkout session. How do I multiply by 100 in the SQL or between the query and the checkout session setup? I didn’t see any reference to this in the shopping cart tutorial.
qryOffer: [{id: 3, title: “My offer”, amount: “150.00”, currency: “EUR”}]
Hi @ben, thanks for the reply!
Multiplying prices by 100 in the database brings all kinds of issues:
Forces to change all the queries that have pricing in it.
Forces to rewrite all into Custom Queries
Rewrite all displays of Pricing on any pages/datastores/variables for the user
Same for all other internal or external admin pages, reporting etc.
The method also has to be different if it’s USD or EUR (has to be passed as cents) or JPY (Yens are full currencies, no decimals allowed).
Too complex to deal with by developers, there has to be another way for the Wappler internal Stripe files to manage the currency-specific conversion. @Teodor is this something that is in the pipeline for an update? Did you have comments on this from anyone using your shopping cart tutorial?
If you have the same scenario as I, then the prices in the database are all in Dollars and Cents or similar. This is OK for all of my Wappler procedures, The problem is that Stripe requires the price in a different format. This is easily fixed by giving Stripe that format each time the program interacts with Stripe.
I have my prices in A$'s. All I do is multiply the amount by 100 inside the query. If my prices were in YEN, then I would not have to do that, The query would be straight out. There is no complexity, the conversion only takes place when necessary
You could also add a generated column to the table that takes care of the calculation for you automatically and then reference that when dealing with stripe.