The tutorial demonstrates how to configure Stripe webhooks for an ecommerce application. It covers installing the Stripe CLI, setting up local listeners, updating database schemas using Prisma, and implementing logic to handle checkout events, ultimately marking products as sold upon successful payment confirmation.
Length 15:01
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #stripe #webhooks #nestjs #prisma #checkout #cli #ecommerce #development #backend #database
0:01 All right. So next up, we want to configure our application so 0:04 that 0:05 after a user successfully completes their checkout experience 0:08 using our Stripe hosted checkout, and once the user 0:12 successfully pays and Stripe registers the payment to the 0:16 user's billing method here, we then want our store to 0:20 be notified that this payment has succeeded so that we can mark 0:24 the product here as sold and make sure we don't display it anymore 0:27 to 0:28 the user. Now, the recommended way to implement this 0:31 using Stripe 0:32 is to use webhooks. So we can configure a webhook on 0:36 Stripe to automatically call our pre-configured 0:39 API with the 0:42 Stripe event as soon as a successful payment completes. 0:46 We can then listen for that event on an API route and update our 0:50 product as soon as the payment successfully completes. 0:53 So this will be an asynchronous flow that will notify our 0:57 server once the payment has completed, and then we can take action to 1:01 update the product. Now we're going to implement this webhook 1:04 locally 1:05 and then also in production. To do this locally, we need to get 1:08 started with the Stripe CLI, which allows us to integrate our 1:12 Stripe webhook in our local development environment. 1:17 So go ahead and head to doc.stripe.com/stripe-cli. 1:21 I'll include the link below. And we wanna scroll down to install the 1:25 Stripe CLI. You can find the instructions for your 1:27 machine. 1:28 Go ahead and copy the command to install Stripe 1:32 CLI, and in a new terminal, paste this command 1:36 in so you install the Stripe CLI. In my case, I'm using 1:40 macOS, so I'll use Brew to install it. 1:43 All right, so now that I've installed it with Brew, 1:45 we should be able to run 1:46 Stripe and see that we have the commands here available for us. 1:51 Now back in the docs, we can see the next step
The rest of the transcript is for members.
Sign in