Skip to main content

Payment Setup

This document provides an overview of setting up payments in your project using Stripe and LemonSqueezy. We'll cover the necessary environment variables, the steps to set up accounts, and where to configure them in your project.

Stripe Payment Setup

To set up payments using Stripe, follow these steps:

Setup

  1. Create a Stripe Account:

    • Go to Stripe and sign up for an account.
  2. Obtain API Keys:

    • In your Stripe Dashboard, navigate to the API section.
    • Copy your Publishable Key and Secret Key. You'll need these for the environment variables.
  3. Configure Webhooks:

    • In the Stripe Dashboard, go to the Webhooks section and create a new endpoint.
    • Set the endpoint URL to your webhook handler, e.g., https://yourdomain.com/api/stripe/webhook.
    • Select the events you want to listen to, such as checkout.session.completed.
  4. Add your API keys and webhook secret to .env.local:

    • Rename .env.example to .env.local if you haven't already.
    • Add your Stripe API keys and webhook secret to the environment variables:
    NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=<your_stripe_publishable_key>
    STRIPE_SECRET_KEY=<your_stripe_secret_key>
    STRIPE_WEBHOOK_SECRET=<your_stripe_webhook_secret>

Using Stripe in Your Project

Configure Stripe to handle payments as per the Stripe documentation.

Tip: Regularly test your Stripe integration using test keys and the Stripe CLI to ensure everything is working correctly.

Tip: Regularly check for updates and best practices in the Stripe documentation and the LemonSqueezy documentation to keep your integration secure and efficient.