Storing a card data. All sensitive data will be collected from the external application. You must be PCI SAQ-D compliant in order to use this method.

 

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.

 

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 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 IAStoreCard object using Config object and set required params

$store = new \Mypos\IPC\IAStoreCard($cnf); 
$store->setCardVerification(\Mypos\IPC\IAStoreCard::CARD_VERIFICATION_YES); 
$store->setAmount(1.00); 
$store->setCurrency('EUR'); 
$store->setCard($card); 
$store->setOutputFormat(Mypos\IPC\Defines::COMMUNICATION_FORMAT_JSON);


Process request

$result = $store->process(); 

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