laravelstripe-paymentssubscriptionlaravel-cashier

Using a single payment method ID between multiple customers in Stripe - Laravel Cashier


I have an application with two subscriber levels (company and reader). Person A has already subscribed as a company. He wants to Add person B as a reader subscriber.

Is there a way I can use the same payment method id Person A used in Stripe for the company to subscribe the Person B as a reader? When I try this, I get an error.

The payment method you provided has already been attached to a customer.

Sample code

$user = User::where('id', 26)->first();
$user->subscription('company')->incrementQuantity(1);
$paymethod = $user->defaultPaymentMethod();

$id = 28;
$user2 = User::where('id', $id)->first();
$user2->newSubscription('reader', 'price_xxx')->create($paymethod->id);

Solution

  • A payment method can only be attached to a single customer. Either the subscription need to belong to the same customer also (and can then use the same payment method), or you'll need to collect the payment method again for a separate customer.