PreAuthorizationCompletion Class

The PreAuthorizationCompletion class processes the IPCPreAuthorizationCompletion method. It is used to capture (finalize) funds that were previously held via a pre-authorization transaction.

This step moves the funds from the customer’s account into the merchant’s account, completing the payment.

Class Overview

  • Namespace: Mypos\IPC
  • Located at: PreAuthorizationCompletion.php
  • Extends: Mypos\IPC\Base
  • Purpose: Capture all or part of the previously authorized amount

Method Summary

MethodReturn TypeDescription
__construct(Config $cnf)-Initializes the completion object using your IPC config.
setOrderID(string $orderID)PreAuthorizationCompletionSets the original order ID of the pre-auth transaction.
getOrderID()stringRetrieves the pre-auth order ID.
setCurrency(string $currency)PreAuthorizationCompletionSets the ISO-4217 currency code (e.g., EUR).
getCurrency()stringReturns the currency for the transaction.
setAmount(mixed $amount)PreAuthorizationCompletionAmount to capture from the original pre-authorization.
getAmount()mixedReturns the amount to be captured.
validate()boolChecks if all necessary data is correctly set.
process()ResponseSends the API request and returns the IPC response object.

Inherited from Base

Includes common IPC methods:

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

Example Usage

use Mypos\IPC\Config;
use Mypos\IPC\PreAuthorizationCompletion;

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

$completion = new PreAuthorizationCompletion($config);
$completion->setOrderID('AUTH-20250410-XYZ')
           ->setCurrency('EUR')
           ->setAmount(100.00); // Must be ≤ pre-auth amount

if ($completion->validate()) {
    $response = $completion->process();
    echo "Pre-authorization completed successfully!";
} else {
    echo "Missing or invalid completion parameters.";
}

Use cases

Use the PreAuthorizationCompletion class when:

  • You want to capture payment after a customer has used a product or service
  • You’ve previously authorized funds and now want to collect them
  • You support delayed capture workflows, such as hotels, car rentals, or event services
  • You want to partially capture funds (less than the pre-authorized amount)