Cancel a Transaction
"Cancelling" a ToP transaction is actually two distinct SDK operations, depending on whether a result has already come back:
- Abort an in-flight transaction — the user backs out, or you need to stop waiting for a card tap, before any result has arrived.
- Void a completed purchase — the transaction already succeeded and you need to reverse it.
The original source document described a single
tapSDK.cancelTransaction(amount, cardType, transId, uniqueId, orderId)
call. That method name doesn't exist in the working SDK — the real,
production-verified call is cancelPurchase, documented below under
Void a Completed Purchase, and it takes an
appId parameter rather than cardType (see why below).
Abort an In-Flight Transaction
tapSDK.abortTransaction();
Takes no parameters. Call this any time after
startTransactionFlow if you need to stop the flow
before a result is returned — for example, if your own UI has a cancel
button while waiting for the card tap.
Void a Completed Purchase
tapSDK.cancelPurchase(amount, appId, transId, uniqueId, orderId);
| Parameter | Type | Notes |
|---|---|---|
amount | String | No decimal point — same format as Start a Transaction. |
appId | String | The EMV Application Identifier from the original transaction's result, e.g. "A0000000031010". See appId vs. cardType. |
transId | String | The transID from the original transaction's result. |
uniqueId | String | Same uniqueId used to start the original transaction. |
orderId | String | Same orderId used to start the original transaction. |
Example:
tapSDK.cancelPurchase("1000", "A0000000031010", "134436", uniqueId, orderId);
appId vs. cardType
The original source document's sample used a cardType parameter with
example values like "VISA", "MASTERCARD", "MYDEBIT". The real SDK call
takes appId — the EMV Application Identifier (e.g. "A0000000031010") —
which is a different field from the transaction result, not just a
rename:
| Result field | Example value | Use for cancelPurchase |
|---|---|---|
appId | A0000000031010 | Yes — pass this straight through as appId. |
cardLabel | VISA | No — this is a display label, not accepted by cancelPurchase. |
Both fields come back on the original transaction's result — see Flow Overview for the full result field reference.