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->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->setEncryptPublicKeyPath(dirname(__FILE__) . '/keys/encrypt_key.pem'); 

$cnf->setKeyIndex(1); 
$cnf->setSid('000000000000010'); 
$cnf->setVersion('1.3'); 
$cnf->setWallet('61938166610');


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->setCardType(\Mypos\IPC\Card::CARD_TYPE_MASTERCARD); 
$card->setCardNumber('5555555555554444'); 
$card->setExpMM('12'); 
$card->setExpYY('21'); 
$card->setCvc('111'); 
$card->setCardHolder('John Doe'); 
$card->setEci(6); 
$card->setAvv(''); 
$card->setXid('');

Create IAPurchase object using Config object and set required params

$purchase = new \Mypos\IPC\IAPurchase($cnf); 
$purchase->setOrderID(uniqid()); //Some unique ID 
$purchase->setCurrency('EUR'); 
$purchase->setNote('Some note'); //Not required 
$purchase->setCard($card); 
$purchase->setAccountSettlement('11111111119');//Not required 
$purchase->setCart($cart); 
$purchase->setOutputFormat(Mypos\IPC\Defines::COMMUNICATION_FORMAT_JSON);

Process request

$result = $purchase->process(); 

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