1.0.24 • Published 2 years ago
@mvault/terminal v1.0.24
Mvault Terminal
Mvault terminal is a module that provides differents way to use a Terminal Reader. It facilitate you things such as discovering connecting and collecting. Bellow you I'll find all you need to use Mvaul terminal
Usage/Examples
// terminal is a global variable, you don't neet to import it
const events = terminal.events()
// initialize terminal sdk (Must be connected using @mvault/auth with 'role' provider)
terminal.init()
// discover readers arround you ( method = 'Internet' || 'BluetoothProximity')
terminal.discover(method).then(() => {
events.on('readers', (readers) => {
if (readers.length) {
// connect the desired reader
terminal.connect(readers[0])
}
})
})
// collect payment with charge params
// subscribe to user instructions - these should be displayed to the user
events.on('display', (display) => {
// show instructions to user
})
events.on('input', (input) => {
// show input informations to user
})
terminal.collect(charge)
Terminal Reference
Initialize terminal
terminal.init()
Required You must be authenticated using @mvault/auth
Discover Reader
terminal.discover(method,simulated) <Promise>
Parameter | Type | Description |
---|---|---|
mehod | string | Required. |
simulated | Bool | Default false. |
Connect Reader
terminal.connect(reader)
Parameter | Type | Description |
---|---|---|
reader | object | Required. reader from Discover |
Collect Charge
terminal.collect({transaction, amount, order, app}) <Promise>
Parameter | Type | Description |
---|---|---|
amount | integer | Required. amount in cents |
Reader
reader()
Return informations about the Reader
Install Update
terminal.installUpdate()
Return the progress
Register Reader
terminal.registerReader(registration_code) <Promise>
Parameter | Type | Description |
---|---|---|
registration_code | integer | Requirered |
Cancel Discover
terminal.cancelDiscover()
It cancel a discover
Cancel Collect
terminal.cancelCollect()
It cancel a payment collect
Events
terminal.events.on(event, callback)
Parameter | Type | Description |
---|---|---|
event | string | Required. |
callback | func | Required. returns event data |
events
event | Description |
---|---|
redears | Required. returns array of readers |
display | Required. returns instructions from payment to user |
input | Required.returns input informations (swipe/tap/insert) |
update | Required. returns update progress from 0 to 1 |
1.0.24
2 years ago
1.0.23
2 years ago
1.0.22
2 years ago
1.0.21
2 years ago
1.0.20
2 years ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago