cancel method

Future<TransactionResponse> cancel({
  1. required String transactionId,
  2. required num amount,
  3. String? currency,
  4. String? language,
  5. bool technicalCancel = false,
})

Voids / cancels / reverses an existing transaction identified by transactionId. Must be activated by hobex.

amount ist ERFORDERLICH: das Terminal weist einen Void ohne Betrag mit 400 Missing amount ab. Die REST-PDF v1.13 listet den Parameter zwar nicht, die Postman-Collection und die Firmware verlangen ihn; am 26.08.2026 am HPS nachgemessen und bestaetigt. currency/language fallen auf die Client-Defaults zurueck.

Die Antwort auf diesen Aufruf betrifft die AUFHEBUNG selbst: gemessen responseCode '0', transactionType 'VOID', eigener Beleg, originalTransactionId auf die Originalzahlung -- und eine EIGENE, neue transactionId fuer die Aufhebung. Die hier uebergebene transactionId bleibt die der Originalzahlung; eine spaetere Statusabfrage darauf liefert deren Zustand, nicht den der Aufhebung (siehe HpsPayments.cancel).

Set technicalCancel to indicate a technical cancellation.

Implementation

Future<TransactionResponse> cancel({
  required String transactionId,
  required num amount,
  String? currency,
  String? language,
  bool technicalCancel = false,
}) {
  _checkTransactionId(transactionId, 'transactionId');
  final lang = language ?? defaultLanguage;
  final uri = _uri('api/transaction/payment/$tid/$transactionId', {
    'amount': amount.toString(),
    'currency': currency ?? defaultCurrency,
    'language': ?lang,
    if (technicalCancel) 'technicalCancel': 'true',
  });
  return _sendTransactionUri('DELETE', uri, null);
}