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 676 forks source link

Add support for Embeddable Pricing Tables #1622

Closed scalaxofaiur closed 3 months ago

scalaxofaiur commented 10 months ago

Hello i found that Cashier currently doesn't work with Embeddable Pricing Tables

https://stripe.com/docs/payments/checkout/pricing-table

Currently, when the user creates a subscription with pricing tables, Stripe creates a new customer.

Customer.subscription.created webhook doesn't seem to be able to connect the new customer to laravel user.

Stripe gives the chance to attach a "client-reference-id" that could be used to pass the authenticated user id (or better an encrypted string that identify the user) back to cashier with checkout.session.completed webhook

https://stripe.com/docs/payments/checkout/pricing-table#track-subscriptions

driesvints commented 10 months ago

Please see https://github.com/laravel/cashier-stripe/issues/1590

driesvints commented 10 months ago

Ah sorry that's something else. I'll have a look.

driesvints commented 10 months ago

Right now I don't see an immediate way to make this work with Cashier. We solely rely on the customer.subscription.created and/or customer.subscription.updated webhooks to create the subscription and attach it to the user. There doesn't seems to be a way to let checkout attach this client_reference_id to the subscription as well. Therefor, from what I can tell, this isn't possible.

I don't have the time at the moment to deep dive into this to find workarounds but would appreciate PR's or other insights if there are any. Thanks

scalaxofaiur commented 10 months ago

Thanks @driesvints, at the moment i decided to avoid using Embeddable Pricing Tables and have implemented one on my own by reading products data directly from Cashier facade.

Should i have more updates i will surely write them here.

Thanks.

driesvints commented 3 months ago

Going to close this one as it's not likely this can be resolved.