Helper/Hook.php
private function verifyWebhookApi($payload, $hmac_header)
    {
        //Request Data
        $requestData = $this->dataObjectFactory->create();
        $requestData->setApiData(json_decode($payload));
        $requestData->setDynamicApiUrl(ApiHelper::API_VERIFY_SIGNATURE);
        $requestData->setApiKey($this->configHelper->getApiKey());

        $headers = [
            self::HMAC_HEADER => $hmac_header
        ];

        $requestData->setHeaders($headers);

        $requestData->setStatusOnly(true);

        //Build Request
        $request = $this->apiHelper->buildRequest($requestData);
        try {
            $result = $this->apiHelper->sendRequest($request);
        } catch (\Exception $e) {
            return false;
        }

        return $result == 200;
    }
private function verifyWebhookApi($payload, $hmac_header)
    {
        //Request Data
        $requestData = $this->dataObjectFactory->create();
        $requestData->setApiData(json_decode($payload));
        $requestData->setDynamicApiUrl(ApiHelper::API_VERIFY_SIGNATURE);
        $requestData->setApiKey($this->configHelper->getApiKey());

        $headers = [
            self::HMAC_HEADER => $hmac_header
        ];

        $requestData->setHeaders($headers);

        $requestData->setStatusOnly(true);

        //Build Request
        $request = $this->apiHelper->buildRequest($requestData);
        try {
            $result = $this->apiHelper->sendRequest($request);
        } catch (\Exception $e) {
            return false;
        }

        return $result == 200;
    }
private function verifyWebhookApi ( $ payload , $ hmac_header ) { //Request Data $ requestData = $ this -> dataObjectFactory -> create ( ) ; $ requestData -> setApiData ( json_decode ( $ payload ) ) ; $ requestData -> setDynamicApiUrl ( ApiHelper :: API_VERIFY_SIGNATURE ) ; $ requestData -> setApiKey ( $ this -> configHelper -> getApiKey ( ) ) ; $ headers = [ self :: HMAC_HEADER => $ hmac_header ] ; $ requestData -> setHeaders ( $ headers ) ; $ requestData -> setStatusOnly ( true ) ; //Build Request $ request = $ this -> apiHelper -> buildRequest ( $ requestData ) ; try { $ result = $ this -> apiHelper -> sendRequest ( $ request ) ; } catch ( \ Exception $ e ) { return false ; } return $ result == 200 ; }
Verifying Hook Requests via API call.

@param string $payload
@param string $hmac_header

@return bool
@throws \Magento\Framework\Exception\LocalizedException
Verifying Hook Requests via API call .