laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.38k stars 679 forks source link

defaultPaymentMethod() does not return the customer's default payment method #933

Closed connecteev closed 4 years ago

connecteev commented 4 years ago

Description:

Steps To Reproduce:

I've been looking high and low for a function to get the default payment method, but couldnt find one. I stumbled upon $User->defaultPaymentMethod() by reading through the source code....unfortunately it doesn't return the user's default payment method, eventhough I have it set in stripe. How can I get the defaultPaymentMethod?

Update:

I found a roundabout way to do it after looking through the cashier source:

$stripeCustomer = $loggedinUser->createOrGetStripeCustomer();
$default_payment_method = $stripeCustomer->invoice_settings->default_payment_method;
return response()->json($default_payment_method);

which returns a value like "pm_0GhRNwEXGF9cqh5pMGhu331p"

Unless I'm missing something, there seems to be a bug: calling $loggedinUser->defaultPaymentMethod() doesn't return the same value.

driesvints commented 4 years ago

Why wouldn't this be a default payment method? Let's continue this discussion on Discord.

slower1337 commented 4 years ago

Noooooo....