I'm using Laravel's Cashier to handle my subscription plans on Laravel 5.1. Every time I change the user's card with
$user->updateCard($stripeToken);
a new customer is generated on Stripe, with a new card, new id but same e-mail, when in reality it should just update a customer's card. I've looked in the documentation but didn't find what could be wrong. Could someone help?
The only thing I could see that might be a possible problem is that you might be calling the method on the wrong instance. Maybe you need to do something like this?
$user->subscription()->updateCard($stripeToken);
Also, make sure that the $user
object you're calling it on is the user you are expecting.
Here is what my method looks like when the user updates their CC details.
protected function updateCreditCard($creditCardToken){
$company = Auth::user()->company;
// subscription() is a StripeGateway object.
$company->subscription()->updateCard($creditCardToken);
}