#kelvin_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/1410470207905988628
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! Thanks for waiting, what sometimes work, sometimes doesn't work?
Hi @limber prism I'm taking over this thread
hi Jack
let me summary my issue facing:
- we always pass value * 100 to apple pay
e.g: 10.00 -> 1000; 10.50 -> 1050
For non-decimal support currency it work (e.g JPY, KRW, VND), but for decimal currency ApplePay sheet show 1000 instead of 10
here is our config with ApplePay:
merchantCountryCode: 'SG',
currencyCode: currentCurrencyId ?? FALLBACK_CURRENCY,
cartItems: [
{
label: 'Company',
amount: price.toString(),
paymentType: PlatformPay.PaymentType.Immediate,
},
],
}
})
Hi @limber prism the amount in cartItems is of type string, and stripe SDK will pass this value to Apple Pay paymentSheet for presentation. You don't need to multiple with 100 like what you do with Stripe amount.
yeah, everything is fine until i try to go with JPY and decimal value, when i pass JPY as currency and value as 10.50 , it throws an error:
"error": {
"stripeErrorCode": null,
"declineCode": null,
"localizedMessage": "Invalid in-app payment request. Search the iOS logs for `NSUnderlyingError` to get more information.",
"message": "Invalid in-app payment request. Search the iOS logs for `NSUnderlyingError` to get more information.",
"type": null,
"code": "Failed"
}
I don't think JPY supports decimal
yeah, so it come to a glitch that i need to if/else the list of non decimal support on FE (which base on Stripe document list) and it's not scalable / mantainable for us. Any other approach you might suggest?
also for this, do you have any document point to such information? i need to pursuade BE team for FE to manage this presentation value
https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=react-native#add-apple-pay you can see the example code here in this doc. It's using '59.99' as the amount, not 5999
๐
might i ask if there is anyway to archieve correct presentation of price accordingly with currency without if/else directly
Are you talking about the Stripe amounts or the amounts to be presented on apple pay payment sheet?
the amount to be present on Apple Pay sheet, i mean
Ok, for amount passed via cartItems[amount], it'll be exactly the same value that you specify.
yeah, but for JPY, KRW, VND, when people apply promo code (10%, 15%) the value will be decimal, we must convert them in BE instead? cannot do anything with Stripe SDK ?
Will your customer apply the promo code through Stripe checkout? or your own UI?
our own UI
Ok, then you'll need to do the calculation and round the number
thank Jack