Update a data of already stored card. All sensitive data will be collected from the external application

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


Create IAStoredCardUpdate object using Config object and set required params

$store = new \Mypos\IPC\IAStoredCardUpdate($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. 
}