Payments with Stripe

Here you will learn about how to set up your payments with Stripe. Good news: most of the code is fully ready!

Step 1: create your Stripe account

In order to start, you need to create a Stripe account. You can do that here.

Step 2: get the API keys

After you have created a project, you need to get the API keys and fill in the `.env` file in the root of the project.

terminal

The `PRIVATE_STRIPE_WEBHOOK_SECRET` is used to verify the webhook events from Stripe. In production, you can get it from the Stripe dashboard. In development, you can use the Stripe CLI and run the `stripe listen --forward-to localhost:3000/api/webhooks` command to get the temporary development secret.

Step 3: create your products

Create your products with titles, descriptions, images and prices on Stripe.

Then, get the product IDs for each of the product and create your own custom pricing page based on one of the provided templates in `/src/lib/components/page/pricing`.

Take a look at the `/routes/payment` route to see how the payments are handled and how you can integrate them into your own project.