Stripe
Configure stripe with a single click
Usage
Setup Stripe Keys
- Visit your stripe dashboard.
- On your dashboard, you should be able to copy the live Publishable key and Secret key.
- Toggle "test mode", and copy the test Publishable key and Secret key.
- Copy both the live and test keys into your
.env.local
file as follows:
Create a Product
- Visit the products section of stripe and create your first product.
- Once created, click on your product, and click the three dots under the Pricing section to Copy price ID.
- Inside your project, go to
src/lib/stripe.ts
and paste your price ID here:
Configure Webhooks
- Follow these instructions to setup and log in to the Stripe CLI
- Now run the following command in your terminal:
- Copy the Signing Secret that appears in your terminal window into your
.env.local
file:
- Visit the stripe webhooks page and select "Add endpoint"
- Set your production domain name as the endpoint URL appended with
/api/webhooks/stripe
:
E.g. https://example.com/api/webhooks/stripe
- Copy the Signing Secret into
.env.local
:
- Here is how the final
.env.local
file should look:
Bonus Features
Seamless switching between live mode and test mode
Demo components for subscriptions and one-time payments