Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

neuralnet's avatar

Cashier: Subscription with Charge

I'm using Cashier with Stripe and I've set up subscriptions no problem. However, now I'm trying to setup a subscription AND a charge, what I want to do is charge an "upfront" fee of $50 then start subscribing the user at $20 a month after one month (30 days).

Here is my code for subscribing and charging:

try {
        $request->user()
            ->newSubscription('main', $plan->stripe_plan)
            ->trialDays(30)
            ->create($request->stripePayment, [
                'email' => $request->email,
                'name' => $request->name,
            ]);
        }
        catch (IncompletePayment $exception) {
            return redirect()->route(
                'cashier.payment',
                [$exception->payment->id, 'redirect' => route('home')]
            );
        }
        
        try {
            //charge 50 dollars upfront
            $request->user()->charge(5000, $request->stripePayment); 
        } catch (Exception $e) {
            //handle charge exception
           
        }

It works if I use a regular testing card (e.g. 4242 4242 4242 4242 ), however if I try to use a card with 3D Secure authentication (that requires extra verification) then I the following error

Exceptions\IncompletePayment
The payment attempt failed because additional action is required before it can be completed.

If I remove the charge and just keep the subscription the 3D Secure authentication works fine.

I'm not sure how to verify both the subscription and charge? Am I doing this right?

0 likes
2 replies
ammarax's avatar

you need to catch the "IncompletePayment $exception" as for newSubscription

try { $request->user() ->charge(5000, $request->stripePayment); } catch (IncompletePayment $exception) { return redirect()->route( 'cashier.payment', [$exception->payment->id, 'redirect' => route('home')] ); }

mrweb's avatar

I tried @ammarax solution but the route( 'cashier.payment') returns a 404 anyone knows why?

Please or to participate in this conversation.