Login
Docs
Payments

Payments

ZexaNext uses stripe for handling payments.

Setup

  1. Create and setup a Stripe account and activate payments.
  2. 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.
  3. Add the Stripe public and private keys in the .env file for variables STRIPE_PUBLIC_KEY and STRIPE_SECRET_KEY.
  4. 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.