question

waylonp avatar image
waylonp asked cloveruser808 commented

Suggested way for testing webhooks locally while url points to production api

I have pointed my Clover app's webhook url to my production API. Now, I am wondering about the best approach to testing updates to the webhooks locally. I don't see an option to set a dev/staging webhook url... so how do others handle this situation?

Webhooks
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
cloveruser808 avatar image
cloveruser808 answered cloveruser808 commented

I have a variable that is set to TRUE or FALSE that signals if I'm in production or dev server.


My live webhook checks for the variable and exits if the request is coming from my dev server. Then, I manually run my webhook from my dev server locally when I need to test. My dev server reads one order at a time, for example.


It's not pretty, but it's worked for me.

2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

waylonp avatar image waylonp commented ·
Yeah, there doesn't appear to be a pretty way to handle it from what I've gathered so far. Ha! Thanks for sharing your solution.
1 Like 1 ·
cloveruser808 avatar image cloveruser808 waylonp commented ·
You're welcome. The one drawback is that I can't test a normal day-to-day scenario of the webhook being hammered by multiple locations.


I have a custom QR code discount solution. When I first tested it on dev, it worked great. I grabbed one of the store's extra terminal to test it "live". It quickly showed a huge bug. The constant barrage of webhook calls that was being done by all locations was making it so an order was being analyzed concurrently, multiple times per second.

This ended up creating multiple discounts for one order when a QR Code was present. I had to work some additional functionality in the code to handle that.

Fun stuff!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community