SimoneMSR / shopify-php-webhook

A simple Shopify webhook handler written in PHP
4 stars 3 forks source link

Shopify webhook Issue #1

Open gautam14 opened 6 years ago

gautam14 commented 6 years ago

Hello Guys.

I'm getting below issue while fetching the data from Shopify webhook. Added the webhook on "Order creation" in Shopify. Please help me in resolving the issue.

Page url: https://techbelief.com/demo/php/primalcontacts/shopify_data.php

Notice: Undefined index: HTTP_X_SHOPIFY_HMAC_SHA256 in /home/techcraze/public_html/demo/php/primalcontacts/shopify_data.php on line 73

Thanks!!

SimoneMSR commented 6 years ago

Could you write down here the steps to reproduce the Notice Error?

gautam14 commented 6 years ago

Hello SimoneMSR, Thanks for your reply!

I have added the webhook for "order creation" in shopify admin and added a code in php file which is in https://techbelief.com/demo/php/primalcontacts/shopify_data.php. But when I hit this file in browser it showing me error

Notice: Undefined index: HTTP_X_SHOPIFY_HMAC_SHA256 in /home/techcraze/public_html/demo/php/primalcontacts/shopify_data.php on line 73

Here is my code: shopify_data.txt

webhook shopify

gautam14 commented 6 years ago

I want to get/fetch order data whenever there is a new order in site.

Query: Do I need the private app to receive the data from webhooks or just above code is enough?

SimoneMSR commented 6 years ago

Hello @gautam14 . This code makes the communication between shopify and paymentwall. If you need to do other operations (on external servers) you do need to implement them.

You get the error from PHP. Maybe shopify has changed some API. Can you post here the result of the line print_r($_SERVER, true); at line 72? Let's see what's in there....

gautam14 commented 6 years ago

Thank you Simone, for you reply and suggestion. I tried and able to get the result.

Thanks !

On Mon 6 Aug, 2018, 1:58 AM Simone, notifications@github.com wrote:

Hello @gautam14 https://github.com/gautam14 . This code makes the communication between shopify and paymentwall. If you need to do other operations (on external servers) you do need to implement them.

You get the error from PHP. Maybe shopify has changed some API. Can you post here the result of the line print_r($_SERVER, true); at line 72? Let's see what's in there....

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SimoneMSR/shopify-php-webhook/issues/1#issuecomment-410545711, or mute the thread https://github.com/notifications/unsubscribe-auth/ANBq_KK2tNQQfeiRL-6POy-pmhyxPTu4ks5uN1VagaJpZM4Vsz4k .

SimoneMSR commented 6 years ago

So @gautam14 , what mistake have you made?

gautam14 commented 6 years ago

I was trying to print data on same but did not realize that in webhook I have to save data to another file or any database to see result. So after I write fetched data in text file to see the result.

On Tue 7 Aug, 2018, 12:06 AM Simone, notifications@github.com wrote:

So @gautam14 https://github.com/gautam14 , what mistake have you made?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SimoneMSR/shopify-php-webhook/issues/1#issuecomment-410808753, or mute the thread https://github.com/notifications/unsubscribe-auth/ANBq_KjnVquAFx9XuP1F1vUGxmL61M8_ks5uOIyngaJpZM4Vsz4k .