#Tomato - React

1 messages · Page 1 of 1 (latest)

slate rose
#

HI 👋

#

When in your apps' flow do you know the user's country?

jolly plinth
#

Yea

slate rose
#

?

jolly plinth
#

Ow, sorry. After first API call

slate rose
#

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.

jolly plinth
#

I think it is not my case.

  1. When user is not authenticated - we must use stripe instance by country selected by user
  2. If user authenticated - then we use stripe instance by user country.
  3. 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"

slate rose
#

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.

jolly plinth
#

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?

slate rose
#

What kind of Connect integration is it? What are the account types?

jolly plinth
#

Sellers are Connected stripe accounts

#

So when we create seller - we create custom stripe connected account

slate rose
#

Okay so Custom account types. And are you using Destination charges?

jolly plinth
#

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?

slate rose
#

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

jolly plinth
#

Yea, and i have now - two stripe publishable keys

slate rose
#

So you have 2 platform accounts?

jolly plinth
#

Yea

slate rose
jolly plinth
#

Yea

#

Does that mean that i could not use useStripe hook?

slate rose
#

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

jolly plinth
#

Ok, thank u!!!

slate rose
#

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.

jolly plinth
#

Yea, thank you)