Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
I ma trying to set up an api that works off a webhook. I have set up the webhook in shopify and then in the laravel controller I have added the php code as per the shopify doc s
https://help.shopify.com/api/getting-started/webhooks#verify-webhook
Problem is I keep getting an error:
(1/1) ErrorException
Undefined index: HTTP_X_SHOPIFY_HMAC_SHA256
Any help greatly appreciated
Hey Barry,
On an absolutely basic level I can't replicate this behaviour. With some logging set up for a standard webhook posts route, I'm finding the index just fine in webhook request header arrays:
Route::post('/webhooks', function()
{
Log::info($_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256']);
});
If I had to guess, maybe the shift in context from route to controller is where the values of $_SERVER are being lost?
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
I Managed to get this working by having the verification in a controller and routing to the controller, but it had to be in the construct, wouldnt work in the index method
How did you solve this? I am also facing the same problem. I am trying to recieve data from a webhook in Laravel. When I fire it to a route in Laravel and add the verify code into the route nothing happens. I also checked this: https://community.shopify.com/c/Shopify-APIs-SDKs/Shopify-webhooks-and-Laravel-routes/m-p/378017
This didn't work for me. Can you just tell me how did you included the PHP code in the controller and what modification you made in the routes?
@javedali Hey my friend how are you ?
Have you fix this problem ? if so, how did you do it?
I am facing the same problem...
Thank you my friend
User | RANK |
---|---|
5 | |
4 | |
4 | |
3 | |
3 |