PreAuthStatus – Check Pre-Authorization Status
This guide walks you through checking a pre-authorization status using the MyPOS IPC PHP SDK.
Step 1: Load the IPC SDK
This will autoload necessary library files and classes.
Code Example
PHP
require_once './IPC/Loader.php';Step 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
Code Example
PHP
$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
Code Example
PHP
$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 PreAuthStatus method documentation.
Step 3: Create PreAuthorizationStatus Object and Set Required Params
Code Example
PHP
$preAuthorization = new \Mypos\IPC\PreAuthorizationStatus($cnf);
$preAuthorization->setOrderID('1498'); // Replace with your actual Order IDStep 4: Process Request
Code Example
PHP
$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.