#Tomato - React
1 messages · Page 1 of 1 (latest)
Yea
?
Ow, sorry. After first API call
What is the first API call?
Ideally you want to only initialize one instance of Stripe.js per customer session and you want to do it as soon as possible.
I think it is not my case.
- When user is not authenticated - we must use stripe instance by country selected by user
- If user authenticated - then we use stripe instance by user country.
- BUT on payment page - we must use stripe instance based on payment page owner's country
I try to understand how then to use "useStripe"
Can you describe how your customer is intended to proceed through your app? It's really not clear to me what you know when and what your considerations are.
We use Stripe Connect
To simplify:
We have buyers and sellers. Seller also could be a buyer. We have payment pages of a seller.
It doesn't matter from which country buyer is.
Seller could change own account with stripe key based on him country.
When anybody go to payment page - we decide which key using based on seller country
As i understand stripe react does not respond our requirements, isn't it?
What kind of Connect integration is it? What are the account types?
Sellers are Connected stripe accounts
So when we create seller - we create custom stripe connected account
No, but it does not matter
We use separate charges and transfers
So could we use two instance of stripe with stripe react?
And how we can do it?
Yes it does matter. It matters a great deal.
With separate charge and transfers all the charge records are stored on the Platform account. This means you need to use the Platform publishable key when initializing Stripe.js
Yea, and i have now - two stripe publishable keys
So you have 2 platform accounts?
Yea
Are you using the Elements provider in your app?
https://stripe.com/docs/stripe-js/react#elements-provider
The useStripe hook returns the initialized Stripe instance but it doesn't allow you to initialize a new one AFAIK.
It is explicitly designed to ensure you use the same Stripe.js instance anywhere in your app
Ok, thank u!!!
I'm not familiar with larger React apps but it seems like you'd need to identify which account to use right when the App starts and make sure to initialize Stripe in the ElementsProvider with the correct key.
Yea, thank you)