hobex_hps 0.1.0 copy "hobex_hps: ^0.1.0" to clipboard
hobex_hps: ^0.1.0 copied to clipboard

Dart & Flutter client for the hobex Payment Service (HPS) local REST API: card payments, refunds, pre-auth and voids on hobex / Sunmi card terminals.

Kreiseck โ€“ Software Solutions

hobex_hps

Dart & Flutter client for the hobex Payment Service (HPS) local REST API.
Card payments, refunds, pre-auth, voids and diagnosis on hobex / Sunmi card terminals โ€” no SDK lock-in.

pub package pub points License: MIT by Kreiseck

Unofficial. This is an independent, community-maintained client and is not affiliated with, endorsed by, or supported by hobex. "hobex" is a trademark of its respective owner.

The hobex Payment Service (HPS) runs directly on the payment terminal (e.g. a Sunmi device with the hobex Android system) and exposes a plain JSON API on http://localhost:8080 without authentication. hobex_hps wraps that API in a small, typed, dependency-light Dart client: card payments, refunds, pre-authorizations, captures, voids, account verification, transaction status and terminal diagnosis โ€” ideal for POS / cash-register (Kassensystem) apps built with Dart or Flutter.

Features #

  • ๐Ÿ’ณ Sale, pre-authorization, capture, pre-auth cancel
  • โ†ฉ๏ธ Refund (incl. referenced refund), void / reversal, abort
  • ๐Ÿ”Ž Transaction status (v2), batch totals / close, terminal diagnosis
  • ๐Ÿงพ Fully typed response (approvalCode, masked PAN, brand, CVM, receipt no. โ€ฆ) plus the raw JSON
  • ๐Ÿชถ Pure Dart, a single dependency (http), usable in any Flutter app
  • โœ… Declines are normal results โ€” not thrown exceptions

Install #

dependencies:
  hobex_hps: ^0.1.0

Quick start #

import 'package:hobex_hps/hobex_hps.dart';

// On the terminal the default base URL (http://127.0.0.1:8080) is correct.
final hps = HpsClient(tid: '3600335'); // โš ๏ธ TID without leading zero

// Safe, non-financial health check.
final diag = await hps.diagnosis();
print(diag); // deviceStatus=IN_OPERATION, hps=1.8.4, test=true ...

// A โ‚ฌ1.00 sale โ€” the terminal prompts for a card and this awaits the flow.
final res = await hps.payment(amount: 1.00, reference: 'order-42');
if (res.isApproved) {
  print('OK ${res.brand} ${res.cardNumber}  approval=${res.approvalCode}');
} else {
  print('Declined: ${res.responseCode} ${res.responseText}');
}

hps.close();

Operations #

Method HPS endpoint
payment(amount:) POST /api/transaction/payment (type 1)
preAuth(amount:) POST /api/transaction/preauth
preAuthCapture(preAuthTransactionId:, amount:) POST /api/transaction/preauthcapture
preAuthCancel(preAuthTransactionId:, amount:) DELETE /api/transaction/preauth
refund(amount:, originalTransactionId:) POST /api/transaction/refund
cancel(transactionId:) DELETE /api/transaction/payment/{tid}/{txId}
abort(transactionId:) POST /api/transaction/abort/{tid}/{txId}
accountVerification() POST /api/transaction/avt/
transactionStatus(transactionId:) GET /api/v2/transactions/{tid}/{txId}
diagnosis() GET /api/terminals/{tid}/diagnosis
batchTotals(since) GET /api/terminals/{tid}/batchtotal/{dateTime}
closeBatch(since) GET /api/terminals/{tid}/closebatch/{dateTime}

Notes #

  • TID without leading zero โ€” e.g. 3600335, not 03600335.
  • On-device the app calls localhost:8080; that address never changes even though the device's LAN IP (DHCP) might.
  • Amounts are major units (1.50 = โ‚ฌ1,50).
  • A declined payment is returned as a TransactionResponse with isApproved == false. Exceptions (HpsHttpException, HpsConnectionException) are only thrown for HTTP/transport errors.
  • responseCode == "0" means approved.
  • Refund / void / pre-auth must be activated by hobex for the account (otherwise the HPS returns 403).

Maintainer #

Built and maintained by Kreiseck โ€“ Software Solutions โ€” a software studio from Salzburg, Austria, focused on custom POS / cash-register (Kassensystem) software, mobile apps and payment-terminal integrations.

License #

MIT ยฉ Ali Aktas Kreiseck โ€“ Software Solutions. See LICENSE.

0
likes
160
points
50
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart & Flutter client for the hobex Payment Service (HPS) local REST API: card payments, refunds, pre-auth and voids on hobex / Sunmi card terminals.

Homepage

Topics

#payments #pos #terminal #ecr #flutter

License

MIT (license)

Dependencies

http

More

Packages that depend on hobex_hps