public static function verifyShopifyRequest()
    {
        $data = $_GET;

        if(!isset(ShopifySDK::$config['SharedSecret'])) {
            throw new SdkException("Please provide SharedSecret while configuring the SDK client.");
        }

        $sharedSecret = ShopifySDK::$config['SharedSecret'];

        //Get the hmac and remove it from array
        if (isset($data['hmac'])) {
            $hmac = $data['hmac'];
            unset($data['hmac']);
        } else {
            throw new SdkException("HMAC value not found in url parameters.");
        }
        //signature validation is deprecated
        if (isset($data['signature'])) {
            unset($data['signature']);
        }
        //Create data string for the remaining url parameters
        $dataString = http_build_query($data);

        $realHmac = hash_hmac('sha256', $dataString, $sharedSecret);

        //hash the values before comparing (to prevent time attack)
        if(md5($realHmac) === md5($hmac)) {
            return true;
        } else {
            return false;
        }
    }
public static function verifyShopifyRequest()
    {
        $data = $_GET;

        if(!isset(ShopifySDK::$config['SharedSecret'])) {
            throw new SdkException("Please provide SharedSecret while configuring the SDK client.");
        }

        $sharedSecret = ShopifySDK::$config['SharedSecret'];

        //Get the hmac and remove it from array
        if (isset($data['hmac'])) {
            $hmac = $data['hmac'];
            unset($data['hmac']);
        } else {
            throw new SdkException("HMAC value not found in url parameters.");
        }
        //signature validation is deprecated
        if (isset($data['signature'])) {
            unset($data['signature']);
        }
        //Create data string for the remaining url parameters
        $dataString = http_build_query($data);

        $realHmac = hash_hmac('sha256', $dataString, $sharedSecret);

        //hash the values before comparing (to prevent time attack)
        if(md5($realHmac) === md5($hmac)) {
            return true;
        } else {
            return false;
        }
    }
public static function verifyShopifyRequest ( ) { $ data = $ _GET ; if ( ! isset ( ShopifySDK :: $ config [ 'SharedSecret' ] ) ) { throw new SdkException ( "Please provide SharedSecret while configuring the SDK client." ) ; } $ sharedSecret = ShopifySDK :: $ config [ 'SharedSecret' ] ; //Get the hmac and remove it from array if ( isset ( $ data [ 'hmac' ] ) ) { $ hmac = $ data [ 'hmac' ] ; unset ( $ data [ 'hmac' ] ) ; } else { throw new SdkException ( "HMAC value not found in url parameters." ) ; } //signature validation is deprecated if ( isset ( $ data [ 'signature' ] ) ) { unset ( $ data [ 'signature' ] ) ; } //Create data string for the remaining url parameters $ dataString = http_build_query ( $ data ) ; $ realHmac = hash_hmac ( 'sha256' , $ dataString , $ sharedSecret ) ; //hash the values before comparing (to prevent time attack) if ( md5 ( $ realHmac ) === md5 ( $ hmac ) ) { return true ; } else { return false ; } }
Verify if the request is made from shopify using hmac hash value

@throws SdkException if SharedSecret is not provided or hmac is not found in the url parameters

@return bool
Verify if the request is made from shopify using hmac hash value