#axelvaindal-checkout-rounding
1 messages ยท Page 1 of 1 (latest)
I don't believe there's any way to customize the rounding behavior in Checkout - do you have an example of what specifically you're trying to do (a checkout session ID would be helpful here)
Actually, we are billing our customers based on the number of characters of their document for a correction service.
The price is 2.6โฌ per 1000 characters. Basically, I'd like the price to not be 5.20 if they enter 1234 character, but rather, 1234 * 2.60 / 1000 = 3.2084 = 3.21โฌ.
Not sure if this session might help but here it is: cs_test_a1go3o3pay1lPI3TK6HkNNXJW5LyKCRWhDi5dxIiBEpQzAMuFccsk4roHg
Ah! So this is more of a question about how to model your price with our Prices API. I belive you can accomplish what you want by creating the price with transform_quantity.round: down (see https://stripe.com/docs/api/prices/create#create_price-transform_quantity-round)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
My understanding was that using this would round down, so it would use 2.60โฌ pricing in this case ๐ค
Am I getting this wrong?
Historically, we were computing price information manually, but it generated receipt only and no invoice so I wanted to use package pricing to fix this problem
Actually let's back up for a second - in that Checkout Session you provided It has a quantity of 123,456. The math goes like this:
123,456 / 1000 = 123.456 -> round that up to 124. 124 * 2.6 = 322.40.
What is the amount you actually want to be charging for a quantity of 123,456?
For the Checkout session I provided, it should be 123,456 * 2,6 -> 320985.6 / 1000 = 320,985 -> either 320,98โฌ or 320,99โฌ
In that case, I think you can change your pricing model to something much simpler. If you were just to charge .0026 per word, you'd get exactly what you want
Something like that ?
It doesn't seem to be allowed
You can't create it in the dashboard, but you should be able to create one through the API by setting unit_amount_decimal (see https://stripe.com/docs/api/prices/create#create_price-unit_amount_decimal)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Alright, really clear.
Unrelated bt, this is amazing getting to have developper support like that on a dedicated thread, thanks a lot! ๐
๐ happy to help!