Skip to main content

JavaScript SDK — Objects Reference

This page documents every object, enum, and option type used in the Handpoint JavaScript SDK (@handpoint/cloud-js-sdk).


OperationStartedResult​

Returned synchronously by every financial operation (except tipAdjustment).

FieldTypeDescription
transactionReferencestringUUID generated client-side before the card is presented. Persist this to your database immediately, before await transactionResult. Used for recovery.
transactionResultPromise<TransactionResult>Resolves with the final transaction outcome once the terminal delivers it via Pusher WebSocket.
const { transactionReference, transactionResult } = hp.sale('1000', 'USD');
await db.savePendingTransaction(transactionReference); // persist FIRST
const result = await transactionResult;

TransactionResult​

The final outcome object resolved from transactionResult.

FieldTypeDescription
finStatusFinancialStatusPrimary outcome field. The financial status of the transaction. Always check this first.
efttransactionIDstringHandpoint-assigned unique transaction ID. Use this for reversals, linked refunds, and tip adjustments.
transactionIDstringTerminal's internal transaction counter.
totalAmountnumberActual charged amount in the minor unit of currency, including tip. May differ from requestedAmount if tip was added.
requestedAmountnumberAmount originally sent to the terminal.
tipAmountnumberTip amount in the minor unit of currency.
tipPercentagenumberTip percentage selected by the cardholder (if a tip percentage menu was shown).
dueAmountnumberRemaining amount after a partial approval (US only). Collect this in another payment form.
cardTokenstringCard PAN token. Only present on tokenizeCard or saleAndTokenization operations.
customerReceiptstringURL to the customer receipt, or an HTML string if the upload to Handpoint servers failed. See Receipt handling.
merchantReceiptstringURL to the merchant receipt, or an HTML string if the upload to Handpoint servers failed.
signatureUrlstringURL to a signature image, or base64-encoded binary if the upload failed. See Signature handling.
maskedCardNumberstringMasked PAN, e.g. "************1456".
cardSchemeNameCardSchemeNameCard scheme name as emitted by the terminal, e.g. 'VISA', 'MASTERCARD'.
cardEntryTypeCardEntryTypeHow the card was read (chip, contactless, swipe, CNP).
recoveredTransactionbooleantrue if this result was delivered via the recovery loop rather than the primary Pusher connection.
originalEFTTransactionIDstringFor reversal results — the efttransactionID of the original transaction that was reversed.
currencyCurrencyISO 4217 currency code of the transaction.
authorisationCodestringAcquirer authorisation code.
errorMessagestringHuman-readable error description for failed transactions.
metadataMetadataThe metadata object echoed from the request, if provided.
cardHolderNamestringCardholder name as read from the card.
paymentScenarioPaymentScenarioHow the card interacted with the terminal (chip, contactless, swipe, MOTO).
tenderTypeTenderTypeWhether the card is CREDIT or DEBIT.
typeTransactionTypeThe type of transaction (SALE, REFUND, VOID_SALE, etc.).
verificationMethodVerificationMethodCVM method used: PIN, SIGNATURE, PIN_SIGNATURE, NOT_REQUIRED, etc.
multiLanguageStatusMessagesMapTerminal status messages in multiple languages.
multiLanguageErrorMessagesMapError messages in multiple languages.
aidstringEMV Application Identifier of the card (EMV tag 9F06).
arcstringEMV Authorisation Response Code (EMV tag 8A).
balanceBalanceBalance available on the card (contactless only).
budgetNumberstringUsed to split payments over a period of months (budget/installment number).
cardLanguagePreferencestringPreferred language of the card (EMV tag 5F2D).
chipTransactionReportstringFull report of the card EMV parameters.
customerReferencestringEchoed from options.customerReference in the transaction request, if provided.
deviceStatusDeviceStatusStatus of the payment terminal at the time of the transaction.
efttimestampstringUnix epoch timestamp of the transaction (based on the terminal's clock).
expiryDateMMYYstringExpiry date of the card used for the operation, in MMYY format (e.g. "0426").
iadstringEMV Issuer Application Data (EMV tag 9F10).
issuerResponseCodestringResponse code from the card issuer (e.g. "00" for approved).
merchantAddressstringMerchant address as configured in the terminal.
merchantNamestringMerchant name as configured in the terminal.
midstringMerchant Identifier.
rrnstringRetrieval Reference Number — unique number assigned by the acquirer.
statusMessagestringHuman-readable terminal status message (e.g. "Approved or completed successfully").
tidstringTerminal Identifier.
tsistringEMV Transaction Status Information (EMV tag 9B).
tvrstringEMV Transaction Verification Results (EMV tag 95).
unMaskedPanstringFull unmasked PAN. Only present for non-payment cards (e.g. loyalty cards).

Reading the result​

const result = await transactionResult;

switch (result.finStatus) {
case 'AUTHORISED':
// Transaction approved — save efttransactionID for potential reversal
await db.markPaid({
efttransactionID: result.efttransactionID,
amount: result.totalAmount,
receipt: result.customerReceipt
});
break;
case 'PARTIAL_APPROVAL':
// US only — funds partially approved, remainder needed
console.log(`Approved ${result.totalAmount}, still owe ${result.dueAmount}`);
// Collect remainder in another payment form, OR reverse this transaction
break;
case 'DECLINED':
case 'CANCELLED':
case 'FAILED':
await db.clearPending(transactionReference);
break;
}

Receipt handling​

customerReceipt and merchantReceipt can be either:

  • A URL — the receipt has been uploaded to Handpoint servers. Redirect the browser or print the page.
  • An HTML string — the upload failed due to a connectivity issue. The SDK returns the raw HTML instead.
function displayReceipt(value) {
if (value.startsWith('http')) {
window.open(value); // URL — open in browser
} else {
document.getElementById('receipt').innerHTML = value; // HTML — render inline
}
}

Signature handling​

signatureUrl can be either:

  • A URL — the signature image has been uploaded to Handpoint servers.
  • A base64-encoded binary — the upload failed. Prefix with the appropriate data URI scheme to display it.
function displaySignature(value) {
if (value.startsWith('http')) {
document.getElementById('sig').src = value; // URL
} else {
document.getElementById('sig').src = 'data:image/png;base64,' + value; // base64
}
}

Balance​

Balance available on the card. Present on contactless transactions where the terminal retrieves the balance from the card.

FieldTypeDescription
amountnumberBalance amount in the minor unit of currency.
currencyCurrencyISO 4217 currency code of the balance.
positivebooleantrue if the balance is positive.
negativebooleantrue if the balance is negative.
{
"balance": {
"amount": 1000,
"currency": "EUR",
"negative": false,
"positive": true
}
}

DeviceStatus​

Status of the payment terminal. Returned inside TransactionResult.deviceStatus and TransactionStatus.deviceStatus (status callback).

FieldTypeDescription
SerialNumberstringSerial number of the payment terminal.
BatteryStatusstringBattery charge level as a percentage (e.g. "100").
BatterymVstringBattery voltage in millivolts (e.g. "4134").
BatteryChargingstringBattery charging status (e.g. "Charging", "Not Charging").
ExternalPowerstringExternal power source description (e.g. "USB").
ApplicationNamestringName of the application running on the terminal.
ApplicationVersionstringVersion of the application running on the terminal.
bluetoothNamestringBluetooth interface name of the terminal.
statusMessagestringStatus message from the terminal (e.g. "Approved or completed successfully").

SaleOptions​

Options object for sale(), saleAndTokenization(), preAuthorization(), moToSale().

PropertyTypeDefaultDescription
customerReferencestring—Arbitrary string echoed in the result for cross-reference with your own system
tokenizebooleanfalseEnable card tokenization during the payment flow
duplicate_checkbooleantrueWhether to enable duplicate transaction detection. Set to false to bypass the duplicate check prompt.
tipConfigurationTipConfiguration—Configure the tipping menu shown on the terminal
bypassOptionsBypassOptions—Skip PIN or signature verification steps
merchantAuthMerchantAuth[]—Route the transaction to a specific merchant in a multi-MID setup
metadataMetadata—Up to 5 arbitrary strings echoed in the result
moneyRemittanceOptionsMoneyRemittanceOptions—Required for Mastercard money remittance (MCC 4829 and 6540)

RefundOptions​

Options object for refund(), moToRefund().

PropertyTypeDefaultDescription
customerReferencestring—Arbitrary string echoed in the result
tokenizebooleanfalseEnable card tokenization
duplicate_checkbooleantrueEnable duplicate transaction detection
bypassOptionsBypassOptions—Skip PIN or signature
merchantAuthMerchantAuth[]—Multi-MID routing
metadataMetadata—Up to 5 arbitrary strings echoed in the result
moneyRemittanceOptionsMoneyRemittanceOptions—Mastercard remittance options

MerchantAuthOptions​

Options for saleReversal(), refundReversal().

PropertyTypeDescription
customerReferencestringArbitrary string echoed in the result
merchantAuthMerchantAuth[]Multi-MID routing credentials

Options​

Base options object for tokenizeCard(), moToReversal(), preAuthorizationReversal().

PropertyTypeDescription
customerReferencestringArbitrary string echoed in the result
metadataMetadataUp to 5 arbitrary strings echoed in the result

MerchantAuth / Credential​

A single element in the merchantAuth array. Overrides the MID/TID/MCC configured on the terminal for a specific transaction, enabling multi-merchant terminal usage.

PropertyTypeDescription
acquirerAcquirerThe acquirer this credential set applies to
midstringMerchant ID override
tidstringTerminal ID override
mccstringMerchant category code override
externalIdstringAlternative to MID/TID/MCC — Handpoint looks up credentials by this ID
const merchantAuth = [{
acquirer: 'TSYS',
mid: '11111',
tid: '22222',
mcc: '5411'
}];

TipConfiguration​

Configures the tip selection menu displayed on the terminal.

PropertyTypeDescription
baseAmountstringThe base amount (before tip) shown on the tip screen
headerNamestringCustom header text displayed at the top of the tip screen (e.g. 'Tip')
footerstringCustom footer text displayed at the bottom of the tip screen (e.g. 'Thank you!')
skipEnabledbooleanWhether the cardholder can skip the tip prompt
enterAmountEnabledbooleanWhether the cardholder can enter a custom tip amount
tipPercentagesnumber[]Array of tip percentage options to display (e.g. [5, 10, 15, 20])
const tipConfiguration = {
headerName: 'Tip',
baseAmount: '1000',
skipEnabled: true,
enterAmountEnabled: true,
tipPercentages: [10, 15, 18, 20],
footer: 'Thank you!'
};

BypassOptions​

PropertyTypeDescription
pinBypassbooleanSkip the PIN entry prompt. Note: chip-enforced cards will still require PIN.
signatureBypassbooleanSkip the signature capture step

Metadata​

Up to five arbitrary string fields attached to a transaction and echoed in the TransactionResult.

PropertyTypeMax lengthDescription
metadata1string250 charsCustom field 1
metadata2string250 charsCustom field 2
metadata3string250 charsCustom field 3
metadata4string250 charsCustom field 4
metadata5string250 charsCustom field 5

Valid characters: a-z A-Z 0-9 - ( ) @ : % _ \ + . ~ # ? & / = { } " ' ,


MoneyRemittanceOptions​

Required for Mastercard transactions under MCC 4829 (Money Transfer) and MCC 6540 (Prepaid Top-up).

PropertyTypeDescription
fullNamestringFull name of the money recipient (alphabetic characters only, a-Z)
countryCodestringDestination country code (ISO 3166-1 alpha-3, e.g. 'USA', 'GBR')

BatchSummaryResponse​

Returned by hp.batchSummary().

FieldTypeDescription
batchNumberstringBatch identifier
batchStatusstringCurrent status of the batch
batchSummaryGuidstringUnique ID for this summary response
transactionCountnumberNumber of transactions in the batch
netAmountnumberNet total in minor currency unit
customFieldsArray<{key, value}>Additional acquirer-specific fields
customerReferencestringEchoed customer reference
httpStatusnumberHTTP status code from the acquirer
issuerResponseCodestringAcquirer response code
issuerResponseTextstringAcquirer response description

BatchDetailResponse​

Returned by hp.batchDetail().

FieldTypeDescription
httpStatusnumberHTTP status code from the acquirer
batchNumberstringBatch identifier
batchStatusstringCurrent batch status
issuerResponseCodestringAcquirer response code
issuerResponseTextstringAcquirer response text
batchDetailGuidstringUnique ID for this detail response
detailsArrayTransaction list entries: {transactionType, amount, batchDetailElementGuid}

BatchCloseResponse​

Returned by hp.closeBatch().

FieldTypeDescription
batchNumberstringBatch identifier
closeBatchGuidstringUnique ID for this close operation
closedAtstringISO 8601 timestamp of when the batch was closed
customerReferencestringEchoed customer reference
httpStatusnumberHTTP status code from the acquirer
issuerResponseCodestringAcquirer response code
issuerResponseTextstringAcquirer response text

Enumerations​

FinancialStatus​

The primary result field in TransactionResult. Always check finStatus to determine outcome.

ValueMeaningAction
'AUTHORISED'Transaction approved by the acquirerFulfil order, store efttransactionID
'DECLINED'Declined by the acquirer or card issuerAsk cardholder to try another card
'CANCELLED'Cardholder pressed Cancel, or stopCurrentTransaction() was calledClear pending
'FAILED'Technical failure — network error, unreadable card, etc.Card was not charged. Clear pending.
'PARTIAL_APPROVAL'Funds partially approved (US only)Collect remainder with another payment method, or reverse the partial approval
'PROCESSED'printReceipt operation completed successfullyReceipt printed
'IN_PROGRESS'(getTransactionStatus only) Transaction known to the gateway but no final result yetPoll again in 10 s
'REFUNDED'(getTransactionStatus only) Original sale has been fully refundedNo action required
'CAPTURED'Pre-authorization captured; funds moving to merchantUpdate order status
'UNDEFINED'(getTransactionStatus only) Transaction not found in the gateway after 90 sCard was not charged. Safe to clear pending.

CardEntryType​

How the card was read at the terminal.

ValueDescription
'UNDEFINED'Entry method not determined
'MSR'Magnetic stripe read
'ICC'Chip (EMV) contact read
'CNP'Card not present (MOTO) — card data entered manually

CardSchemeName​

Card network string as emitted by the terminal firmware (always uppercase). Confirmed from live terminal captures: VISA, MASTERCARD, DISCOVER, AMEX.

Value
'VISA'
'MASTERCARD'
'MAESTRO'
'AMEX'
'DISCOVER'
'JCB'
'DINERS'
'UNIONPAY'
'INTERAC'

PaymentScenario​

How the card interacted with the terminal.

ValueDescription
'UNKNOWN'Interaction type not determined
'MAGSTRIPE'Magnetic stripe swipe
'MAGSTRIPECONTACTLESS'Contactless magnetic stripe
'CHIP'EMV chip contact
'CHIPCONTACTLESS'EMV chip contactless (tap)
'CHIPFAILMAGSTRIPE'Chip read failed, fell back to magnetic stripe
'MOTO'Mail order / telephone order — manual card entry

TenderType​

ValueDescription
'CREDIT'Credit card
'DEBIT'Debit card
'PREPAID'Prepaid card
'NOT_SET'Unknown — common on MOTO and cancelled transactions

TransactionType​

ValueDescription
'UNDEFINED'Type not determined
'SALE'Sale
'VOID_SALE'Sale reversal
'REFUND'Refund
'VOID_REFUND'Refund reversal
'CANCEL_SALE'Sale cancelled before authorisation
'CANCEL_REFUND'Refund cancelled before authorisation
'TOKENIZE_CARD'Card tokenization
'CARD_PAN'PAN retrieval
'CANCEL_TRX'Generic transaction cancel
'MOTO_SALE'MOTO sale
'MOTO_REFUND'MOTO refund
'MOTO_REVERSAL'MOTO reversal
'SALE_AND_TOKENIZE_CARD'Sale + tokenization
'UPDATE'Software update operation
'PRINT_RECEIPT'Print receipt operation

VerificationMethod​

Cardholder verification method used.

ValueDescription
'UNDEFINED'CVM not determined
'SIGNATURE'Cardholder signed
'PIN'PIN entered
'PIN_SIGNATURE'Both PIN and signature
'FAILED'CVM failed
'NOT_REQUIRED'No CVM required (low-value contactless)
'MOBILE_PASS_CODE'Mobile wallet passcode

Acquirer​

Used in MerchantAuth credential objects.

Value
'AMEX'
'BORGUN'
'EVO'
'OMNIPAY'
'POSTBRIDGE'
'INTERAC'
'TSYS'
'VANTIV'
'SANDBOX'

Currency​

ISO 4217 currency codes. Common values:

ValueCurrency
'AED'UAE Dirham
'AUD'Australian Dollar
'CAD'Canadian Dollar
'CHF'Swiss Franc
'DKK'Danish Krone
'EUR'Euro
'GBP'British Pound Sterling
'HKD'Hong Kong Dollar
'JPY'Japanese Yen
'MXN'Mexican Peso
'NOK'Norwegian Krone
'NZD'New Zealand Dollar
'SEK'Swedish Krona
'SGD'Singapore Dollar
'USD'US Dollar
'ZAR'South African Rand

The SDK accepts any valid ISO 4217 three-letter code.


See also​