Direct repricing

Direct repricing

Direct repricing via Link My Store feature

This is the most elegant and efficient method to perform repricing. In essence, if you integrate your online store with Price2Spy using Link My Store – Price2Spy will be able to perform price changes on your store.

 

The stores where Price2Spy currently supports this feature are:

Direct repricing via webhook

This repricing method is applicable no matter what eCommerce platform you may be using. However, it does mean certain involvement from your IT.
The way this repricing method actually works is that Price2Spy will send an HTTP(S) request to your server, containing the information your software would need in order to perform the price change within your own system.

How does this work?

The HTTP(S) request will be sent to the URL you specify in your Price2Spy account Settings (please see Repricing tab) and will contain:

Here is one example of such JSON code:

{
“productName” : “GIGATRON GAME BAYONET”,
“productInternalId” : “673-11-54”,
“productSku” : “10782722AES”,
“producLinkMyStorelId” : ““,
“currentPrice” : 150.0,
“suggestedPrice” : 118.8,
“dateRepricingRequestSent” : “2017-10-27 01:52:43”,
“strategyId” : 1234
}

Based on the response received from your Web server, Price2Spy will log this repricing request as Success or Failure.
Please find below a PHP code sample that can be used to process a Webhook repricing request

$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’);
}
});