Cancelation of payment 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: 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->setIpcURL('https://mypos.eu/vmp/checkout-test/'); 
$cnf->setLang('en'); 
$cnf->setPrivateKeyPath(dirname(__FILE__) . '/keys/store_private_key.pem'); 
$cnf->setAPIPublicKeyPath(dirname(__FILE__) . '/keys/api_public_key.pem'); 
$cnf->setKeyIndex(1); 
$cnf->setSid('000000000000010'); 
$cnf->setVersion('1.3'); 
$cnf->setWallet('61938166610');


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

try{ 
    $responce = \Mypos\IPC\Response::getInstance($cnf, $_POST, \Mypos\IPC\Defines::COMMUNICATION_FORMAT_POST); 
}catch(\Mypos\IPC\IPC_Exception $e){ 
    //Display Some general error or redirect to merchant store home page 
}


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

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



Merchant site must have the following logic:

1. Search in DB for order with this OrderID

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

3. Show "Thank you" page to merchant customer

$data = $responce->getData(CASE_LOWER); 
if('...order is found in merchant store DB'){ 
    //Display "Your order has been canceled" for example. 
}else{ 
    //Display Some general error or redirect to merchant store home page 
}