Development Mode

Create a webhook endpoint in your application to receive events from Stripe. This is necessary to handle events like payment success, failure, and refunds.

1

Activate Test Mode

Go to the Stripe dashboard and activate the test mode in the navbar. This will allow you to test the payment flow without charging real money.

Activate Test Mode
2

Create an Ngrok Tunnel

To receive webhooks from Stripe locally, you need to create an Ngrok tunnel. This will expose your local server to the internet and allow Stripe to send events to your application.

Install Ngrok by following the instructions on the Ngrok website

Run the following command in your terminal to create a tunnel:

ngrok http 3000

Replace 3000 with the port your application is running on.

3

Create Webhook

Go to the Stripe dashboard and create a webhook endpoint. It`s located in the Developers section

Create Local Stripe Webhook
4

Events

For one-time payments, you need to activate the checkout.session.completed event. This event is triggered when a payment is successful.

5

Ready to test your application

Your application is now ready to receive payment events from Stripe in the development mode.

Stripe CLI

Additionally to ngrok you could even install the Stripe CLI to listen to specific events in your terminal.

Just install the Stripe CLI and login to your account. After that you can run the following command to start listening to events:

npm run stripe:listen

Now you can see the events in your terminal when you trigger them in your application. For example, to trigger a payment success event, run the following command:

stripe trigger payment_intent.succeeded
Stripe CLI

Production Mode

Create a webhook endpoint in your application to receive events from Stripe. This is necessary to handle events like payment success, failure, and refunds.

1

Create Webhook

Go to the Stripe dashboard and create a webhook endpoint. It`s located in the Developers section

Stripe Webhooks
2

Events

For one-time payments, you need to activate the checkout.session.completed event. This event is triggered when a payment is successful.

3

Endpoint

Choose the “Webhook endpoint” in the “choose destination type” and fill in the the URL of your webhook endpoint.

4

Ready for Deployment

Your application is now ready to receive payment events from Stripe in the production mode.

Check out the Deployment section to learn how to deploy your application to production.