NOTE: In order to process reucrring payments we must enable the functionality first.
Please contact us with explanation why you need the functionality at: online@mypos.com   
 

 

There are 2 different ways to introduce recurring payments. 

 

1. Store a card with IPCPurchase, charge a stored card with IPCIAPurchase


If you call IPCPurchase method with CardTokenRequest “1” or “2” parameter, your customer is first redirected to the myPOS hosted checkout page. You can use it for the following combinations:

  • You want to store and verify a card without charging it – 0 value charge;
  • You want to store and verify a card after it is charged – for example, the customer pays and upon payment, our system returns a card token in the response;

 

Available options are:

0 - CARD_TOKEN_REQUEST_NONECreate regular payment without token request
1 - CARD_TOKEN_REQUEST_ONLY_STORE
Only token request without making payment
2 - CARD_TOKEN_REQUEST_PAY_AND_STORE
– Make payment and create a token

 

Once you have a token using IPCPurchase, you can then subsequently charge your customer with calling IPCIAPurchase method with CardToken parameter. This means that your customer won’t be redirected to a myPOS hosted checkout page the second time. You can find examples using our PHP SDK in the attached file.

 

NOTE: If the card is 3D Secure, the first time when cardholder enters card data, he/she will be redirected to issuing bank’s 3D Secure portal.

 

Store a card with payment

require_once './IPC/Loader.php';

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

// WITH Configuration package

$configurationPackage = 'eyJzaWQiOiIwMDAwMDAwMDAwMDAwMTAiLCJjbiI6IjYxOTM4MTY2NjEwIiwicGsiOiItLS0tLUJFR0lOIFJTQSBQUklWQVRFIEtFWS0tLS0tXHJcbk1JSUNYQUlCQUFLQmdRQ2YwVGRjVHVwaGI3WCtad2VrdDFYS0VXWkRjelNHZWNmbzZ2UWZxdnJhZjVWUHpjbkpcclxuMk1jNUo3MkhCbTB1OThFSkhhbitubGUyV09aTVZHSXRUYVwvMmsxRlJXd2J0N2lRNWR6RGg1UEVlWkFTZzJVV2VcclxuaG9SOEw4TXBOQnFINmg3WklUd1ZUZlJTNExzQnZsRWZUN1B6aG01WUpLZk0rQ2R6RE0rTDlXVkVHd0lEQVFBQlxyXG5B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XdKQ1xyXG5SekVPTUF3R0ExVUVDZ3dGYlhsUVQxTXdIaGNOTVRneE1ERXlNRGN3T1RFeldoY05Namd4TURBNU1EY3dPVEV6XHJcbldqQWRNUXN3Q1FZRFZRUUdFd0pDUnpFT01Bd0dBMVVFQ2d3RmJYbFFUMU13Z1o4d0RRWUpLb1pJaHZjTkFRRUJcclxuQlFBRGdZMEFNSUdKQW9HQkFNTCtWVG1pWTR5Q2hvT1RNWlRYQUlHXC9tayt4ZlwvOW1qd0h4V3p4dEJKYk5uY05LXHJcbjBPTEkwVlhZS1cyR2dWa2xHSEhRanZldzFoVEZrRUdqbkNKN2Y1Q0RuYmd4ZXZ0eUFTREdzdDkyYTZ4Y0FlZEVcclxuYWRQMG5GWGhVeitjWVlJZ0ljZ2ZEY1gzWldlTkVGNWtzY3F5NTJrcEQyTzduRk5DVis4NXZTNGR1SkJOQWdNQlxyXG5BQUV3RFFZSktvWklodmNOQVFFTEJRQURnWUVBQ2oweGIrdE5ZRVJKa0wrcCt6RGNCc0JLNFJ2a25QbHBrK1lQXHJcbmVwaHVuRzJkQkdPbWdcL1dLZ29EMVBMV0QyYkVmR2dKeFlCSWc5cjF3TFlwREMxdHhoeFYrMk9CUVM4NktVTGgwXHJcbk5FY3IwcUVZMDVtSTRGbEUrRFwvQnBUXC8rV0Z5S2tadWc5MnJLMEZsejcxWHlcLzltQlhiUWZtK1lLNmw5cm9SWWRcclxuSjRzSGVRYz1cclxuLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLSIsImlkeCI6MX0=';
$cnf->loadConfigurationPackage($configurationPackage);


// WITH RSA Key pair this is a deprecated method

$cnf->setPrivateKeyPath(dirname(__FILE__) . '/keys/store_private_key.pem'); 
$cnf->setAPIPublicKeyPath(dirname(__FILE__) . '/keys/api_public_key.pem'); 
$cnf->setKeyIndex(1); 
$cnf->setSid('000000000000010'); 
$cnf->setWallet('61938166610');


#Create Purchase object using Config object and set required params
$purchase = new \Mypos\IPC\Purchase($cnf);
$purchase->setUrlCancel('http://mysite.com/ipc_cancel'); //User comes here after purchase cancelation
$purchase->setUrlOk('http://mysite.com/ipc_ok'); //User comes here after purchase success
$purchase->setUrlNotify('https://mysite.com/ipc_notify'); //IPC sends POST request to this address with purchase status
$purchase->setOrderID(uniqid()); //Some unique ID
$purchase->setCurrency('EUR');
$purchase->setNote('Some note'); //Not required


#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);
$purchase->setCart($cart);


$purchase->setCardTokenRequest(\Mypos\IPC\Purchase::CARD_TOKEN_REQUEST_PAY_AND_STORE);
$purchase->setPaymentParametersRequired(\Mypos\IPC\Purchase::PURCHASE_TYPE_SIMPLIFIED_PAYMENT_PAGE);



try{
    $purchase->process();
}catch(\Mypos\IPC\IPC_Exception $ex){
    echo $ex->getMessage();
    //Invalid params. To see details use "echo $ex->getMessage();"
}

 

Store card without Payment

To make only a token request without payment you must set the appropriate value to setCardTokenRequest() method.

 

NOTE: $cart object is unnecessary, so it may be skipped.

 

require_once './IPC/Loader.php';

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

// WITH Configuration package

$configurationPackage = 'eyJzaWQiOiIwMDAwMDAwMDAwMDAwMTAiLCJjbiI6IjYxOTM4MTY2NjEwIiwicGsiOiItLS0tLUJFR0lOIFJTQSBQUklWQVRFIEtFWS0tLS0tXHJcbk1JSUNYQUlCQUFLQmdRQ2YwVGRjVHVwaGI3WCtad2VrdDFYS0VXWkRjelNHZWNmbzZ2UWZxdnJhZjVWUHpjbkpcclxuMk1jNUo3MkhCbTB1OThFSkhhbitubGUyV09aTVZHSXRUYVwvMmsxRlJXd2J0N2lRNWR6RGg1UEVlWkFTZzJVV2VcclxuaG9SOEw4TXBOQnFINmg3WklUd1ZUZlJTNExzQnZsRWZ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R05RV0RBTkJna3Foa2lHOXcwQkFRc0ZBREFkTVFzd0NRWURWUVFHRXdKQ1xyXG5SekVPTUF3R0ExVUVDZ3dGYlhsUVQxTXdIaGNOTVRneE1ERXlNRGN3T1RFeldoY05Namd4TURBNU1EY3dPVEV6XHJcbldqQWRNUXN3Q1FZRFZRUUdFd0pDUnpFT01Bd0dBMVVFQ2d3RmJYbFFUMU13Z1o4d0RRWUpLb1pJaHZjTkFRRUJcclxuQlFBRGdZMEFNSUdKQW9HQkFNTCtWVG1pWTR5Q2hvT1RNWlRYQUlHXC9tayt4ZlwvOW1qd0h4V3p4dEJKYk5uY05LXHJcbjBPTEkwVlhZS1cyR2dWa2xHSEhRanZldzFoVEZrRUdqbkNKN2Y1Q0RuYmd4ZXZ0eUFTREdzdDkyYTZ4Y0FlZEVcclxuYWRQMG5GWGhVeitjWVlJZ0ljZ2ZEY1gzWldlTkVGNWtzY3F5NTJrcEQyTzduRk5DVis4NXZTNGR1SkJOQWdNQlxyXG5BQUV3RFFZSktvWklodmNOQVFFTEJRQURnWUVBQ2oweGIrdE5ZRVJKa0wrcCt6RGNCc0JLNFJ2a25QbHBrK1lQXHJcbmVwaHVuRzJkQkdPbWdcL1dLZ29EMVBMV0QyYkVmR2dKeFlCSWc5cjF3TFlwREMxdHhoeFYrMk9CUVM4NktVTGgwXHJcbk5FY3IwcUVZMDVtSTRGbEUrRFwvQnBUXC8rV0Z5S2tadWc5MnJLMEZsejcxWHlcLzltQlhiUWZtK1lLNmw5cm9SWWRcclxuSjRzSGVRYz1cclxuLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLSIsImlkeCI6MX0=';
$cnf->loadConfigurationPackage($configurationPackage);


// WITH RSA Key pair this is a deprecated method

$cnf->setPrivateKeyPath(dirname(__FILE__) . '/keys/store_private_key.pem'); 
$cnf->setAPIPublicKeyPath(dirname(__FILE__) . '/keys/api_public_key.pem'); 
$cnf->setKeyIndex(1); 
$cnf->setSid('000000000000010'); 
$cnf->setWallet('61938166610');

$purchase = new \Mypos\IPC\Purchase($cnf);
$purchase->setUrlCancel('http://mysite.com/ipc_cancel'); 
$purchase->setUrlOk('http://mysite.com/ipc_ok'); 
$purchase->setUrlNotify('https://mysite.com/ipc_notify'); 
$purchase->setOrderID(uniqid());
$purchase->setCurrency('EUR');

$purchase->setCardTokenRequest(\Mypos\IPC\Purchase::CARD_TOKEN_REQUEST_ONLY_STORE);
$purchase->setPaymentParametersRequired(\Mypos\IPC\Purchase::PURCHASE_TYPE_SIMPLIFIED_PAYMENT_PAGE);

try{
    $purchase->process();
}catch(\Mypos\IPC\IPC_Exception $ex){    
    //Invalid params. To see details use "echo $ex->getMessage();"
}

 

Once the process is completed on myPOS site, merchant site will receive Notify request containing confirmation data and token (if its requested)

 

As a merchant notify endpoint this code may be used to check and verify the request:

 

require_once './IPC/Loader.php';

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

// WITH Configuration package

$configurationPackage = 'eyJzaWQiOiIwMDAwMDAwMDAwMDAwMTAiLCJjbiI6IjYxOTM4MTY2NjEwIiwicGsiOiItLS0tLUJFR0lOIFJTQSBQUklWQVRFIEtFWS0tLS0tXHJcbk1JSUNYQUlCQUFLQmdRQ2YwVGRjVHVwaGI3WCtad2VrdDFYS0VXWkRjelNHZWNmbzZ2UWZxdnJhZjVWUHpjbkpcclxuMk1jNUo3MkhCbTB1OThFSkhhbitubGUyV09aTVZHSXRUYVwvMmsxRlJXd2J0N2lRNWR6RGg1UEVlWkFTZzJVV2VcclxuaG9SOEw4TXBOQnFINmg3WklUd1ZUZlJTNExzQnZsRWZUN1B6aG01WUpLZk0rQ2R6RE0rTDlXVkVHd0lEQVFBQlxyXG5Bb0dBWWZLeHdVdEVicTh1bFZyRDNubldoRitoazFrNktlamRVcTBkTFlOMjl3OFdqYkNNS2I5SWFva21xV2lRXHJcbjVpWkdFcll4aDdHNEJEUDhBV1wvK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q1FZRFZRUUdFd0pDUnpFT01Bd0dBMVVFQ2d3RmJYbFFUMU13Z1o4d0RRWUpLb1pJaHZjTkFRRUJcclxuQlFBRGdZMEFNSUdKQW9HQkFNTCtWVG1pWTR5Q2hvT1RNWlRYQUlHXC9tayt4ZlwvOW1qd0h4V3p4dEJKYk5uY05LXHJcbjBPTEkwVlhZS1cyR2dWa2xHSEhRanZldzFoVEZrRUdqbkNKN2Y1Q0RuYmd4ZXZ0eUFTREdzdDkyYTZ4Y0FlZEVcclxuYWRQMG5GWGhVeitjWVlJZ0ljZ2ZEY1gzWldlTkVGNWtzY3F5NTJrcEQyTzduRk5DVis4NXZTNGR1SkJOQWdNQlxyXG5BQUV3RFFZSktvWklodmNOQVFFTEJRQURnWUVBQ2oweGIrdE5ZRVJKa0wrcCt6RGNCc0JLNFJ2a25QbHBrK1lQXHJcbmVwaHVuRzJkQkdPbWdcL1dLZ29EMVBMV0QyYkVmR2dKeFlCSWc5cjF3TFlwREMxdHhoeFYrMk9CUVM4NktVTGgwXHJcbk5FY3IwcUVZMDVtSTRGbEUrRFwvQnBUXC8rV0Z5S2tadWc5MnJLMEZsejcxWHlcLzltQlhiUWZtK1lLNmw5cm9SWWRcclxuSjRzSGVRYz1cclxuLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLSIsImlkeCI6MX0=';
$cnf->loadConfigurationPackage($configurationPackage);


// WITH RSA Key pair this is a deprecated method

$cnf->setPrivateKeyPath(dirname(__FILE__) . '/keys/store_private_key.pem'); 
$cnf->setAPIPublicKeyPath(dirname(__FILE__) . '/keys/api_public_key.pem'); 
$cnf->setKeyIndex(1); 
$cnf->setSid('000000000000010'); 
$cnf->setWallet('61938166610');

try{
   $responce = \Mypos\IPC\Response::getInstance($cnf, $_POST, \Mypos\IPC\Defines::COMMUNICATION_FORMAT_POST);
}catch(\Mypos\IPC\IPC_Exception $e){
   echo 'Error';
}
$data = $responce->getData(CASE_LOWER);

 

NOTE: $data is an array containing confirmation data and token (if its requested).

  

2. Store a card with IPCIAPurchase, charge a stored card with IPCIAPurchase


If you want to store a card without your customer being redirected to the myPOS checkout hosted page, you have to host the checkout page at your side. 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.