Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
So I've registered my app/uninstalled webhook using PHP. And its working good. I got response in requestcatcher.com.
Now i wanted to get that response in my e.g. /Delete.php file. So for that i followed first verifying webhook. But problem is i think response is not comming in a way.
->> Im attaching my response from requestcatcher.com.
->> Now i want to get this same response in my domain file /delete.php and also im posting my code for receiving webhook.
<?php define('SHOPIFY_APP_SECRET', 'xxxxxxxxxxxxxxxxxxxxxx'); function verify_webhook($data, $hmac_header) { $calculated_hmac = base64_encode(hash_hmac('sha256', $data, SHOPIFY_APP_SECRET, true)); return hash_equals($hmac_header, $calculated_hmac); } $hmac_header = $_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256']; $data = file_get_contents('php://input'); $verified = verify_webhook($data, $hmac_header); echo "<pre>"; print_r($verified); exit; ?>
But its not working.!!!!
While I'm not fluent in PHP - can you explain a bit more what you're expecting vs what is occurring? Are you receiving the web request in the first place? How is your server responding to it? If you're not receiving the request, what PHP web server are you using, what does your route look like? Is your app running behind a tunnel, is it hosted on a cloud service like Heroku?
More details are very appreciated.
Cheers.
Alex | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hello Im expecting the web request of webhook in my file /delete.php but its not working. I got code of verifying webhook form shopify documentation. But its not working with me.
Yes i got web request in first place https://example.requestcatcher.com. And yes it is hosted in Heroku.
PFA screenshot.
Hey Pratham
The json response is in the $data variable.
Hi,
Did anyone solved this? I am having the same problem, i can't retrieve the webhook data on my heroku app.