Implemented Stripe Api + Webhook On Both Next Js Api And Express Api - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Implemented Stripe Api + Webhook On Both Next Js Api And Express Api (526 Views)
| Implemented Stripe Api + Webhook On Both Next Js Api And Express Api by SqueezedPant(op): 9:09pm On Sep 04, 2023 |
I implemented stripe API + webhooks (listened to events and sent the transaction session ID to the database ) did subscription based services rhat would expire after one month and stop access. Did it on both Express JS and next JS API (serverless) , if you are having problem implementating with either tech , you can comment and i would be willing to help |
| Re: Implemented Stripe Api + Webhook On Both Next Js Api And Express Api by Mayowadre(m): 5:41pm On Sep 05, 2023 |
Nice work. Though your implementation is a bit confusing. So how would the payment system be handled on the UI, Stripe Checkout, Stripe Charge, Payment Intent (PaymentElement) or the hacky Payment Link. Secondly, why did you decide to go for serverless? |
| Re: Implemented Stripe Api + Webhook On Both Next Js Api And Express Api by SqueezedPant(op): 5:45pm On Sep 13, 2023 |
Mayowadre:Okay , sorry i have not replied early been busy with my teaching work Okay first is to get the stripe secret key from the dashboard , then set up a function in the cart component that listens to an event click , i pass in an id , quantity , price and other necessary data as the body data then after , i await the stripe checkout session and also expect a stripe session ID to be returned In the backened i recieve the customer name , payment method and line items data from the frontend and also set up a success url or failure url I create another file to listen to events called stripe webhooks , it listens to the various events happening during the stripe checkout session then i plug in my postgres adapter to it to send a confirmation status when the payment becomes successful back to the database and also the session ID so service gets discontinued incase the subscription expires |
| Re: Implemented Stripe Api + Webhook On Both Next Js Api And Express Api by SqueezedPant(op): 5:46pm On Sep 13, 2023 |
The reason why I implemented server actions (not serverless) my mistake was because i wanted a situation that would make everything become faster. With next js 13 server actions , you can write all your whole logic in the server without worrying about it coming to hydrate in the clients , so i tried and it was fast. All in all , React server component is a beast |
Fetch Data From An API And Display In Flatlist In React Native • Api And Programming Expert, I Need Your Help On Whatsapp Api • Build A Subscription Based Website Using Paystack Subscription API And Asp.net • 2 • 3 • 4