Web Connection
Webhook/listener implementation in WWC app
Gravatar is a globally recognized avatar based on your email address. Webhook/listener implementation in WWC app
  Richard Kaye
  All
  Oct 17, 2024 @ 02:00am

Hi Rick,

I'm looking for info/guidance on how to implement a webhook/listener in the context of a WWC app. Any thoughts (past blog posts?) you care to share will be appreciated. The basic context is submitting payment info to Stripe and best practices on how to handle the wait state whilst awaiting the response.

Thanks!

Gravatar is a globally recognized avatar based on your email address. re: Webhook/listener implementation in WWC app
  Rick Strahl
  Richard Kaye
  Oct 17, 2024 @ 08:52am

A WebHook is just a Web API (REST Service) on the receiving end...

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Webhook/listener implementation in WWC app
  Richard Kaye
  Rick Strahl
  Oct 17, 2024 @ 12:40pm

Let me see if I can phrase my request for recommendations a little better. 😃

Let's say among other pages I have an order pizza page in my WWC app. I can pick toppings and quantity of pies, and then submit that request to my local pizzeria's order API. If I order one pie, maybe it takes 10 minutes. But maybe I'm having a party and I order 20 pies. That takes an hour. Fortunately, my pizzeria also has a Webhook/listener I can call so I can find out when my pizza will be ready for pickup. How can I get that message back to my application user who placed the order?

I could have some sort of polling mechanism that fires at the beginning of each regular app request that calls the pizzeria's webhook/listener but that seems like a lot of overhead to add to all app requests. Alternatively, I build an API that allows my technically savvy pizzeria to push order status updates into my environment from which I can then trigger a user message.

Hopefully that's a little less vague.

TIA

Gravatar is a globally recognized avatar based on your email address. re: Webhook/listener implementation in WWC app
  Rick Strahl
  Richard Kaye
  Oct 17, 2024 @ 01:28pm

A WebHook is something that calls you back. Example is PayPal - if you process a PayPal payment, when the processing is done on their end they call an endpoint that you provide with the completed order and some Id that you can validate the request with to validate the user didn't fuck with it before it went to PayPal (ask me how I know 😄).

That callback mechanism that's a WebHook. You have a provider that does something and calls you back at a known endpoint.

I think what you're asking about is a WebSocket - something that is connected to the provider and immediately calls you back when the result is done. That can be done, but it requires that the hosting provider has a Web Socket interface. Which doesn't make a lot of sense in the first place when they can just call you back at a fixed endpoint you provide.

WebSockets are a lot more complicated and typically require some coordination between the provider and the client(s).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Webhook/listener implementation in WWC app
  Richard Kaye
  Rick Strahl
  Oct 18, 2024 @ 01:51am

Ah! That starts to make more sense. So you basically include a "call me at this number when you're done" as part of the original request. So I do have to provide that return endpoint and presumably the callback includes the fine details of the work done. Thanks for providing some clarity. Much appreciated.

I'll take a wild guess; hacking attempts on your store payment workflow. 😃

Gravatar is a globally recognized avatar based on your email address. re: Webhook/listener implementation in WWC app
  Marcel DESMET
  Richard Kaye
  Oct 18, 2024 @ 07:44am

Hello, I work this way for the management of payments on my site

In my case there are two urls to communicate to the provider

returnUrl -> Order callback Url webhookUrl -> Update status Url

The most complicated part for the implementation is flow management Do not forget that the restprocess can be requested before the end of the command process ( I am in a comm muliprocess environment). Everything must be ready on the hard drive ( data files ) at the time of the payment request

Gravatar is a globally recognized avatar based on your email address. re: Webhook/listener implementation in WWC app
  Richard Kaye
  Marcel DESMET
  Oct 18, 2024 @ 11:26am

Thanks, Marcel. I appreciate the additional feedback.

Gravatar is a globally recognized avatar based on your email address. re: Webhook/listener implementation in WWC app
  Rick Strahl
  Richard Kaye
  Oct 18, 2024 @ 07:28pm

I'll take a wild guess; hacking attempts on your store payment workflow.

Actually no. I use BrainTree and all operations with go through direct request/response operations. PayPal is different because you actually get re-directed to their site for processing, then are returned back to your site when done and for that you need the WebHook/Callback to verify that the user didn't mess with your data - ie. that the data returned is the same as the data that you expected to send. And yeah, that bit me once or twice in the past when I did direct paypal processing. Much easier with BrainTree which handles PayPal like a regular CC transaction (and the main reason I use them).

Incidentally the vast majority of my order transactions are through PayPal rather than CC cards, presumably due to the fact that the CC number is not passed to me (actually it never is even if a card is used, but it doesn't look that way to the customer).

+++ Rick ---

© 1996-2024