IAPreAuthorization Class
The IAPreAuthorization class processes the IPCIAPreAuthorization method. It allows you to perform a card-not-present pre-authorization using stored or directly provided card details — without redirecting the user.
Ideal for background transactions, subscription holds, or merchant-initiated holds on a saved card.
Class Overview
- Namespace:
Mypos\IPC - Located at:
IAPreAuthorization.php - Extends:
Mypos\IPC\Base - Purpose: Create a server-side (merchant-initiated) pre-authorization using direct card input.
Method Summary
| Method | Return Type | Description |
|---|---|---|
__construct(Config $cnf) | - | Initializes the class with IPC configuration. |
setOrderID(string $orderID) | IAPreAuthorization | Unique identifier for the transaction. |
getOrderID() | string | Returns the order ID. |
setItemName(mixed $itemName) | IAPreAuthorization | Name of the item or service. |
getItemName() | mixed | Retrieves the item name. |
setAmount(mixed $amount) | IAPreAuthorization | Amount to authorize (not yet captured). |
getAmount() | mixed | Returns the pre-auth amount. |
setCurrency(string $currency) | IAPreAuthorization | ISO 4217 currency code (e.g., EUR). |
getCurrency() | string | Returns the currency. |
setNote(string $note) | IAPreAuthorization | Optional text note for internal use. |
getNote() | string | Returns the note. |
setCard(Card $card) | IAPreAuthorization | Pass a Card object with card details or token. |
getCard() | Card | Returns the assigned Card object. |
validate() | bool | Validates all required fields. |
process() | Response | Initiates the IPC request and returns a response object. |
Inherited from Base
Includes IPC SDK core helpers:
_addPostParam()
_processPost(), _processHtmlPost()
getCnf(), setCnf()
getOutputFormat(), setOutputFormat()
isValidSignature()
Example Usage
use Mypos\IPC\Config;
use Mypos\IPC\IAPreAuthorization;
use Mypos\IPC\Card;
$config = new Config();
// Set SID, Wallet, keys, etc.
$card = new Card();
$card->setCardNumber('4111111111111111')
->setExpMM('12')
->setExpYY('26')
->setCvc('123')
->setCardHolder('John Doe');
$preAuth = new IAPreAuthorization($config);
$preAuth->setOrderID('PREAUTH-20250410-XYZ')
->setAmount(100.00)
->setCurrency('EUR')
->setItemName('Conference Booking')
->setNote('Hold for reservation')
->setCard($card);
if ($preAuth->validate()) {
$response = $preAuth->process();
echo "Pre-authorization successful!";
} else {
echo "Validation failed.";
}
Use cases
Use the IAPreAuthorization class when:
- You want to hold funds without capturing immediately
- You're processing payments with stored cards or direct card entry
- You need full control over the transaction server-side
- The customer is not actively present during the transaction (MIT/CIT logic)