Please NOTE:

In order to use this method without a tokenized card, you should comply with PCI SAQ-D requirements. Since all the cardholder data is processed on your side, you should also take care of the communication with the issuing bank's ACS. For that purpose, we recommend using an MPI plugin for 3D Secure communication.


If you want to use the method with a tokenized card, myPOS will need to test and evaluate the usage (whether in your website or in-app) and enable the functionality in Production Envrironment.


Include SDK loader.

This will autoload necessary library files and classes

require_once './IPC/Loader.php';

Create Config object and set API configuration params

The 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.
EncryptPublicKey is required to encrypt sensitive data(Card number, Expire date, CVC)

NOTE: EncryptPublicKey is the same as the  APIPublicKey

For more information please refer to IPCIAPurchase method documentation.

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


Create Cart object and set cart items

$cart = new \Mypos\IPC\Cart; 
$cart->add('Some Book', 1, 9.99); //name, quantity, price 
$cart->add('Some other book', 1, 4.56); 
$cart->add('Discount', 1, -2.05);

Create Card object and set card details

$card = new \Mypos\IPC\Card(); 
$card->setCardHolder('John Doe'); 

Create IAPurchase object using Config object and set required params

$purchase = new \Mypos\IPC\IAPurchase($cnf); 
$purchase->setOrderID(uniqid()); //Some unique ID 
$purchase->setNote('Some note'); //Not required 
$purchase->setAccountSettlement('11111111119');//Not required 

Process request

$result = $purchase->process(); 

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