#shahanajoy
1 messages · Page 1 of 1 (latest)
Hi there!
How are you accepting payments? Checkout Session, Payment Element, something else?
const options = {
mode: 'payment',
amount: Number(val),
currency: 'usd',
paymentMethodCreation: 'manual',
const elements = this.stripe.elements(options);
this.paymentElement = elements.create('payment');
this.paymentElement.mount('#payment-element');
So you are using the Payment Element.
yes
In this case, if you want to show a different currency depending on the lcoation, then that's something that you'll need to build yourself.
If you want Stripe to handle this for you, you should use Checkout Session instead with this: https://stripe.com/docs/payments/checkout/present-local-currencies
Can you plz help to do that
Not really, since it's not supported by Stripe. But basically try to guess (or ask) the location of the user. Then map the location to a currency, and convert the amont to the. corresponding currency.
Here in the image, you can see the country is coming
so like that, shall we get cureency as well
?
Like I said, that's not something that Stripe support with the Payment Element. So you'll need to build that yourself.
And if you want to use the coutry field of the Payment Element itself to change the currency, it will be tricky. Because I don't think there's a way to read that value before the form is submitted.
ohh okie, will go through the documents
anyone implemented the same? do you have sample code or anything?
No idea sorry. The simplest option here would be to use Checkout Session instead of the Payment Element.
ok, Let me use checkout option then, So if I use checkout option anything need to be change in backend as our mone is deducting viaour service API call
Yes you'll need to change pretty much everything. It's a completely different integration.
You can learn about Checkout Session here: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout
And then how to dynamitcally change the price currency: https://stripe.com/docs/payments/checkout/present-local-currencies
Sure, Thank a lot