This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('SHOPIFY_APP_SECRET', 'my_shared_secret'); | |
function verify_webhook($data, $hmac_header) | |
{ | |
$calculated_hmac = base64_encode(hash_hmac('sha256', $data, SHOPIFY_APP_SECRET, true)); | |
return ($hmac_header == $calculated_hmac); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The before save handler will pass information to the after save handler to disable the | |
// after save handler from creating a loop. | |
// It also prevents client side code from triggering the silent change, by using a different flag | |
// that the client should never see. | |
// It should only be visible in the data browser, won't be sent to a client in an undefined state. | |
Parse.Cloud.beforeSave('TestObject', function(request, response) { | |
handleComingFromTask(request.object); | |
response.success(); | |
}); |