Creating an order in the database with Stripe webhooks - React and Node.js E-Commerce

Поделиться
HTML-код
  • Опубликовано: 7 авг 2024
  • НаукаНаука

Комментарии • 69

  • @JulioSCayo
    @JulioSCayo 7 месяцев назад

    Thank you very much bro, I had a lot of questions about how to handle the customers and orders data after the payment but didn't find out anywhere with an explanation of that process, you left it very clear for me :)

  • @chrisqiuu
    @chrisqiuu Год назад +1

    Thank you again sir! very helpful tutorial, it's a miracle I came right into your videos. You are a great teacher!

  • @teetanrobotics5363
    @teetanrobotics5363 2 года назад +7

    bro i see the effort you put in with the terminal, powershell, scoop, etc. I used to do this a long time back. Then I switched to Ubuntu (Linux distro). Trust me life is so much easier and would recommend you too. You won't regret it.

  • @supravatsarkar5866
    @supravatsarkar5866 Год назад +1

    Thank you so much bro for your effort. I am trying implement stripe payment with webhooks through stripe doc but I not properly understand that in last two day. Now your video clear my concept. ❤from India.

  • @UddhikaIshara
    @UddhikaIshara 10 месяцев назад

    Thank you very much! This was so helpful! Easy to understand! Thank you very much again! ❣

  • @toshitsingh7270
    @toshitsingh7270 Год назад +1

    Thank you soo much the videos, I was looking for integrating stripe to a website, it helped a lot. Quick tip for viewers it's ok for the tution purpose but in production check the product price in server side.

  • @ankitanand3324
    @ankitanand3324 Год назад

    Thank you for the content. I hope to see more amazing contents like this.

  • @feevah-fvwrldprod8792
    @feevah-fvwrldprod8792 Год назад

    You are a really good teacher. Thank you❤

  • @abrehamtilahun4820
    @abrehamtilahun4820 4 месяца назад +1

    Thank you, you help me a lot. please keep going.

  • @michaelrose1761
    @michaelrose1761 20 дней назад

    You are good bro. It is helpful thanks.

  • @informationhub7199
    @informationhub7199 6 месяцев назад

    thanks for your content bro..iam happy and subscribed

  • @SurajSingh-lu8ei
    @SurajSingh-lu8ei Год назад +1

    for an entire video I thought my right earphone is gone, then suddenly music played, LOL :)

  • @lennoxcharles6092
    @lennoxcharles6092 4 месяца назад

    Thanks for the Tutorial Charles

  • @alanye7542
    @alanye7542 Год назад

    Thank you so much!!!

  • @Manuevaral
    @Manuevaral 10 месяцев назад +1

    Exactly that's what i wantedddddddd....

  • @developedbynick
    @developedbynick 2 года назад +14

    The error occurred because you placed the route handler after calling a body parsing middleware. So to fix that, just cut it and paste it before calling a body parser.

    • @jacerchetoui709
      @jacerchetoui709 Год назад

      Thank you so much, you saved me!

    • @bilalahmed4455
      @bilalahmed4455 Год назад

      @@jacerchetoui709 where? tell me

    • @jeremyacton6378
      @jeremyacton6378 2 месяца назад

      you hero. I've been stuck for hours on this issue. you saved me!

  • @joeyywill1234
    @joeyywill1234 2 года назад

    greate video again!

  • @umairyatoo8490
    @umairyatoo8490 Год назад

    I have to integrate stripe in my application. Apart from the "checkout.session.completed" event, is there any other key event that I must need to handle and could you please elaborate the events a bit more, like which one is a must to handle.

  • @SonThai-cx6jt
    @SonThai-cx6jt 4 месяца назад

    Thank you so much

  • @vishalsolanki9234
    @vishalsolanki9234 Год назад

    if my stripe listener not in running mode at the the web hook endpoint run automatically by stripe?

  • @user-ex8tg3ii5l
    @user-ex8tg3ii5l Год назад

    Help please I have a problem with constructEvent it shows me an error No signatures found that match the expected signature for the payload. Are you forwarding the raw request body you received from Stripe? And I collected express.raw({ type: '*/*' })

  • @birdboy4774
    @birdboy4774 2 года назад +1

    Quick tip you should make your microphone on both left and right channels instead of just the left

  • @josephuzuegbu7431
    @josephuzuegbu7431 Год назад

    This is the best tutorial. Can i build a fintech app using stripe apis?

  • @vishwachandral5576
    @vishwachandral5576 Год назад +1

    could you please implement a frontend for the user order details

  • @funnysphere4669
    @funnysphere4669 11 месяцев назад

    Thanks

  • @barackouma2552
    @barackouma2552 9 месяцев назад

    you can try modifying this const body = request.rawBody.toString(); instead of parsing the whole request body then call the body in the event function instaed of req.body

  • @toothless.tarantula
    @toothless.tarantula Год назад

    Nice video, be aware that stripe metadata key value object has per key size limit, could be an issue for large amount of cart items use case.

    • @Dhanushsaji
      @Dhanushsaji Год назад

      Do you find any alternatives?

  • @neeraj_minhas
    @neeraj_minhas 10 месяцев назад

    Thank you for new earphones , After listening to your video i found one side of it not working , purchased new ❤ thanks

  • @tutoring-academy
    @tutoring-academy Год назад

    Hello, Thanks for amazing tutorial. Do you have github link for this project.?

  • @lucavera4737
    @lucavera4737 Год назад

    TE AMO

  • @Kris-to7vh
    @Kris-to7vh 11 месяцев назад +2

    15:20 I was able to verify the endpoint by adding these lines:
    app.use('/api/stripe/webhook', express.raw({ type: 'application/json' })); //

  • @devsuthar6795
    @devsuthar6795 4 месяца назад

    bro Thank you so much... Very good Detailed video and Easy To Understand 🫡

  • @katrinarossi1381
    @katrinarossi1381 9 месяцев назад

    Thank you for this video! I do have a question- how do we create orders from customers who are not logged in? Then we won't have a userId to pass to create a customer through Stripe. Thanks!

    • @listingmaster15
      @listingmaster15 8 месяцев назад

      So before checkout redirect user to login page so then you will always have user I'd

  • @Dhanushsaji
    @Dhanushsaji Год назад +1

    The size of the metadata is a problem..do you have any alternatives?

    • @devcaand
      @devcaand Год назад +1

      You can create a pending transaction on your backend, you need to specify transaction 'id' it could be uuid() and pass as many items as you want in there, really the limit at this point is your db. Then, you pass that 'transaction id' into your payment intent as metadata. When you receive your webhook with "checkout.session.completed", you parse that metadata and grab your transaction id from it. Then, run a function to update that transaction on your backend from pending to success. Likewise in case of error, you can delete that transaction or write a script which will be deleting all pending transactions once they are 1day old or something.
      That way you can avoid transferring cart items back and forth and dealing with 500 character limit.

  • @dharmeshgohil9375
    @dharmeshgohil9375 2 года назад

    Expecting login using gmail, facebook, Instagram using react

  • @engineermaxwel6732
    @engineermaxwel6732 2 года назад

    I have question this endpoint secret in webhook should be inside .env or its okay

    • @devcaand
      @devcaand Год назад

      if you deploying it live then better to keep it in the env. If you just playing around in your sandbox, do whatever you want

  • @harshiilllll
    @harshiilllll Год назад +1

    i get error if i add multiple products in my cart, error is that we can not add more than 500 characters in metadata, how do i handle that?

    • @ChaooCharles
      @ChaooCharles  Год назад

      Hey, proceed with the course the solutions to metadata I included in the React Dashboard video..

    • @ChaooCharles
      @ChaooCharles  Год назад

      Currently you can set the cart to be an empty array and order model at products you set it to just array without specifying the properties..

    • @harshiilllll
      @harshiilllll Год назад

      @@ChaooCharles cool! i'll check that video

  • @LordR123
    @LordR123 Год назад

    Someone have idea how to show customers orders?

  • @narayanthapa6609
    @narayanthapa6609 Год назад

    it throws error when i pass cartItems inside metadata while creating a customer.

    • @ChaooCharles
      @ChaooCharles  Год назад

      Yeah, pass an empty array.. in the next videos we are using an alternative

  • @Seedley
    @Seedley Год назад +1

    Can you post the source code?

  • @natnael-oqp5082
    @natnael-oqp5082 2 года назад

    mern stack app with typeScript nextjs graphql

  • @harshitpahuja7186
    @harshitpahuja7186 Год назад

    i am getting paymentIntentId null

  • @spacehuru1023
    @spacehuru1023 Год назад

    is there a way to collect global payments from Kenya as we cannot access stripe here?

  • @cowboyuniverse7258
    @cowboyuniverse7258 Год назад

    Do you not see? Read it “For local dev” …

  • @NCS8331
    @NCS8331 5 месяцев назад

    Do you all hear any sound?

  • @KristijanStosic
    @KristijanStosic 2 года назад

    Hi, I need some help with stripe payment, can I contact you privately somehow?

  • @simmypayyappillyvarghese4801
    @simmypayyappillyvarghese4801 Год назад

    I got the issue resolved by using the middleware app.use('/webhook', express.raw({type: '*/*'})) and removed the middleware from the post router

  • @big-jo89
    @big-jo89 2 года назад +9

    about the Webhook error i found this to be working for me :
    const payload = req.body;
    const payloadString = JSON.stringify(payload, null, 2);
    const header = stripe.webhooks.generateTestHeaderString({
    payload: payloadString,
    secret: ENDPOINT_SECRET as string,
    });
    let event;
    try {
    event = stripe.webhooks.constructEvent(payloadString, header, ENDPOINT_SECRET as string);
    console.log(`Webhook Verified: `, event);
    } catch (err) {
    console.log(`Webhook Error: ${(err as Error).message}`);
    res.status(400).send(`Webhook Error: ${(err as Error).message}`);
    return;
    }
    // Handle event types ....

    • @ChaooCharles
      @ChaooCharles  2 года назад +1

      Hey, thank you for sharing

    • @big-jo89
      @big-jo89 2 года назад

      @@ChaooCharles keep up the good work, you're doing great man

    • @DividendCompass
      @DividendCompass Год назад

      Nice one! This solved it for me, thank you

    • @yaaaayeet745
      @yaaaayeet745 8 месяцев назад

      thanks mate!