In-App PreAuthorization

Securely pre-authorize card payments within your mobile or web application using the myPOS IPC SDK.

Security Requirements

When dealing with non-tokenized card data:

  • You must comply with PCI SAQ-D requirements.
  • You must handle 3D Secure authentication. We recommend integrating an MPI plugin to communicate with the issuer's ACS.

If you want to use the method with a tokenized card, myPOS will need to test and evaluate the usage (whether in your website or in-app) and enable the functionality in the Production Environment.

SDK Loader

This will autoload necessary library files and classes.

require_once './IPC/Loader.php';

API Configuration

You can configure the IPC SDK either automatically or manually.

Option 1: Automatic Configuration

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

Option 2: Manual Configuration

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

EncryptPublicKey is required for encrypting sensitive data (card number, expiry, CVC). It is the same as the APIPublicKey.

Create PreAuthorization Object

$preAuthorization = new \Mypos\IPC\IAPreAuthorization($cnf);
$preAuthorization->setOrderID(uniqid());            // Unique Order ID
$preAuthorization->setItemName('Some Book');        // Product name
$preAuthorization->setAmount(24.50);                // Amount to hold
$preAuthorization->setCurrency('EUR');
$preAuthorization->setNote('Some note');            // Optional
$preAuthorization->setCard($card);                  // Card object
$preAuthorization->setOutputFormat(\Mypos\IPC\Defines::COMMUNICATION_FORMAT_JSON);

Process the Pre-Authorization Request

$result = $preAuthorization->process();

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

Reference