#slush-pricing

1 messages · Page 1 of 1 (latest)

wary latch
#

hello @still crag. I don't know what "formatting pricing" could mean

still crag
#
        {     
            // Replace this constant with a calculation of the order's amount
            // Calculate the order total on the server to prevent
            // people from directly manipulating the amount on the client
            return 1400;
        }```
#

So 1400 is $14 correct?

#

My database outputs numbers like 14, 34.99, 12.05, 12.5

#

How would you suggest making it so that it would fit for this API?

#

Does stripe just assume everything has 2 decimal places?

wary latch
#

ah yeah so our amounts are in the smallest currency units. So 1499 is $14.99

#

so for example 1499 for currency: 'jpy' is 1499 JPY, not 14.99

still crag
#

USD

#

so 20

#

is .20cents

wary latch
#

yeah

still crag
#

Also is there a way to force a failure on a paymentinentrequest?

#

For example im trying to calculateorderamount and if for some reason an error returns from my database I want to be able to cancel the payment intent

#

I could just make the "Amount = "error""

#

But not sure if there is a better way

wary latch
#

I'm not really following what you mean by that

#

why would there be an error with the amount?

still crag
#

Im grabbing the amount from my database.

#

So if the database goes down or whatever and it cant retrieve the amount not sure the best way to handle it.

wary latch
#

you have bigger problems at that point 😅