Stripe Setup
Setup a Stripe Account
- Go to Stripe website and sign up for an account.
- Create a new product in the Stripe dashboard.
- Create a webhook in the Stripe dashboard.
- Obtain your API keys (publishable and secret keys). Open the
.env.local
file in the code editor on the right to view the necessary variables:STRIPE_SECRET_KEY
andSTRIPE_WEBHOOK_SECRET
.
Create Checkout
To customize the checkout session, you can modify the file app/api/stripe/create-checkout/route.ts
. For example you can change the ui_mode
from “hosted” to “embedded” to use the embedded checkout flow.
Create Customer Portal
To customize the checkout session, you can modify the file app/actions/get-customer-portal.ts
. For example you can change the ui_mode
from “hosted” to “embedded” to use the embedded checkout flow.
NOTE: You can use server actions or API endpoints to create a checkout/customer portal session. It is up to you.