LoginSignup
2
1

Next.jsとstripeで決済機能を実装しよう!①環境構築編

Posted at

概要

Next.js(App routor)と決済サービスのstripeを使って簡単な決済機能を実装する流れを数回に分けて書いていきます!

stripeのアカウントの作成

Next.jsの環境構築

Next.jsのプロジェクトを作成

npx create-next-app@latest

npm run devコマンドを実行すると上記で作成したnext.jsのプロジェクトがローカル上で起動します。

npm run dev

stripe用のライブラリをインストール

npm install stripe

シークレットキーの設定

stripeの管理画面に記載してあるシークレットキーをenv.localに記載

シークレットキーの記載場所

stripeの管理画面の右上の「開発者」をクリック
ホーム_–hipokuratesu_business_site–Stripe__テスト.png

「APIキー」タブに記載
開発者_–hipokuratesu_business_site–Stripe__テスト.png

env.local
STRIPE_SECRET_KEY='ここに上記のシークレットキーを記載'

※stripeの管理画面ではテスト環境で実施した方が良いかと思います。

次回は実際にコードを書いていきますのでお楽しみに!

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1