laravel / cashier-stripe

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

Support for upcoming changes to Stripe Prefilling saved cards in Checkout #1671

Closed mrpritchett closed 3 months ago

mrpritchett commented 3 months ago

On May 1, 2024, Stripe is changing how cards saved during checkout are going to be made available during checkout for future purchases. It looks like a few new checkout session options are going to be made available to ensure compatibility with current systems.

Is there any way we can get support these things in Cashier? I apologize is this isn't the right forum for this kind of request. Spent about 15 minutes trying to decide which "bucket" it belonged in.

https://support.stripe.com/questions/prefilling-saved-cards-in-checkout

driesvints commented 3 months ago

Thanks for proposing this! I think we can do something here yeah. I'm seeing this as a new HandlesPaymentMethods concern trait which can be placed on the CheckoutBuilder, SubscriptionBuilder and PerformsCharges trait. This can then keep two properties, one for https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-saved_payment_method_options-allow_redisplay_filters and one for https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-saved_payment_method_options-payment_method_save

Then, these could be set by different methods like allowSavingPaymentMethod, disableSavingPaymentMethod, alwaysRedisplayPaymentMethod, limitRedisplayPaymentMethod, etc.

Lastly, these can then be wired up through the __construct of the CheckoutBuilder.

Would love a PR for this!

mrpritchett commented 3 months ago

I'm snowed under today and tomorrow, but will try my best to send in a PR Wednesday.

driesvints commented 3 months ago

Gonna close this now but feel free to send in a PR if you want.