Cashier-stripe: Stripe Checkout

Created on 11 Apr 2019  路  15Comments  路  Source: laravel/cashier-stripe

The new Stripe Checkout product provides an easy for to get started with payments without having to do a manual setup. The trade-off is that the payment process is completely styled and moved over to Stripe.

~We'll only implement this in v10 if it gets a stable release soon. Otherwise can pick this up later.~ Checkout is out of beta so it'll probably make it into the new release.

https://stripe.com/docs/payments/checkout

enhancement

Most helpful comment

FYI, we've started working on this again: https://github.com/laravel/cashier-stripe/pull/1007

All 15 comments

Thanks. Do you plan to implement this feature before September 14? As from that date, Cashier would not be available for a business based in the EEA, without this feature.

@aldovincenti we're aware and it's the whole reason we're now working on v10. See the milestone: https://github.com/laravel/cashier/milestone/1

If Checkout gets a stable release soon it'll probably make it into v10 and otherwise before September.

Checkout is out of beta so it'll probably make it into the new release.

Since Stripe still hasn't updated their API with the necessary changes in order to let this move forward we're taking this out of the next release. We'll have to wait and see when Stripe makes the necessary changes listed in the PR.

Is there a way for me to begin using Stripe Checkout with Laravel Cashier currently? It would save me a lot of time worrying about building an on-site form, handling the 3D secure stuff, etc.

You can quite easily redirect to the Stripe Checkout - it just appears there's just no webhook set for "checkout.session.completed" - is there a lot more that needs to be added?

It seems that perhaps if I added my own webhook for "checkout.session.completed" I would be able to then call something like _$user->newSubscription('main', 'premium')->create($token);_ - currently when I use the Stripe Checkout, it returns to the success_url as I define it, but no subscription is added.

I'd appreciate any help here. If I need to simply not use checkout then I suppose I have no choice, but it would be great...

@NeoMarine No. Please see the concerns on the WIP PR for Checkout in Cashier on why Checkout is currently incompatible with Cashier: https://github.com/laravel/cashier/pull/652

PR was closed for now. We can later pick up the work from the closed PR.

Any chance this will ship in v12?

At the moment we have no plans to work on this ourselves but we're still open to PRs.

I managed to get Checkout _kind of_ working with Cashier (as in, it has been in production for months and it works, but I'm not 100% confident it works cause you never know). Here's a very short guide:

https://miguelpiedrafita.com/snippets/stripeCheckout/

FYI, we've started working on this again: https://github.com/laravel/cashier-stripe/pull/1007

 public function succes(Request $request)
    {
        $session_id = $request->input('session_id');
        $stripe = new \Stripe\StripeClient(
            env("STRIPE_SECRET")
        );
        $session  = $stripe->checkout->sessions->retrieve(
            $session_id,
            []
        );
        $subscription  = $stripe->subscriptions->retrieve(
            $session['subscription'],
            []
        );
        //dump($user->subscription);
        //dump($subscription);
       // dd($session);
        $user = User::findOrFail($session['client_reference_id']);
        $user->newSubscription(
            'default', $subscription['plan']['id']
        )->create($subscription['default_payment_method']);
        //dump($user->subscriptions);
        return view('billing.succes');
    }

This is how I got it to work.
Setting my
'success_url' => url('/billing/succes?session_id={CHECKOUT_SESSION_ID}'),

@mellester how are you preventing duplicate subscriptions in the stipe dashboard? I'm using checkout and added your success function but what happens is it creates a second subscription entry in stripe for the customer.

@blakekrone @mellester can you please use a support forum so we can focus the discussion here at the PR at hand?

Was this page helpful?
0 / 5 - 0 ratings