Stripe Webhooks
HTML-код
- Опубликовано: 15 окт 2019
- Join us for our Developer Office Hours and get your questions about leveraging the awesome power of webhooks answered. CJ and Adrienne will walk you through how to setup an endpoint to accept webhook events reliably in Ruby. We'll cover some common tripping points, best practices, and using the CLI to test your endpoints.
Table of Contents
02:20 What is a Webhook?
06:20 Demo of what we'll build
07:00 Scaffold new Rails App
09:00 Add simple Checkout UI
13:10 Setup Webhook Route
15:25 Skip CSRF Check
16:00 Implement Webhook Controller Action
20:00 Save and process events later
26:07 Verify webhook signatures
34:07 Refactor webhook handling into service objects
39:14 Process events in background job
46:03 Using ngrok
53:22 Q&A
Resources
Official guides: stripe.com/docs/webhooks/build
Stripe CLI: github.com/stripe/stripe-cli
Code: github.com/stripe-samples/dev...
Support
If you have a question, please feel free to reach out to our support team on Discord at stripe.com/go/developer-chat.
Updates
Sign up to stay updated with developer news: go.stripe.global/dev-digest
Feedback
If you have any feedback about this or other episodes, let us know: forms.gle/VjNqzRhotM2snYo88.
#Stripe #Payments Наука
Fantastic video. I was looking for a recommended approach to handle incoming duplicate Stripe webhook events. Storing events in a DB, indexed by event_id and then checking for a duplicate event by event_id is exactly what I needed to know. Thank you, immensely helpful!
this video was really helpful, thank you :)
very helpful, thank you
OK. I'm totally lost. I just want to put a simple embedded form using stripe elements... Where is the visual "For Dummies" guide?
watching the replay as it was 2 Am here when it was live
Thank you for the lovely video. I was wondering if we can select webhooks to trigger an external application by mentioning the endpoint of the external system in the dashboard?
Thank you for taking the time to walk through all of this! Is there any chance of getting this implementation code in vanilla PHP? For those of us who have never used Ruby on Rails, it's not immediately apparent how to capture all of these best practices in that language. Thank you!
Great lecture and very helpful understanding some best practices for dealing with web hooks in rails. I'm really struggling to understand why there is no mention of the Stripe Event gem for rails in this talk though. If I use the stripe event gem does it mean I can skip the part about validating signatures in the web hook controller? I'm really getting confused by this. Is this approach that you show in the video preferable to using the stripe event gem?
Ok, here is what everyone needs to know. Use the top section in the stripe admin panel for your web hooks so you can receive data.
can we pass multiple objects for a particular event type?
hello CJ
how can i use stripe webhook for s2member plugin, em using custom forms not s2member pro forms. i've been searching it a lot couldn't find a way yet. please help
Hi CJ. That was awesome tks!! just a few questions: 1) Why do you log the endpoint response, in theory from the "sender" the only thing that need is the Http status. 2) What happend after retry the maximum times?, I assume the message is marked as failed, but will it keep in your database for ever? or after some days it'll delete? if so, will anyone know it was deleted? for example, before deleting, are they sent as an attachment in an email or something like that? ... Again thanks a lot
Great questions, David! \1 This was mostly just to demonstrate the return value, you can return an empty response body with a 200 status code if you'd like. \2 After a webhook is tried the maximum number of times and if the webhook endpoint has not had any successful deliveries the webhook endpoint will be disabled. The event will not be kept in our db forever. They are only available for a short time after. Hope that helps! Please feel free to reach out on IRC in the Freenode #stripe channel or support.stripe.com/contact for more info.
@@StripeDev Hello Stripe!! Very clear Thanks again.. Regards!!
holy molly I spend hours on the docs to figure out what the heck is a webhook and this lady just spent 3mins and everything is clear. Just wonder why you guys didn't paste those nice slides on your docs.
Vive la 🇫🇷 Adrienne Dreyfus
43:35 what is going on here? I dont know rails but its very strange that he is updating the state to "processed" after case argument. he expects to fail between the begin and end even though there is no error to catch. also why didnt the app respond 200 after raising the fail in a perfom_later function? before it had responded 200 immediately now how does it know that it will fail in the future?
i want this tutorial in nodejs plz
Why can't I save Stripe transaction id in database in flask ? Its really giving me night mare......
Thanks for this video, I understand a bit more what webhooks are!!
But I'm still confused about how to set up a webhook as a newbie. I've read the documentation and I understood that after checkout is completed I must do not relie on the sucess url in checkout to deliver the product. stripe.com/docs/payments/checkout/fulfillment#webhooks
I must use webhook instead, so my server can deliver the product when the webhook is sent to him. But could you make a video about what kind of code do you place and execute in your webhook referal page to deliver the product ??? What do we do to fufill the purchase (what is the code to send an e-mail, with the product...) ??? I'm a bit confused in this point...
Hey Cedric, each business is unique so the fulfillment logic is really dependent on what you're selling. If you want to reach out to support.stripe.com/contact we'd be more than happy to chat further on some of your options.
how to make use of this webhooks with the react application
Stripe previously had a very simple and elegant way to trigger a test event - a simple button next to the URL that you set up on Stripe portal that would trigger a sample event. Why did Stripe remove this and introduce this long winded and frankly annoying CLI based implementation? We need to move out of 1990s!😄
I bet the 13 downvotes are from PayPal employees...
Stripe they are responsible for my children food because they hold my legal money and they don't payout for me because of flimsy reasons, where is my money
I have successfully retrieve the data from webhook using payment_intent.succeeded. However, not received stripe account id from payment_intent.succeeded event response.
How can i identify for which stripe account, payment_intent.succeeded webhook response belongs?
Hi there. The account ID is in the account field of the Event object when receiving an event for a Connected account on your endpoint: stripe.com/docs/connect/webhooks#connect-webhooks:~:text=should%20be%20taken.-,In,-addition.
@@StripeDev Can't we obtain account id without connected account?
Can you please clarify what you mean by that? Connect webhooks are for connected account activity, therefore linked to an account ID.