user3703539
user3703539

Reputation: 437

Stripe NodeJS create cutomer in multiple account

I use stripe-node, I have two account in my stripe dashboard with different secret and publishable key api. When I register my customer, i want to do this simultaneously in both accounts ?

After that my customer will have to select the destination account (in a select drop down) with a new amount to charge the specific account.

What is the best and simple workflow to do that ? Is it mandatory to use stripe Connect ?

Upvotes: 1

Views: 419

Answers (1)

Ywain
Ywain

Reputation: 17503

Yes, you should use Connect for this.

What you'd need to do is register one of your accounts as a Connect platform, then connect the other account to the platform using the OAuth flow.

You would then be able to collect your customers' card information (using Checkout or Elements) with your platform's publishable key, and use the resulting card tokens to create customers on the platform's account.

Then, when you need to charge a customer:

  • if you want to charge the customer on the platform's account: simply create a charge using the customer's ID

  • if you want to charge the customer on the other account: first share the customer with the connected account, then create a charge on the connected account (using the Stripe-Account header) with the new token

    You can also share the customer then use the new token to create a customer on the connected account, but keep in mind that even though the new customer object (on the connected account) will be independent of the original customer object (on the platform's account). If you update one, you'd need to manually update the other if you want them to stay in sync.

Upvotes: 1

Related Questions