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 use the automatic Configuration package or set manually keyIndexsidwallet and RSA keys (for request signatures by setting key content using setPrivateKey and setAPIPublicKey or by setting file path using setPrivateKeyPath and setAPIPublicKeyPath).

EncryptPublicKey is required to encrypt sensitive data(Card number, Expiry date, CVC)

NOTE: EncryptPublicKey is the same as the  APIPublicKey

For more information please refer to IPCIAStoreCard method documentation.

Configuration package

$cnf = new \Mypos\IPC\Config();
$cnf->setIpcURL('https://mypos.com/vmp/checkout-test/'); 
$cnf->setLang('en'); 
$cnf->setVersion('1.4'); 
$configurationPackage = 'eyJzaWQiOiIwMDAwMDAwMDAwMDAwMTAiLCJjbiI6IjYxOTM4MTY2NjEwIiwicGsiOiItLS0tLUJFR0lOIFJTQSBQUklWQVRFIEtFWS0tLS0tXHJcbk1JSUNYQUlCQUFLQmdRQ2YwVGRjVHVwaGI3WCtad2VrdDFYS0VXWkRjelNHZWNmbzZ2UWZxdnJhZjVWUHpjbkpcclxuMk1jNUo3MkhCbTB1OThFSkhhbitubGUyV09aTVZHSXRUYVwvMmsxRlJXd2J0N2lRNWR6RGg1UEVlWkFTZzJVV2VcclxuaG9SOEw4TXBOQnFINmg3WklUd1ZUZlJTNExzQnZsRWZUN1B6aG01WUpLZk0rQ2R6RE0rTDlXVkVHd0lEQVFBQlxyXG5Bb0dBWWZLeHdVdEVicTh1bFZyRDNubldoRitoazFrNktlamRVcTBkTFlOMjl3OFdqYkNNS2I5SWFva21xV2lRXHJcbjVpWkdFcll4aDdHNEJEUDhBV1wvK005SFhNNG9xbTVTRWtheGhiVGxna3MrRTFzOWRUcGRGUXZMNzZUdm9kcVN5XHJcbmwyRTJCZ2hWZ0xMZ2tkaFJuOWJ1YUZ6WXRhOTVKS2ZneUtHb25OeHNRQTM5UHdFQ1F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lHXC9tayt4ZlwvOW1qd0h4V3p4dEJKYk5uY05LXHJcbjBPTEkwVlhZS1cyR2dWa2xHSEhRanZldzFoVEZrRUdqbkNKN2Y1Q0RuYmd4ZXZ0eUFTREdzdDkyYTZ4Y0FlZEVcclxuYWRQMG5GWGhVeitjWVlJZ0ljZ2ZEY1gzWldlTkVGNWtzY3F5NTJrcEQyTzduRk5DVis4NXZTNGR1SkJOQWdNQlxyXG5BQUV3RFFZSktvWklodmNOQVFFTEJRQURnWUVBQ2oweGIrdE5ZRVJKa0wrcCt6RGNCc0JLNFJ2a25QbHBrK1lQXHJcbmVwaHVuRzJkQkdPbWdcL1dLZ29EMVBMV0QyYkVmR2dKeFlCSWc5cjF3TFlwREMxdHhoeFYrMk9CUVM4NktVTGgwXHJcbk5FY3IwcUVZMDVtSTRGbEUrRFwvQnBUXC8rV0Z5S2tadWc5MnJLMEZsejcxWHlcLzltQlhiUWZtK1lLNmw5cm9SWWRcclxuSjRzSGVRYz1cclxuLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLSIsImlkeCI6MX0=';
$cnf->loadConfigurationPackage($configurationPackage);

RSA Key pair

$cnf = new \Mypos\IPC\Config();
$cnf->setIpcURL('https://mypos.com/vmp/checkout-test/'); 
$cnf->setLang('en'); 
$cnf->setVersion('1.4');
$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->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. 
}