Make a new registration of a mandate reference for Request money transactions from a myPOS account or cancel a previously registered mandate reference

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 a 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 MandateManagement object with created config

$mandateManagement = new \Mypos\IPC\MandateManagement($cnf);


Set MandateManagement params

$mandateManagement->setMandateReferece('126ca831-93d2-4dfc-ab1f-0cce1d0abe9e'); 
$mandateManagement->setCustomerWalletNumber('61938166612'); 
$mandateManagement->setAction(\Mypos\IPC\MandateManagement::MANDATE_MANAGEMENT_ACTION_REGISTER); 
$mandateManagement->setMandateText('Here comes the mandate text'); 
$mandateManagement->setOutputFormat(Mypos\IPC\Defines::COMMUNICATION_FORMAT_XML);


Process request

$result = $mandateManagement->process(); 

if ($result->getStatus() == \Mypos\IPC\Defines::STATUS_SUCCESS) { 
    echo 'success'; 
    //success 
} else { 
    //Show error. 
}