Skip to main content

Documentation

External Approval Flow

Some integrations require the calling app to perform its own card verification (for example, a store loyalty card) and then tell Core whether to approve or decline.

How it works
  1. Start the transaction with WAIT_FOR_APPROVAL = "true" in the parameters.

  2. Core reads the card and broadcasts ACTION_CARD_DATA with card details.

  3. Your app performs its own verification logic.

  4. Your app calls sendApprovalResult to tell Core to approve or decline.

  5. Core finalises the transaction and broadcasts TRANSACTION_RESULT_ACTION.

// Step 1 — start the transaction and request a pause for approval
HashMap<String, String> params = new HashMap<>();
params.put(Parameters.WAIT_FOR_APPROVAL, "true");
params.put(Parameters.AUTO_VOID_ON_APPROVAL_TIMEOUT, "true"); // auto-void if you don't respond
Api.startTransaction(amount, TransactionType.SALE, params, context);
// Step 2 — receive card data in your BroadcastReceiver
case Messages.ACTION_CARD_DATA: {
    String cardData = intent.getStringExtra(Messages.CARD_DATA);
    String uti      = intent.getStringExtra(Messages.TRANSACTION_UTI);
    // Perform your own verification...
    break;
}
// Step 4 — send the approval decision
Api.sendApprovalResult(context, true);   // true = approve, false = decline

Note

If AUTO_VOID_ON_APPROVAL_TIMEOUT = "true" and sendApprovalResult is not called within the timeout window, Core automatically voids the transaction.

Update amount (discount cards)

If your verification logic results in a price change (for example a discount), call sendUpdatedAmount before calling sendApprovalResult:

Api.sendUpdatedAmount(context, discountedAmount);
Api.sendApprovalResult(context, true);