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?