Latest ✔ | Latest ✔ | Latest ✔ |
Using npm:
$ npm install terminal-gateway
Using yarn:
$ yarn add terminal-gateway
Key | Type | Default | Description |
---|---|---|---|
key | String | provide by ABA | |
timeout | Number |
60000 in milliseconds |
The Terminal's expiration time |
onSuccess | Function | The callback function will respond with two parameters | |
onError | Function | The callback function will respond with two parameters |
import Terminal from 'terminal-gateway'
const terminal = new Terminal({
key: '',
timeout: 50000,
onSuccess: () => {}
onError: () => {}
});
onSale(): This method allows you to do sale transactions. user needs to call this function to get the result failed or successful. It is required four parameters:
Parameter name | Data type | Require | Default | Description |
---|---|---|---|---|
amount | String | Yes | 0 | amount define transaction |
type | String | Yes | SHOWQR | SHOWQR: sale by screen QR codeEDC: sale by card |
invoice | String | Yes | The invoice number must be unique. Example: INV0011620291635 |
``` javascript terminal.onSale({amount: '0.01', type: 'SHOWQR', currency: 'USD', invoice: 'INV0011620291635'}); ``` ## Enquiry transaction __onEnquiry():__ This method allows you to receive the response back with the result status of the transaction whether it's successful or failed. It is required a parameter:
Parameter name | Data type | Require | Default | Description |
---|---|---|---|---|
invoice | String | Yes | The invoice number must be unique. example: INV0011620291635
|
terminal.onEnquiry({invoice: 'INV0011620291635'});
onVoid(): This method allows you to void the transaction. It is required a parameter:
Parameter name | Data type | Require | Default | Description |
---|---|---|---|---|
traceId | String | Yes | trace number of sale transaction response |
onCancel(): This method allows the cancellation of the sale of the transaction.
terminal.onCancel()