verifyTransaction static method

Future<Transaction> verifyTransaction({
  1. String? trxIdentifier,
  2. String? txReference,
})

Verify a transaction status via Paygate API.

trxIdentifier is the identifier of the transaction to verify. txReference is the transaction reference provided by Paygate. Throws an ArgumentError if either the trxIdentifier and the txReference are null.

Implementation

static Future<Transaction> verifyTransaction({
  String? trxIdentifier,
  String? txReference,
}) async {
  if (trxIdentifier == null && txReference == null) {
    throw ArgumentError(
      'Either trxIdentifier or txReference must be provided',
    );
  }

  if (trxIdentifier == null) {
    return await _verifyTransactionV1(txReference!);
  } else {
    return await _verifyTransactionV2(trxIdentifier);
  }
}