Giter VIP home page Giter VIP logo

Comments (4)

amitavroy avatar amitavroy commented on June 27, 2024 1

Hi @paulomarg I couldn't understand the reason why the key used during the test notification will be different.

However, what I understood from your response is that ideally if the order was created from the development store, it should have validated. And, based on this understanding, I did create a few orders through the Bogus payment gateway. However, even then the validation is failing.

However, when I looked at the sample codes on shopify dev docs: https://shopify.dev/apps/webhooks/configuration/https#step-5-verify-the-webhook

In the PHP code, verify_webhook function uses "hash_equals" function rather than the !== on line 282
https://github.com/Shopify/shopify-api-php/blob/main/src/Webhooks/Registry.php#L282

So, I am a bit confused where I am getting this wrong. A little bit of help in this would be very helpful.

from shopify-app-template-php.

paulomarg avatar paulomarg commented on June 27, 2024

Hi @katielgc, unfortunately, that feature for manually dispatching a webhook call won't work with apps. Because it's a store feature, it will create an HMAC signature using that key you mentioned, rather than the app's secret key (which is what the app would expect).

In order to be able to test your app webhook for order creation, you'd need to create an order in your development store, and Shopify will automatically fire the webhook to your app.

Since this is not a bug in the library code, I'm closing the issue, but please feel free to open a new issue if you have any further problems.

from shopify-app-template-php.

katielgc avatar katielgc commented on June 27, 2024

Thanks @paulomarg for your quick response I see what you mean and appreciate you letting me know 🥇

from shopify-app-template-php.

thaild avatar thaild commented on June 27, 2024

Hi @paulomarg I couldn't understand the reason why the key used during the test notification will be different.

However, what I understood from your response is that ideally if the order was created from the development store, it should have validated. And, based on this understanding, I did create a few orders through the Bogus payment gateway. However, even then the validation is failing.

However, when I looked at the sample codes on shopify dev docs: https://shopify.dev/apps/webhooks/configuration/https#step-5-verify-the-webhook

In the PHP code, verify_webhook function uses "hash_equals" function rather than the !== on line 282 https://github.com/Shopify/shopify-api-php/blob/main/src/Webhooks/Registry.php#L282

So, I am a bit confused where I am getting this wrong. A little bit of help in this would be very helpful.

you can find in .myshopify.com/admin/settings/notifications page under Webhooks section that says "All your webhooks will be signed with <key> so you can verify their identity."

You can use key as API_SECRET_KEY to validate HMAC

from shopify-app-template-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.