Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,574 members, 7,820,061 topics. Date: Tuesday, 07 May 2024 at 09:12 AM

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 (291 Views)

Api And Programming Expert, I Need Your Help On Whatsapp Api / Backend Dev With Node Js And Express Needed.remote Work / Accessing Workforce Integration Webhook Encrypted Resource (2) (3) (4)

(1) (Reply) (Go Down)

Implemented Stripe Api + Webhook On Both Next Js Api And Express Api by SqueezedPant: 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: 5:45pm On Sep 13, 2023
Mayowadre:
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?


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

1 Like

Re: Implemented Stripe Api + Webhook On Both Next Js Api And Express Api by SqueezedPant: 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

(1) (Reply)

What Are The Limitations Of Flutter Over Kotlin, Swift And Object C / Solve The Fizz - Buzz Hackerrank Challenge In Both Java And Javascript / Native Mobile Development Dieing Or What!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.