Database Driver & Version: mysql Ver 14.14 Distrib 5.7.24
Description:
When Billable::updateDefaultPaymentMethodFromStripe() has been called the Stripe customer returned has it's property default_source of type Stripe\Source that is passed as a parameter to Billable::fillSourceDetails($source). In that method the source is checked if instance of StripeCard or StripeBankAccount and because it's not one of this the card details will never be updated.
Steps To Reproduce:
Consider the case when the subscription is set to send invoice rather then charge automatically. In this scenario Stripe will send the invoice to the customer then he'll add his CC details and Stripe will issue an customer.updated event that should be handled at the webhook and add the CC details to the Billable model.
$customerId = 'cus_G7gjfeLOmIyK19';
/**
* @see \Laravel\Cashier\Http\Controllers\WebhookController::getUserByStripeId()
*/
$model = config('cashier.model');
$billable = (new $model)->where('stripe_id', $customerId)->first();
if (!$billable) {
$billable = Spark::team()->where('stripe_id', $customerId)->first();
}
if ($billable) {
$billable->updateDefaultPaymentMethodFromStripe();
}
Hey @aginev. We unfortunately don't support the old sources API anymore. Cashier makes use of the new Payment Methods API. If you have a specific issue with Spark, please contact Spark support.
Description:
When
Billable::updateDefaultPaymentMethodFromStripe()
has been called the Stripe customer returned has it's propertydefault_source
of typeStripe\Source
that is passed as a parameter toBillable::fillSourceDetails($source)
. In that method thesource
is checked if instance ofStripeCard
orStripeBankAccount
and because it's not one of this the card details will never be updated.Steps To Reproduce:
Consider the case when the subscription is set to send invoice rather then charge automatically. In this scenario Stripe will send the invoice to the customer then he'll add his CC details and Stripe will issue an
customer.updated
event that should be handled at the webhook and add the CC details to theBillable
model.Hope it's clear enough
Regards