4

Problem Statement:

My Customers will have subscriptions with various publishers that have created their projects. I have to attach a customer to platform account and create a subscription which charges them behalf of the Connect custom accounts. So how can I make a shared customer and subscribe them to various subscriptions in a connect account.

Vishnu R
  • 108
  • 1
  • 10

1 Answers1

3

Once you have that customer on your platform account, you can share them with a connected account by first creating a one-time use token:

 $token = \Stripe\Token::create(array(
 "customer" => "cus_xxxx",
 ), array("stripe_account" => "{CONNECTED_STRIPE_ACCOUNT_ID}"));

Once you have this token, you could (a) use it to create a charge to that customer that lands directly in the connected account, but since you want to create a subscription you want to (b) use the token to copy the customer into the connected account and then create a subscription in that connected account for the copied customer. To copy a customer from platform to connected account you can do the following:

$copiedCustomer = \Stripe\Customer::create(array(
"description" => "Customer for xxx@xxx.com",
"source" => $token // obtained with Stripe.js
), array("stripe_account" => "{CONNECTED_STRIPE_ACCOUNT_ID}"));

This copied customer now has a new customer id in the connected account. Then you can setup the subscription on the connected account as follows:

\Stripe\Subscription::create(array(
"customer" => $copiedCustomer.id,
"plan" => "xxx"
), array("stripe_account" => "{CONNECTED_STRIPE_ACCOUNT_ID}"));

Step 3 here mentions the above method for creating subscriptions for shared customers (but doesn't show the example, their example is a one-off charge for shared customers) https://stripe.com/docs/connect/shared-customers

Travis Choma
  • 88
  • 1
  • 4
  • I did it in a different way. I first created customer on my platform account and then using the customer's credit card token i created another customer on the connected account. Plans were created on connected account and subscriptions with platform charges were created. Thanks @travis for your insight. – Vishnu R Jul 13 '17 at 11:52
  • 3
    Hi. How do you create plans on the connected account. I didn't found anything in the doc? – chemalarrea Feb 20 '18 at 11:06
  • 1
    All the api calls are the same , just add the extra parameter `stripe_account` array with the default api call. – Vishnu R Dec 16 '19 at 04:58