For some applications, it's useful to reuse your customers' payment information across your connected accounts. For example, a customer who makes a purchase from one of your connected sellers wouldn't need to re-enter their credit card details to purchase from another seller.
With Stripe Connect, this is possible by storing all Stripe customer objects on the application owner's account. Whenever you'd like to reuse customer payment information, you'll make an extra token creation API request to fetch the relevant data from Stripe.
Storing Stripe customers
Normally, without shared customers, you would save the Stripe customer objects on each individual Stripe account. To share customers, you'll instead save the customers on your (the application owner) Stripe account.
Be sure to use your own secret and publishable keys instead of the OAuth
stripe_publishable_key you get back for your user in the connect flow. You want to save the customer objects on your own Stripe account, not on your users' accounts.
Charging a customer
When you're ready to charge a saved customer, you'll need:
access_tokenfor the Stripe user you're making the charge for
- The customer ID (it looks something like
cus_EkOpRziPz9ROyaCx) of the customer you're charging. Note that the customer object must be stored on the application owner's Stripe account.
- The card ID for that customer, if you want to charge a specific card rather than the default.
Make a create token API request, passing in the customer ID (and optionally, the card ID):
Like a regular token creation, this returns a token that acts as a credit card number. You can use the token to create a one-time charge or even save the customer (again) to your user's account.