I followed this tutorial step by step: https://appdividend.com/2018/12/05/laravel-stripe-payment-gateway-integration-tutorial-with-example/
However, when I go to tes
Solved for Laravel 5.8 and Cashier 10.2
PlanController:
public function show(\App\Plan $plan, Request $request)
{
$paymentMethods = $request->user()->paymentMethods();
$intent = $request->user()->createSetupIntent();
return view('plans.show', compact('plan', 'intent'));
}
View:
...
SubscriptionController
public function create(Request $request, \App\Plan $plan)
{
$plan = \App\Plan::findOrFail($request->get('plan'));
$user = $request->user();
$paymentMethod = $request->paymentMethod;
$user->createOrGetStripeCustomer();
$user->updateDefaultPaymentMethod($paymentMethod);
$user
->newSubscription('main', $plan->stripe_plan)
->trialDays(7)
->create($paymentMethod, [
'email' => $user->email,
]);
return redirect()->route('home')->with('status', 'Your plan subscribed successfully');
}