$app->post(‘/web-hook’, function (Request $request, Response $response) {
// Get Authorization header from request
$authorization = $request->getHeader(‘Authorization’);
$headerValue = $authorization[0];
// Get Authorization code from your aplication settings
$webHookAuthorizationCode = $this->settings[‘webHookAuthorizationCode’];
// Check Authorization code
if ($headerValue === $webHookAuthorizationCode) {
// Get request body data
$body = $request->getParsedBody();
// Here you can parse JSON data
$suggestedPrice = $body[‘suggestedPrice’];
print_r($suggestedPrice);
$productSku = $body[‘productSku’];
print_r($productSku);
$dateRepricingRequestSent = $body[‘dateRepricingRequestSent’];
print_r($dateRepricingRequestSent);
$productLinkMyStoreId = $body[‘productLinkMyStoreId’];
print_r($productLinkMyStoreId);
$currentPrice = $body[‘currentPrice’];
print_r($currentPrice);
$productInternalId = $body[‘productInternalId’];
print_r($productInternalId);
$productName = $body[‘productName’];
print_r($productName);
die(“OK”);
} else {
die(‘Authorization failed’);
}
});