AuthorizationCapture Class

The AuthorizationCapture class handles the IPCAuthorizationCapture method. It allows you to capture funds that were previously authorized using a direct card authorization (Authorization class).

This is the final step in a two-phase transaction. You authorize first to hold funds, and then capture when you're ready to complete the charge.

Class Overview

  • Namespace: Mypos\IPC
  • Located at: AuthorizationCapture.php
  • Extends: Mypos\IPC\Base
  • Purpose: Finalize and capture funds from a prior authorization

Method Summary

MethodReturn TypeDescription
__construct(Config $cnf)-Initializes the capture object with IPC configuration.
setOrderID(string $orderID)AuthorizationCaptureSets the same order ID used during authorization.
getOrderID()stringReturns the authorization order ID.
setAmount(mixed $amount)AuthorizationCaptureThe amount to capture (must be ≤ authorized amount).
getAmount()mixedReturns the capture amount.
setCurrency(string $currency)AuthorizationCaptureCurrency of the transaction (e.g., EUR).
getCurrency()stringReturns the set currency.
validate()boolEnsures required fields are set correctly.
process()ResponseSends the request to capture the funds and returns the IPC response object.

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\AuthorizationCapture;

$config = new Config();
// Setup SID, Wallet number, API keys, etc.

$capture = new AuthorizationCapture($config);
$capture->setOrderID('AUTH-20250410-XYZ')
        ->setCurrency('EUR')
        ->setAmount(100.00); // Must be less than or equal to originally authorized amount

if ($capture->validate()) {
    $response = $capture->process();
    echo "Funds captured successfully!";
} else {
    echo "Validation failed. Check Order ID, amount, or currency.";
}

Use cases

Use the AuthorizationCapture class when:

  • You’ve already authorized a payment using the Authorization class
  • You want to capture the funds after a successful delivery, booking, or confirmation
  • You support delayed charges or staged payments
  • You want to finalize only part of the amount originally authorized