A developer updates a reservation service to support Stripe Checkout sessions. The process involves modifying database schemas to track payment statuses, creating asynchronous payment flows, and testing the integration with Postman and the Stripe dashboard to ensure end-to-end functionality.
Length 16:00
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #stripe #checkout #payments #nodejs #typescript #webhooks #api #backend #coding #software
0:00 All right, so now we're ready to actually enhance the 0:02 reservation service to 0:03 use our new checkout session functionality in payments. 0:08 The first thing that we're gonna do is actually update our reservation schema 0:12 that 0:12 we're storing in the database with some extra properties. 0:15 So now I actually wanna store the raw amount 0:19 directly on the reservation. 0:22 So we're gonna store the raw amount. 0:24 We're also gonna store the 0:28 checkout session ID, 0:31 which again is gonna allow us to correlate this reservation back 0:35 to the underlying payment in Stripe. 0:37 And importantly, this is optional in case we do not have the 0:40 checkout session 0:41 flow. The amount we are gonna persist regardless of the flow 0:45 we're gonna be 0:45 using. 0:47 And finally, the last property I want to maintain is 0:51 actually what we're gonna call the reservation status. 0:54 Now, before when we provided the credit card 0:57 details directly, 0:59 we 1:00 sort of synchronously processed the payment at once. 1:03 So we know if the request succeeded, we know the payment succeeded. 1:07 So we didn't have to track the payment or reservation status. 1:11 But now in this case, we have sort of an asynchronous flow with 1:15 the 1:15 checkout session where a reservation can be created in 1:19 sort of a pending state. And it's not until the user actually 1:22 completes the 1:23 checkout session flow and we receive that event back through a webhook, 1:27 do we actually then transition the reservation to be completed. 1:31 And so we wanna track that status at all times so we 1:35 know the state of the reservation, whether or not it's been paid 1:39 for. And so for this, I'm gonna export a new type, the 1:43 reservation status, which is gonna be of type pending, 1:47 confirmed, 1:50 or canceled. So these will be the different states 1:53 that we can be in 1:53 depending on the payment status. To use this, we will
The rest of the transcript is for members.
Sign in