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.
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.
| Function definition | Purpose | Parameters |
|---|---|---|
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 |
| Parameter | Type | Description | Required |
|---|---|---|---|
amount | String | The pre-auth limit (the amount to set as the initial maximum amount for the pre-auth), in cents. | Required |
integratedReceipt | Boolean | Indicate whether receipts will be printed on the POS (true) or on the terminal (false). | Required |
mid | Integer | Override 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 |
tid | Integer | Override 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 |
integrationKey | String | Supply 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 |
transactionId | String | Supply a transaction ID to be used for the transaction. | Optional |
The steps to be followed to initiate a pre-auth are given as follows:
- 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
integratedReceiptboolean (trueorfalse) 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 tofalse. - The POS is required to use the
mid,integrationKey, andtidparameters if multi-merchant or headless pairing is used, or if your browser does not support local storage.
- The POS calls
initiateOpenPreAuth(requestParams, transactionCallbacks)with the requestParams included. - The POS must also reference the callback functions in the function invocation — the callback functions are responsible for handling the response.
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
});
}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.
| Function | Description | Required |
|---|---|---|
transactionCompleteCallback | Invoked 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 |
| Field | Type | Description | Usage required |
|---|---|---|---|
result | String | One 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 |
cardType | String | The scheme displayed on the card (Visa, Mastercard, etc). | Optional |
transactionReference | String | Also 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 |
authorisationCode | String | The Scheme's reference to the transaction. Quote this number to Visa/Mastercard/etc if the issue is on their end. | Optional |
issuerActionCode | String | The raw result code returned by the card issuer. | Optional |
elidedPan | String | The (elided) card number used for this transaction. | Optional |
rrn | String | The 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 |
preAuthCompletionReference | String | Tyro's reference to a PreAuth Completion. | Required |
customerReceipt | String | Text 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 |
{
"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"
}
| Function definition | Purpose | Parameters |
|---|---|---|
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 |
| Parameter | Type | Description | Required |
|---|---|---|---|
completionReference | String | preAuthCompletionReference from the original open pre-auth response. | Required |
amount | String | The amount is mandatory and the POS must declare it; make sure that the amount is in cents. | Required |
mid | Integer | Override 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 |
tid | Integer | Override 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 |
integrationKey | String | Supply 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 |
transactionId | String | Supply a transaction ID to be used for the transaction. | Optional |
The steps to be followed to initiate an increment pre-auth are given as follows:
- 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, andtidparameters if multi-merchant or headless pairing is used, or if your browser does not support local storage.
- The POS calls
initiateIncrementPreAuth(requestParams, transactionCallbacks)with the requestParams included. - The POS must also reference the callback functions in the function invocation — the callback functions are responsible for handling the response.
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);
}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.
| Function | Description | Usage required |
|---|---|---|
responseReceivedCallback | Invoked 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 |
| Field | Type | Description | Usage required |
|---|---|---|---|
result | String | The result of the request, will be either success or failure. | Required |
incrementalAmount | String | The value of the amount that the open pre-auth amount has been incremented by, in cents. | Required |
panLastFourDigits | String | The last 4 digits of the card PAN. | Optional |
{
"result": "APPROVED",
"incrementalAmount": "5000",
"panLastFourDigits": "1234"
}
| Function definition | Purpose | Parameters |
|---|---|---|
Boolean completePreAuth(requestParams, responseReceivedCallback) | Close a previously opened pre-auth with a final amount. The customer will be charged. | completionReference, amount (both required) |
| Parameter | Type | Description | Required |
|---|---|---|---|
completionReference | String | Transaction identifier from the original open pre-auth request. | Required |
amount | String | The 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 |
The steps to be followed to initiate a complete pre-auth request are given as follows:
- The POS specifies the amount and the completion reference for the pre-auth in the
amountand thecompletionReferenceparameters in the requestParams object of thecompletePreAuthfunction. - The POS is required to program the function required to handle the response payload delivered by
responseReceivedCallbackand reference them in the function invocation correctly.
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);
}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.
| Function | Description | Usage required |
|---|---|---|
responseReceivedCallback | Invoked 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 |
| Field | Type | Description | Usage required |
|---|---|---|---|
result | String | The result of the request, will be either success or failure. | Required |
message | String | A message to display to the merchant. | Required |
{
"result": "success",
"message": "Complete preAuth request accepted"
}| Function definition | Purpose | Parameters |
|---|---|---|
Boolean voidPreAuth(requestParams, responseReceivedCallback) | Void a previously opened pre-auth. This discards the hold on funds in the customer's account. | completionReference (required) |
| Parameter | Type | Description | Required |
|---|---|---|---|
completionReference | String | Transaction identifier from the original open pre-auth request. | Required |
The steps to be followed to initiate a void pre-auth request are given as follows:
- The POS specifies the completion reference for the void request in the
completionReferenceparameter in the requestParams object of thevoidPreAuthfunction. - The POS is required to program the function required to handle the response payload delivered by
responseReceivedCallbackand reference them in the function invocation correctly.
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);
}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.
| Function | Description | Usage required |
|---|---|---|
responseReceivedCallback | Invoked 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 |
| Field | Type | Description | Usage required |
|---|---|---|---|
result | String | The result of the request, will be either success or failure. | Required |
message | String | A message to display to the merchant. | Required |
{
"result":"success",
"message":"Void preAuth request accepted"
}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.