Skip to content

Instantly share code, notes, and snippets.

@studio-fars-company
Last active June 27, 2018 04:20
Show Gist options
  • Save studio-fars-company/6a4932429df45f659d05925696030827 to your computer and use it in GitHub Desktop.
Save studio-fars-company/6a4932429df45f659d05925696030827 to your computer and use it in GitHub Desktop.
public function index()
{
return view('home');
}
public function subscribe_process(Request $request)
{
try {
Stripe::setApiKey(env('STRIPE_SECRET'));
$id = Auth::id();//user_id取得
$user = User::find($id);
$user->newSubscription('main', 'Stripeで作成されたプランID')->create($request->stripeToken);
return back();
} catch (\Exception $ex) {
return $ex->getMessage();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment