Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paymentMethods() is hard coded to type 'card' #1569

Closed
quantumwebco opened this issue Sep 17, 2023 · 3 comments
Closed

paymentMethods() is hard coded to type 'card' #1569

quantumwebco opened this issue Sep 17, 2023 · 3 comments

Comments

@quantumwebco
Copy link
Contributor

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 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()

@quantumwebco quantumwebco changed the title Payment methods is hard coded to type 'card' paymentMethods() is hard coded to type 'card' Sep 17, 2023
@driesvints
Copy link
Member

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.

@quantumwebco
Copy link
Contributor Author

Yeah, I thought adding more methods was a poor solution. OK, I'll do that and PR to 15 :)

@driesvints
Copy link
Member

This will be in the next major release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants