terminal-gateway
v1.0.20
Published
POS SDK is a library that allows users to perform sale transactions on a terminal from a web browser.
Downloads
5
Readme
Terminal
Browser Support
| | | --- | --- | --- | Latest ✔ | Latest ✔ | Latest ✔ |
Installation
Using npm:
$ npm install terminal-gateway
Using yarn:
$ yarn add terminal-gateway
Congfiguration
| 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 |
Initiation
import Terminal from 'terminal-gateway'
const terminal = new Terminal({
key: '',
timeout: 50000,
onSuccess: () => {}
onError: () => {}
});
Sale transaction
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 | |
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'
});
Void transaction
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 |
Cancelation transaction
onCancel(): This method allows the cancellation of the sale of the transaction.
terminal.onCancel()