AuthorizationReverse – Reverse a Pending Authorization

Use this method to cancel (void) a previously authorized amount that has not yet been captured.

Get All Pending Authorizations

You can retrieve all pending authorizations using the IPC SDK.

1. Load the MyPOS SDK

require_once './IPC/Loader.php';

This ensures all required MyPOS classes and dependencies are autoloaded.

2. Create Config Object and Set API Configuration Params

Be sure to use the correct IpcURL for sandbox or production environments.

You can use the automatic Configuration package or set manually keyIndex, sid, wallet and RSA keys (for request signatures by setting key content using setPrivateKey and setAPIPublicKey or by setting file path using setPrivateKeyPath and setAPIPublicKeyPath).

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

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, please refer to the IPCAuthorizationCapture method documentation.

3. Create AuthorizationReverse Object and Set Required Params

$authorization = new \Mypos\IPC\AuthorizationReverse($cnf);
$authorization->setOrderID('1498');
$authorization->setAmount(24.50); // Total or partial amount of your authorization
$authorization->setCurrency('EUR');
$authorization->setOutputFormat(Mypos\IPC\Defines::COMMUNICATION_FORMAT_JSON);

4. Process Request

$result = $authorization->process();

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

Additional Resources

Authorization Reverse Documentation