hobex_hps library

Dart client for the hobex Payment Service (HPS) local REST API.

The HPS runs on the payment terminal itself (e.g. a Sunmi device with the hobex Android system) and exposes a plain JSON API on http://localhost:8080 without authentication. This package wraps that API in a typed client.

final hps = HpsClient(tid: '3600335'); // talks to http://127.0.0.1:8080
final res = await hps.payment(amount: 1.00);
print(res.isApproved ? res.approvalCode : res.responseText);

Classes

Diagnosis
Result of GET /api/terminals/{tid}/diagnosis — a health snapshot of the terminal and its connection to the hobex host.
HpsClient
Client for the local hobex Payment Service (HPS) REST API.
TransactionResponse
Result of a transaction request (payment, refund, pre-auth, capture, void, AVT) or of a transaction-status (v2) query.

Enums

Cvm
Cardholder Verification Method.
HpsTransactionType
Numeric transaction type as sent in the request body of the /api/transaction/payment route.

Exceptions / Errors

HpsConnectionException
Thrown when the HPS could not be reached at all (socket error, timeout, connection refused, …).
HpsException
Base class for all errors thrown by this package.
HpsHttpException
Thrown when the HPS responds with a non-2xx HTTP status code.