Skip to content
Last updated

Pre-authorisation

Pre-authorisation lets a merchant reserve funds on a customer's card upfront, without charging them yet. Once the final amount is known, the merchant charges up to that reserved limit.

Take a hotel booking as an example. At check-in, the front desk pre-authorises $2,500 against the guest's card as a limit for their stay. Nothing is charged yet; the amount is only held. Over the stay, the guest charges meals to the room at the restaurant and drinks from the minibar. At checkout, the hotel closes the pre-authorisation for the actual total, up to the $2,500 limit, and the guest is charged that final amount instead of the original $2,500.

Pre-auth lifecycle

Step 1

Initiate a pre-authorisation

The POS initiates a pre-authorisation request for a set limit. This is the maximum amount that can later be charged.

Before you begin, check the certification criteria: Certification Criteria Document.

Opening a pre-auth

Function definitionPurposeParameters
Boolean initiateOpenPreAuth(requestParams, transactionCallbacks)Initiates a request to open a pre-auth on the terminal.requestParams (Object); transactionCallbacks (Object) — the set of callback functions to provide feedback and the transaction result, see Handling the response below
ParameterTypeDescriptionRequired
amountStringThe pre-auth limit (the amount to set as the initial maximum amount for the pre-auth), in cents.Required
integratedReceiptBooleanIndicate whether receipts will be printed on the POS (true) or on the terminal (false).Required
midIntegerOverride the configured mid for multi-merchant terminals, or if your browser does not support local storage, or if you have developed headless pairing as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
tidIntegerOverride the configured tid for multi-merchant terminals or if your browser does not support local storage or if you have implemented headless pairing as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
integrationKeyStringSupply the integration key if your browser does not support local storage or if you have developed headless pairing or multi-merchant as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
transactionIdStringSupply a transaction ID to be used for the transaction.Optional

Making the request

The steps to be followed to initiate a pre-auth are given as follows:

  1. The POS sets the parameters that comprise the requestParams object as per the requirements of the specific transaction request. These parameters include:
    • amount — the amount is mandatory and the POS must declare it; make sure that the amount is in cents and that the data type is String.
    • The integratedReceipt boolean (true or false) to indicate whether the POS or the Tyro terminal is responsible for printing the receipts returned during the course of the transactions. The receipt data will not be returned to the POS if this is set to false.
    • The POS is required to use the mid, integrationKey, and tid parameters if multi-merchant or headless pairing is used, or if your browser does not support local storage.
  2. The POS calls initiateOpenPreAuth(requestParams, transactionCallbacks) with the requestParams included.
  3. The POS must also reference the callback functions in the function invocation — the callback functions are responsible for handling the response.

Example

Given below is an example request for a $100.00 integrated open pre-auth request where the POS is printing the integrated receipts, i.e. the receipts are being printed through the POS.

function doPreAuth(amount) {
    iclient.initiateOpenPreAuth({
        amount: amount,
        integratedReceipt: true
    }, {
        receiptCallback: receiptCallbackImpl,
        transactionCompleteCallback: transactionCompleteCallbackImpl
    });
}

Handling the response

The response to the open pre-authorisation request is returned to the POS by iClient using transactionCompleteCallback at the completion of the open pre-auth request. If the request is successful, the POS will be provided the result and the preAuthCompletionReference field, along with other relevant fields. The POS must display the result for the user's reference and store the pre-auth completion reference in the sale invoice to allow the pre-auth to be closed off or voided.

FunctionDescriptionRequired
transactionCompleteCallbackInvoked when the transaction has been completed on the terminal. Called with a subset of the following parameters as part of the transactionData object, as shown in the below table.Required
FieldTypeDescriptionUsage required
resultStringOne of the following values: APPROVED, CANCELLED, REVERSED, DECLINED, SYSTEM ERROR, NOT STARTED, UNKNOWN. The merchant will only receive money if this value is APPROVED. UNKNOWN means the merchant should look at the terminal to determine what happened. Typically this would indicate a network error.Required
cardTypeStringThe scheme displayed on the card (Visa, Mastercard, etc).Optional
transactionReferenceStringAlso known as a STAN, this is Tyro's reference to this transaction. Quote this to Tyro Customer Support if you run into any issues with a transaction.Optional
authorisationCodeStringThe Scheme's reference to the transaction. Quote this number to Visa/Mastercard/etc if the issue is on their end.Optional
issuerActionCodeStringThe raw result code returned by the card issuer.Optional
elidedPanStringThe (elided) card number used for this transaction.Optional
rrnStringThe Retrieval Reference Number is a unique number generated by the Payment Service for a specific merchant. Guaranteed to be unique for a 7-day period.Optional
preAuthCompletionReferenceStringTyro's reference to a PreAuth Completion.Required
customerReceiptStringText representation of the Tyro receipt intended for the customer. Only included if integrated receipt printing is enabled. Formatted to be printed in a monospaced font.Optional — usage required if Integrated receipt printing has been developed as a feature
Response example
{
  "result": "APPROVED",
  "transactionId": "e378fb4c327daa4474d86aea89c9aabfe7c2",
  "cardType": "Visa",
  "transactionReference": "298143",
  "authorisationCode": "695585",
  "issuerActionCode": "00",
  "elidedPan": "XXXXXXXXXXXXXX8641",
  "rrn": "2981431109",
  "preAuthCompletionReference": "431721",
  "baseAmount": "102.00",
  "transactionAmount": "102.00",
  "customerReceipt": " CUSTOMER COPY \n\n Merchant 8811 \n Address line 1 \n Address line 2 \n\n Tyro EFTPOS \n\nVisa\nCard: XXXXXXXXXXXXXX8641(s)\n\nPreAuth AUD $102.00\n\nAPPROVED 00\n\nA hold has been placed on\nyour account in the amount\nof $102.00. When the tab is\nclosed, up to $102.00 will\nbe debited from your\naccount.\n\nCompletion Ref: 431721\n\nTerminal ID: 123\nTransaction Ref: 298143\nAuthorisation No: 695585\n09 Nov 2021 at 08:59 PM\n"
}

Incrementing a pre-auth

Function definitionPurposeParameters
Boolean initiateIncrementPreAuth(requestParams, transactionCallbacks)Initiates a request to increment an already open pre-auth on the terminal.requestParams (Object); responseReceivedCallback (Object) — invoked to indicate success or failure
ParameterTypeDescriptionRequired
completionReferenceStringpreAuthCompletionReference from the original open pre-auth response.Required
amountStringThe amount is mandatory and the POS must declare it; make sure that the amount is in cents.Required
midIntegerOverride the configured mid for multi-merchant terminals, or if your browser does not support local storage, or if you have developed headless pairing as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
tidIntegerOverride the configured tid for multi-merchant terminals or if your browser does not support local storage or if you have implemented headless pairing as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
integrationKeyStringSupply the integration key if your browser does not support local storage or if you have developed headless pairing or multi-merchant as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
transactionIdStringSupply a transaction ID to be used for the transaction.Optional

Making the request

The steps to be followed to initiate an increment pre-auth are given as follows:

  1. The POS sets the parameters that comprise the requestParams object as per the requirements of the specific transaction request. These parameters include:
    • completionReference — the transaction identifier from the original open pre-auth response; make sure the data type is String.
    • amount — the amount is mandatory and the POS must declare it; make sure that the amount is in cents and that the data type is String.
    • The POS is required to use the mid, integrationKey, and tid parameters if multi-merchant or headless pairing is used, or if your browser does not support local storage.
  2. The POS calls initiateIncrementPreAuth(requestParams, transactionCallbacks) with the requestParams included.
  3. The POS must also reference the callback functions in the function invocation — the callback functions are responsible for handling the response.

Example

Given below is an example request for a $100.00 integrated increment pre-authorisation request.

var amt = '10000';
var ref = 12001

function doIncrementPreAuth(ref, amt){
requestParams ={amount: amt, completionReference: ref}
 iclient.initiateIncrementPreAuth(requestParams, responseReceivedCallbackImpl);
}

Handling the response

The response to the increment pre-auth request is returned to the POS by iClient using responseReceivedCallback at the completion of the increment pre-auth request. If the request is successful, the POS will be provided the result, the incremented amount, and the last 4 digits of the card PAN in the result, incrementalAmount, and panLastFourDigits fields — the POS must use them to display the result and the message for the user's reference, and adjust the open pre-auth amount with the increment.

FunctionDescriptionUsage required
responseReceivedCallbackInvoked when the request has been completed on the terminal. Called with a single object containing the following fields, as shown in the below table.Required
FieldTypeDescriptionUsage required
resultStringThe result of the request, will be either success or failure.Required
incrementalAmountStringThe value of the amount that the open pre-auth amount has been incremented by, in cents.Required
panLastFourDigitsStringThe last 4 digits of the card PAN.Optional
Response example
{
  "result": "APPROVED",
  "incrementalAmount": "5000",
  "panLastFourDigits": "1234"
}

Closing a pre-auth

Function definitionPurposeParameters
Boolean completePreAuth(requestParams, responseReceivedCallback)Close a previously opened pre-auth with a final amount. The customer will be charged.completionReference, amount (both required)
ParameterTypeDescriptionRequired
completionReferenceStringTransaction identifier from the original open pre-auth request.Required
amountStringThe amount that the pre-auth is being closed for. Maximum value can be the pre-auth maximum amount after any successful increments (maximum amount to charge the customer), in cents.Required

Making the request

The steps to be followed to initiate a complete pre-auth request are given as follows:

  1. The POS specifies the amount and the completion reference for the pre-auth in the amount and the completionReference parameters in the requestParams object of the completePreAuth function.
  2. The POS is required to program the function required to handle the response payload delivered by responseReceivedCallback and reference them in the function invocation correctly.

Example

Given below is an example request for a $100.00 integrated completePreAuth request.

var amount = '10000';
var completionReference = '12001';

function doClosePreAuth(amount,completionReference)
 {
    iclient.completePreAuth({amount: amt, completionReference: ref}, responseReceivedCallbackImpl);
}

Handling the response

The response to the complete pre-auth request is returned to the POS by iClient using responseReceivedCallback at the completion of the complete pre-auth request. If the request is successful, the POS will be provided the result and an additional message in the result and the message fields — the POS must use them to display the result and the message for the user's reference, and mark the pre-auth request as closed off.

FunctionDescriptionUsage required
responseReceivedCallbackInvoked when the request has been completed on the terminal. Called with a single object containing the following fields, as shown in the below table.Required
FieldTypeDescriptionUsage required
resultStringThe result of the request, will be either success or failure.Required
messageStringA message to display to the merchant.Required
Response example
{
  "result": "success",
  "message": "Complete preAuth request accepted"
}

Voiding a pre-auth

Function definitionPurposeParameters
Boolean voidPreAuth(requestParams, responseReceivedCallback)Void a previously opened pre-auth. This discards the hold on funds in the customer's account.completionReference (required)
ParameterTypeDescriptionRequired
completionReferenceStringTransaction identifier from the original open pre-auth request.Required

Making the request

The steps to be followed to initiate a void pre-auth request are given as follows:

  1. The POS specifies the completion reference for the void request in the completionReference parameter in the requestParams object of the voidPreAuth function.
  2. The POS is required to program the function required to handle the response payload delivered by responseReceivedCallback and reference them in the function invocation correctly.

Example

Given below is an example request for a $100.00 integrated voidPreAuth request.

var completionReference = '12001';

function doVoidPreAuth(completionReference) {
requestParams = {completionReference:ref};
    iclient.voidPreAuth(requestParams, responseReceivedCallbackImpl);
}

Handling the response

The response to the void pre-auth request is returned to the POS by iClient using responseReceivedCallback at the completion of the void pre-auth request. If the request is successful, the POS will be provided the result and an additional message in the result and the message fields — the POS must use them to display the result and the message for the user's reference, and mark the pre-auth request as voided. If the request is unsuccessful, the POS must likewise use result and message to display the result and the error message for the user's reference.

FunctionDescriptionUsage required
responseReceivedCallbackInvoked when the request has been completed on the terminal. Called with a single object containing the following fields, as shown in the below table.Required
FieldTypeDescriptionUsage required
resultStringThe result of the request, will be either success or failure.Required
messageStringA message to display to the merchant.Required
Response example
{
  "result":"success",
  "message":"Void preAuth request accepted"
  }

Demo

JS Fiddle demo — open a pre-auth with a specified limit, then close it off with an amount you specify, or void it.

Don't click Save if you make changes in the JS Fiddle — click Run instead. Clicking Save may break the fiddle's functionality.