#dhruv_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1424869450410364938
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
๐ Hi Looking over the provided Checkout Session
Hey, the issue is basically related to rounding of the unit cost and the delta which shows up.
Understood, I was just trying to understand because the rounding error you described was of 40 Cents which would be significant. However i'm seeing from the Checkout session a rounding delta of 4 cents
Yeah, even 4 cents will be an issue. This is just an example, we have more such scenarios
Understood, just trying to identify if we were incorrectly calculating the number provided to unit_amount_decimal or if this simply an outcome of rounding.
This is because of rounding
In our system we are selling 8 products for 375. In order to pass this when we convert it to unit cost, it gives us 3 decimal places. Now, when Stripe calculates, it causes that delta
Yes, 375/8 is 46.875, which we round off otherwise Stripe will get incorrect amount
While using fractional cent amounts is available in subscription mode, where you could pass in 4687.5, this is not possible in payment mode. Which will require you to define your unit price at a cent level.
Is there anyway to pass the total price instead of unit price?
Or is there anyway to discount based on quantity. For ex: someone might buy 10 quantity, but we ask them to only pay for 8. They should still see 10 quantity
There isn't a way to pass a total price rather than a unit price. The only thing I could thing of is to create a price where 1 unit represents 8 units of another price.
Challenge is this wouldn't be easily scalable
I think Tiered Pricing might be the best fit for that.
https://docs.stripe.com/products-prices/pricing-models#tiered-pricing
Does this also work for standard/one time product? We do not have recurring products
Sorry I overlooked the fact you are doing one time payments. Unfortunately tiered pricing is limited to recurring payments.
Ohk, do we have any other options?
It's feasible you could write custom logic to apply a % discount based on the quantity.
We simply dont have anything that would automate this for you.
Though considering buy x get y free is a common practice out in the world, I can see why this would be useful. I can certainly leave some product feedback regarding that.
Ok, thanks