PreAuthStatus – Check Pre-Authorization Status

This guide walks you through checking a pre-authorization status using the MyPOS IPC PHP SDK.

1. Load the IPC SDK

This will autoload necessary library files and classes.

require_once './IPC/Loader.php';

2. Set Up Configuration

You’ll need to create a Config object and provide your API credentials and other settings.

The IpcURL must be different for sandbox and production environments. You can use either the Configuration Package or manually provide your RSA Key Pair setup.

Option 1: Using a Configuration Package

$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: Manually Setting 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->setKeyIndex(1);
$cnf->setSid('000000000000010');
$cnf->setWallet('61938166610');

For more information, see the IPPreAuthStatus method documentation.

3. Create PreAuthorizationStatus Object and Set Required Params

$preAuthorization = new \Mypos\IPC\PreAuthorizationStatus($cnf);
$preAuthorization->setOrderID('1498'); // Replace with your actual Order ID

4. Process Request

$result = $preAuthorization->process();

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

Need Help?

For more details, visit the official documentation for PreAuthorizationStatus.