You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the method $user->paymentMethods() there is an argument for type, this is hard coded to 'card'.
Stripe offers a fair few options beyond just cards, for example PayPal.
When checking if a user has a default payment method I now have to loop through each possible option for type to see if they have any of them, rather than just returning all the customers payment methods.
If the type parameter was omitted it would just return all payment methods attached to the customer. But as it's hard coded there is no way to unset it. Stripe throws an error if you pass an empty string or null etc.
To avoid breaking changes I thought adding a method hasAnyPaymentMethod() to check if any payment method at all exists and maybe an allPaymentMethods() method to get all payment methods not restricted to cards
Does anyone have any thoughts about this?
Steps To Reproduce
Call $user->paymentMethods()
The text was updated successfully, but these errors were encountered:
quantumwebco
changed the title
Payment methods is hard coded to type 'card'
paymentMethods() is hard coded to type 'card'
Sep 17, 2023
Yeah we definitely need to remove that hardcoded type at some point. Actually, Stripe only very recently added support in their API to fetch all payment methods at once without limiting by type. Before you always needed to pass one.
I'm a bit reluctant at introducing new methods now and cluttering up the API and would rather make the change in Cashier Stripe v15 to fetch all payment method types by default and thus changing the existing methods.
Cashier Stripe Version
14
Laravel Version
10
PHP Version
8.2
Database Driver & Version
Mariadb 10.4
Description
In the method
$user->paymentMethods()
there is an argument fortype
, this is hard coded to'card'
.Stripe offers a fair few options beyond just cards, for example PayPal.
When checking if a user has a default payment method I now have to loop through each possible option for type to see if they have any of them, rather than just returning all the customers payment methods.
If the
type
parameter was omitted it would just return all payment methods attached to the customer. But as it's hard coded there is no way to unset it. Stripe throws an error if you pass an empty string or null etc.To avoid breaking changes I thought adding a method
hasAnyPaymentMethod()
to check if any payment method at all exists and maybe anallPaymentMethods()
method to get all payment methods not restricted to cardsDoes anyone have any thoughts about this?
Steps To Reproduce
Call
$user->paymentMethods()
The text was updated successfully, but these errors were encountered: