Method for checkout when the purchase will be embedded within the external app. All sensitive data will be collected from the external application.

As it is hosted on your side, you should also take care of the communication with the issuing bank’s ACS. The communication with issuing bank’s ACS happens through a so-called 3DS MPI (merchant plug-in). We recommend this method only for PCI-SAQ D compliant merchants, as it involves serious dedication and it might not be feasible for smaller merchants. Obtaining the PCI SAQ D compliance might be a painful process.

 

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/'); 
$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. 
}