Rollback of previous notification

Include SDK loader
This will autoload necessary library files and classes

require_once './IPC/Loader.php';

Create Config object and set API configuration params

Note that IpcURL is different for sandbox and production environment

You can set RSA keys for request signatures by setting key content using setPrivateKey and setAPIPublicKey or by setting file path using setPrivateKeyPath and setAPIPublicKeyPath

$cnf = new \Mypos\IPC\Config(); 
$cnf->setPrivateKeyPath(dirname(__FILE__) . '/keys/store_private_key.pem'); 
$cnf->setAPIPublicKeyPath(dirname(__FILE__) . '/keys/api_public_key.pem'); 

Create Response object with income POST data
This will validate income data and request signature.

    $responce = \Mypos\IPC\Response::getInstance($cnf, $_POST, \Mypos\IPC\Defines::COMMUNICATION_FORMAT_POST); 
}catch(\Mypos\IPC\IPC_Exception $e){ 
    echo 'Error'; 

Get posted data as an array
$data is one-dimensional array containing elements with keys: IPCmethod, SID, Amount, Currency, OrderID

getData() has optional argument $case to change array keys case. It must be CASE_LOWER or CASE_UPPER.

Merchant site must have next logics:

1. Search in DB for order with this OrderID

2. Verify that Amount and Currency match to amount from the original transaction

3. Change order status to "Cancelled"

4. echo "OK"

$data = $responce->getData(CASE_LOWER); 
if('...check and update order'){ 
    echo 'OK'; 
    echo 'Error';