#seth-multi-country
1 messages ยท Page 1 of 1 (latest)
@solid storm ๐ What Stripe instance are you thinking of? Like Stripe.js client-side?
Hey koopajah
Yes, thx for your reply. I am using stripe.js client side. I have a country selector and have two separate accounts; one for US and one for Canada. Each have their own keys.
I have the issue that my stripe instance uses the default US keys, even though I'm updating the country and everywhere else; so Canadian transactions are erroring out as no such payment_intent, because the post for the payment is being made to the US key.
๐
gotcha so yes you need to reload Stripe.js entirely with the new key
or you could initialize it twice and have to instances in memory, one for US and one for Canada
yes, precisely. But the odd thing is that the way i have it set up, I think that it's initializing with the second key. Like the second key should be clobbering the first key; but it doesn't.
I call a setupStripe function which initializes stripe and saves it; but does that not work if I try to initialize with new keys to the same name?
sory I keep missing your answers
what does "I call a setupStripe function" mean?
do you have more details and exact code? Can you step into your code and figure out what is called in what order?
Can you defer initializing Stripe until after you know the country?
That's a thought. There's a drop down that doesn't really go away once ppl have made a selection.
If they choose US, and start filling out the stripe elements, then they realize they want CA, they go back up and reselect.
setupStripe function calls our data store in Drupal for public and secret keys, then runs loadStripe and updates the store with the stripe instance.
So, cannot really defer initializing the Stripe under these UI constraints. Possibly could think about reorganiziing the UI; but I kinda like your idea of putting two separate stripe instances in the store under different varnames, and then just using the one they pick; or even setting them both up before any country choosing is done, then just adding elements to the one for the country they pick.
I actually have to run and catch dinner; but will check back and i really really appreciate your help!