Cashier generating multiple customers with the same email I'm using cashier for my subscription plans. Every time I change the user's card with $user->updateCard($stripeToken); a new customer is generated on Stripe, with a new card but same e-mail, when in reality it should just update a customer's card. What could I be doing wrong?
This appears to be a coded bug in cashier. All my settings appear right.. Can anyone help?
Have you referred to docs?
Also show us your code and we can try and help.
Code is pretty simple, just a basic credit card update;
$user = \Auth::user();
$stripeToken = \Input::get('stripeToken');
$user->updateCard($stripeToken);
return 'ok';
Can you maybe post the updateCard() function here?
Sure, from cashier's billable class:
public function updateCard($token)
{
return $this->subscription()->updateCard($token);
}
And from Cashier's StripeGateway:
public function updateCard($token)
{
$customer = $this->getStripeCustomer();
$card = $customer->sources->create(['source' => $token]);
$customer->default_source = $card->id;
$customer->save();
$this->billable
->setLastFourCardDigits($this->getLastFourCardDigits($this->getStripeCustomer()))
->saveBillableInstance();
}
Ok, the error was that ajax was submitting the request to another route. After 2 days searching for this, I feel stupid. :(
Always something simple you've over looked, I do that on a regular basis, don't worry about it, just see it as a learning curve :)
Please sign in or create an account to participate in this conversation.