Custom Card Read

Follow these steps to perform a custom card read.
  1. Retrieve the
    ReadCardIntent
    value from the
    mposUi
    object and use the
    startActivity
    method to initiate the card read flow.
    val ReadCardIntent = mposUi.createReadCardIntent() startActivityForResult(ReadCardIntent, MposUi.REQUEST_CODE_READ_CARD)
  2. After the card read activity is completed, the
    onActivityResult
    method is triggered. This action returns information about the status of the card read activity and the card details.
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == MposUi.REQUEST_CODE_READ_CARD) { when (resultCode) { // Result code from a successful card read MposUi.RESULT_CODE_READ_CARD_SUCCESS -> { Toast.makeText(findViewById(android.R.id.content), "Card read successful", Toast.LENGTH_LONG).show() } // Result code from a failed card read MposUi.RESULT_CODE_READ_CARD_FAILED -> { Toast.makeText(findViewById(android.R.id.content), "Card read failed", Toast.LENGTH_LONG).show() } } } }