Take a payment

Register the result launcher, check NFC status, and start NFC or QR transactions.

Handling results

Call BlincPosSdk.registerLauncher() once in Activity.onCreate(), before setContent. This registers the result callback the SDK uses to return the payment outcome.

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    BlincPosSdk.registerLauncher(this) { result ->
        when (result.status) {
            TransactionResult.Status.SUCCESS -> {
                val txnId    = result.transactionId
                val amount   = result.amount   // in kobo, e.g. 100 = 1.00 NGN
                val currency = result.currency
                // Print receipt or update UI
            }
            TransactionResult.Status.CANCELLED -> {
                // User cancelled
            }
            else -> {
                val error = result.message
                // Show error dialog
            }
        }
    }
}

TransactionResult fields

FieldTypeDescription
statusStatusSUCCESS, FAILED, CANCELLED, or DEBITSUCCESSFUL (reserved; not emitted in this version, so always keep an else branch)
transactionIdString?Unique transaction reference (SUCCESS only)
messageString?Human-readable error or status message
amountLong?Settled amount in kobo
currencyString?Currency code, e.g. "NGN"
narrationString?Payment narration from the consumer app
transactionDateString?Settlement timestamp from the backend
senderNameString?Paying customer's account name
senderAccountNumberString?Paying customer's account number
beneficiaryNameString?Merchant beneficiary account name
beneficiaryAccountIdString?Merchant beneficiary account ID
responseCodeString?Raw processor response code ("00" on success)

NFC status

Check the device NFC state before starting an NFC transaction:

NfcStatusMeaning
AVAILABLE_ENABLEDNFC hardware present and switched on; safe to proceed
AVAILABLE_DISABLEDNFC hardware present but turned off; prompt the user to enable it
NOT_AVAILABLEDevice has no NFC hardware; fall back to QR
HCE_NOT_SUPPORTEDNFC present but Host Card Emulation unsupported on consumer device; fall back to QR
when (BlincPosSdk.getNfcStatus(context)) {
    NfcStatus.AVAILABLE_ENABLED  -> startNfcTransaction()
    NfcStatus.AVAILABLE_DISABLED -> promptUserToEnableNfc()
    NfcStatus.NOT_AVAILABLE,
    NfcStatus.HCE_NOT_SUPPORTED  -> startQrTransaction()
}

Dedicated POS terminals and HCE

Many dedicated POS terminals report HCE_NOT_SUPPORTED because they operate in reader mode rather than card-emulation mode. This is expected: the SDK handles the reader-mode tap flow automatically. Use the status only to decide between NFC and QR fallback for the customer's device.

Starting transactions

Always call ensureRegistered() first. The methods below assume registration is complete.

Option A: NFC payment (preferred)

BlincPosSdk.startTransactionWithNFC(
    context        = this,
    amount         = 250000L,                    // 2,500.00 NGN in kobo
    metadata       = "{\"orderId\":\"ORD-99\"}",  // optional JSON string
    onPrintReceipt = { result ->
        // Called when merchant taps "Print Receipt".
        // Pass null to hide the button entirely.
        printReceipt(result)
    }
)

Option B: QR code payment

BlincPosSdk.startTransactionWithQR(
    context        = this,
    amount         = 250000L,
    metadata       = "{}",
    onPrintReceipt = { result -> printReceipt(result) }
)

Option C: Merchant-entered amount

Pass null for amount to let the SDK display an on-screen keypad for the cashier:

BlincPosSdk.startTransactionWithNFC(
    context = this,
    amount  = null
)

Transaction method parameters

ParameterTypeDescription
contextContextActivity or application context
amountLong?Amount in kobo. null shows merchant keypad.
metadataStringOptional JSON string for custom data. Default: "{}"
onPrintReceipt((TransactionResult) -> Unit)?Callback when merchant taps Print Receipt. null hides the button.

Did this page help you?