Authorization Class

The Authorization class handles the IPCAuthorization method and allows merchants to perform pre-authorizations using direct card input (like PAN, expiry, CVC) in a card-not-present flow.

Ideal for server-side card validations, bookings, or merchant-initiated holds on customer cards.

Overview

The IPCAuthorization method allows you to reserve funds on a customer’s card without capturing them immediately. This is useful for scenarios such as hotel bookings, car rentals, or delayed fulfillment, where you want to ensure funds are available before providing goods or services.

Key Points:

  • Funds are held (not captured) and can be captured later using IPCAuthorizationCapture.
  • Authorization expires if not captured within the allowed period (typically 30 days, but may vary by card issuer).
  • You can reverse an authorization with IPCAuthorizationReverse if you no longer need to capture the funds.

Request Parameters

ParameterTypeRequiredDescription
AmountDoubleYesThe amount to be authorized.
CurrencyStringYes3-letter ISO currency code (e.g., EUR, USD).
OrderIDStringYesUnique merchant-side reference for the transaction (up to 80 characters).
SIDStringYesYour myPOS Store ID.
WalletNumberStringYesYour myPOS Client Number.
KeyIndexIntYesIndicates which key pair is being used for signature.
CardTokenStringYes*Required if using a stored card.
ItemNameStringYesName of the product/service.
CardObjectYes*Required if using direct card input (PAN, Expiry, CVC, Cardholder).
NoteStringNoOptional comment.
OutputFormatStringNoResponse format: XML (default) or JSON.

Either CardToken or Card object must be provided.

Workflow

  1. Build the Authorization request with all required parameters.
  2. Send the request to myPOS using the Authorization class.
  3. Receive a response with the authorization status and a unique transaction reference (IPCTrnref).
  4. Capture the funds later using AuthorizationCapture or reverse the hold with AuthorizationReverse.

Example Usage

use Mypos\IPC\Config;
use Mypos\IPC\Authorization;
use Mypos\IPC\Card;

$config = new Config();
// Configure SID, wallet, private/public keys, etc.

$card = new Card();
$card->setCardNumber('4111111111111111')
     ->setExpMM('12')
     ->setExpYY('26')
     ->setCvc('123')
     ->setCardHolder('Jane Doe');

$auth = new Authorization($config);
$auth->setOrderID('AUTH-ORDER-20250410')
     ->setItemName('Equipment Rental')
     ->setAmount(120.00)
     ->setCurrency('EUR')
     ->setNote('Authorization for damage deposit')
     ->setCard($card);

if ($auth->validate()) {
    $response = $auth->process();
    echo "Authorization successful!";
} else {
    echo "Authorization validation failed.";
}

Response Properties

ParameterTypeDescription
AmountDoubleEchoed from your request.
CurrencyStringEchoed from your request.
OrderIDStringEchoed from your request.
IPCTrnrefStringUnique transaction reference for further operations.
StatusInt0 means success; any other value indicates an error.
StatusMsgStringHuman-readable result of the transaction.
SignatureStringBase64-encoded signature for response verification.

Use Cases

Use the Authorization class when:

  • You want to reserve funds on a customer’s card without immediate capture.
  • You’re building automated systems that use direct card input.
  • You need merchant-initiated transactions (MIT) for reservations, security deposits, or verification holds.
  • You operate in an environment where redirects are not possible (e.g., in-app or back-office flows).

For full protocol details, see the official myPOS documentation.