Learn how to receive card payments from your customers
The aim of this document is to assist you in initiating card payment acceptance from your custom application running on the Nomba Android terminal. If you encounter any difficulties with this process, feel free to reach out for support.
Trigger card payments - available since NombaX Application v1.6.0
This following code snippet serves as a foundation for triggering card payment events on the Nomba terminal. Adjustments to the amount, transaction reference, and other parameters can be easily made based on specific application requirements.
Copy
const val PAYMENT_OPTION_INTENT = "com.nomba.pro.feature.payment_option.ACTION_VIEW"const val AMOUNT_DATA = "amount"const val MERCHANT_TX_REF = "merchantTxRef"const val TXN_RESULT = "txnResultData"const val RECEIPT_OPTIONS = "receiptOptions"val resultString = mutableStateOf("")//setup a launcher that would help launch the intentvar paymentOptionLauncher = registerForActivityResult( ActivityResultContracts .StartActivityForResult()) { result -> val data: Intent? = result.data if (result.resultCode == Activity.RESULT_OK) { resultString.value = data?.getStringExtra(TXN_RESULT) ?: "null" }}//setup an intent to be triggeredval intent = Intent(PAYMENT_OPTION_INTENT)//put the amount to be chargedintent.putExtra(AMOUNT_DATA, "300")//tie a reference to the paymentintent.putExtra(MERCHANT_TX_REF, "1234567890")//handle receipt mediumval receiptOptionsMap = hashMapOf( "print" to true, "sms" to false, "email" to false)val receiptOptionsString = Json.encodeToString(serializer<HashMap<String, Boolean>>(), receiptOptionsMap)intent.putExtra(RECEIPT_OPTIONS, receiptOptionsString)//launch the intentpaymentOptionLauncher.launch(intent)
Please ensure to pass the amount as kobo i.e. 200 will charge your customer NGN 2.00