AuthorizationReverse Class

The AuthorizationReverse class processes the IPCAuthorizationReverse method. It allows you to cancel a pre-authorized amount before the funds are captured — essentially releasing the hold on the customer’s card.

Use this when the transaction is no longer needed (e.g., canceled bookings, out-of-stock items, expired pre-auths).

Class Overview

  • Namespace: Mypos\IPC
  • Located at: AuthorizationReverse.php
  • Extends: Mypos\IPC\Base
  • Purpose: Reverse an existing authorization and release held funds back to the customer

Method Summary

MethodReturn TypeDescription
__construct(Config $cnf)-Initializes the object with IPC configuration.
setOrderID(string $orderID)AuthorizationReverseSets the order ID of the pre-authorization to cancel.
getOrderID()stringReturns the order ID.
setCurrency(string $currency)AuthorizationReverseCurrency used in the original authorization.
getCurrency()stringReturns the set currency.
setAmount(mixed $amount)AuthorizationReverseAmount to reverse (can be full or partial).
getAmount()mixedReturns the amount to be reversed.
validate()boolChecks for missing or invalid fields.
process()ResponseSends the reversal request and returns the IPC response.

Inherited from Base

Provides access to these common SDK utilities:

  • _addPostParam()
  • _processPost(), _processHtmlPost()
  • getCnf(), setCnf()
  • getOutputFormat(), setOutputFormat()
  • isValidSignature()

Example Usage

use Mypos\IPC\Config;
use Mypos\IPC\AuthorizationReverse;

$config = new Config();
// Set merchant credentials, SID, keys, etc.

$reverse = new AuthorizationReverse($config);
$reverse->setOrderID('AUTH-ORDER-20250410')
        ->setCurrency('EUR')
        ->setAmount(50.00); // You can reverse full or partial amount

if ($reverse->validate()) {
    $response = $reverse->process();
    echo "Authorization successfully reversed.";
} else {
    echo  "Failed to validate reversal request.";
}

Use cases

Use the AuthorizationReverse class when:

  • You want to cancel a previously held amount (partial or full)
  • A transaction was voided before capture
  • You’re handling expired bookings, inventory issues, or customer cancellations
  • You want to maintain compliance with card scheme timeframes for pre-auth reversals