Stripe

Learn how to use Stripe with Supersaas

Setting up Stripe

  1. Make sure to have a Stripe account before you start. You can create a free account here.
  2. Create a new stripe store/account and get your API keys from the dashboard - https://dashboard.stripe.com/test/developers
  3. Head back to your editor and add the following keys to your .env file
.env
STRIPE_SECRET_KEY=sk_test_1234567890
STRIPE_PUBLIC_KEY=pk_test_1234567890
STRIPE_WEBHOOK_SECRET=whsec_1234567890

Create products

You need to create products in Stripe before you can use them in with supersaas.

Stripe products

  1. Head over to https://dashboard.stripe.com/products and create a new product.
  2. Enter the name of the product, set the price, and add a description.
  3. Set the billing period to monthly or yearly (or whatever you prefer).
  4. If you want to provide a Yearly plan, then create two variants for the product. One for the yearly plan and one for the monthly plan.

Stripe product details

More information on how to create products can be found here.

Webhook

A stripe webhook will be triggered when a payment is made. We will need to set up a webhook in stripe to handle payment subscriptions. So let's create a webhook endpoint in Stripe dashboard https://dashboard.stripe.com/test/webhooks.

  1. Head over to https://dashboard.stripe.com/test/webhooks and create a new webhook.
  2. Set the URL to your https://your-domain.com/api/payment/webhook/stripe
  3. Choose the below events
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
  4. Click on save.