Docs
Payments
Payments
ZexaNext uses stripe for handling payments.
Setup
- Create and setup a Stripe account and activate payments.
- Checkout the following playlist by Stripe Developers for setting up payments for a SaaS application: Fundamentals of SaaS. Follow the first two video, create your products and get the price ids for the products.
- Add the Stripe public and private keys in the
.env
file for variablesSTRIPE_PUBLIC_KEY
andSTRIPE_SECRET_KEY
. - For testing webhooks, you can use Stripe CLI to forward webhook events.
Create Stripe Checkout
From the frontend, you can create a checkout session automatically using ButtonCheckout
for both one time and subscription payments.
Stripe Webhooks and Subscriptions
Stripe webhooks are used to listen to events that happen in your Stripe account and update the database accordingly. You can set boolean flag hasAccess
in the user table to true/false based on the subscription status.
You can add your business logic in @/api/webhook/stripe/route.ts
API route to handle events.