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
I think your problem may be the create method. Try this:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Plan;
class SubscriptionController extends Controller {
public function create(Request $request, Plan $plan) {
$plan = Plan::findOrFail($request->get('plan'));
\Auth::user() //make sure your user is signed in and use the authenticated user
->newSubscription('main', $request->plan) //You just send the name of the subscription in Stripe, not the object
->create($request->stripeToken);
return redirect()->route('home')->with('success', 'Your plan subscribed successfully');
}
I think your problem is because you were using an invalid user and / or because you're sending a plan object instead of the payment plan's name. For example, if you have a product named Main in Stripe with pricing plans called "Plan 1" and "Plan 2", to subscribe your authenticated user, you'd do this:
\Auth::user
->newSubscription('Main', 'Plan 1')
->create($request->stripeToken);
And your Stripe Product should look something like this: