#dhruv_api

1 messages ยท Page 1 of 1 (latest)

median iceBOT
#

๐Ÿ‘‹ 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.

trail violet
#

๐Ÿ‘‹ Hi Looking over the provided Checkout Session

velvet marlin
#

Hey, the issue is basically related to rounding of the unit cost and the delta which shows up.

trail violet
#

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

velvet marlin
#

Yeah, even 4 cents will be an issue. This is just an example, we have more such scenarios

trail violet
#

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.

velvet marlin
#

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

trail violet
#

It looks like you are passing in 4688

#

in the Checkout creation request.

velvet marlin
#

Yes, 375/8 is 46.875, which we round off otherwise Stripe will get incorrect amount

trail violet
#

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.

velvet marlin
#

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

trail violet
#

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

velvet marlin
#

Yeah

#

And what about quantity based discounting? Is that possible

trail violet
velvet marlin
#

Does this also work for standard/one time product? We do not have recurring products

trail violet
#

Sorry I overlooked the fact you are doing one time payments. Unfortunately tiered pricing is limited to recurring payments.

velvet marlin
#

Ohk, do we have any other options?

trail violet
#

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.

velvet marlin
#

Ok, thanks

median iceBOT