Payments

Payments

Payments API
A tutorial can be found here.

Classes

Terminal

Methods

(async) cancelTransaction(reference) → {Promise.<Void>}

Will cancel a pending transaction.
Note: If the transaction does not confirm as being cancelled you must ensure that you perform a reversal using the void transaction type

Parameters:
Name Type Description
reference TransactionReference

The reference information for this transaction

(async) isPaired() → {Promise.<Boolean>}

Check if the payment terminal is paired

(async) onCardInfo(cb, opts) → {Promise.<module:Payments~EventUnsubscriber>}

Register an event handler for the Card Info event

Parameters:
Name Type Description
cb onCardInfo

Callback to call when this event is fired

opts EventEmitterOptions

Config options for the event handler

(async) onTerminalAttached(cb, opts) → {Promise.<module:Payments~EventUnsubscriber>}

Register an event handler for the Terminal Attached event

Parameters:
Name Type Description
cb function

Callback to call when this event is fired

opts EventEmitterOptions

Config options for the event handler

(async) onTerminalConnected(cb, opts) → {Promise.<module:Payments~EventUnsubscriber>}

Register an event handler for the Terminal Connected event

Parameters:
Name Type Description
cb function

Callback to call when this event is fired

opts EventEmitterOptions

Config options for the event handler

(async) onTerminalDisconnected(cb, opts) → {Promise.<module:Payments~EventUnsubscriber>}

Register an event handler for the Terminal Disconnected event

Parameters:
Name Type Description
cb function

Callback to call when this event is fired

opts EventEmitterOptions

Config options for the event handler

(async) onTerminalRemoved(cb, opts) → {Promise.<module:Payments~EventUnsubscriber>}

Register an event handler for the Terminal Removed event

Parameters:
Name Type Description
cb function

Callback to call when this event is fired

opts EventEmitterOptions

Config options for the event handler

(async) onTerminalUiEvent(cb, opts) → {Promise.<module:Payments~EventUnsubscriber>}

Register an event handler for the Terminal UI event
Click here for some sample event data.
View a full list of UI Events here

Parameters:
Name Type Description
cb onTerminalUiEvent

Callback to call when this event is fired

opts EventEmitterOptions

Config options for the event handler

(async) onTransactionStatus(cb, opts) → {Promise.<module:Payments~TransactionStatus>}

Register an event handler for the Transaction status event

Parameters:
Name Type Description
cb onTransactionStatus

Callback to call when this event is fired

opts EventEmitterOptions

Config options for the event handler

(async) pairSilent() → {Promise.<Boolean>}

Run the silent pairing process, this will return a value representing if the pairing was successful.

(async) startTransaction(transactionType, reference, charges, options) → {Promise.<module:Payments~TransactionResult>}

Will request a transaction for the amount provided, it will keep the provided reference a long with the transaction for future accounting.

Parameters:
Name Type Description
transactionType TransactionType

The type of transaction to start

reference TransactionReference

The reference information for this transaction

charges Charges

The charges associated with this transaction

options Options

The optional configuration for this transaction

Throws:

(async) status() → {Promise.<module:Payments~PaymentStatus>}

Register an event handler for the Payment System status event