12.6 Display Payment Confirmation

Velocity Android Software Development Kit Integration Guide

Implement the displayPaymentConfirmation callback method to receive confirmation of payment as shown in the following sample.

override fun displayPaymentConfirmation(txnInfo: mPointTxnInfo?, code: Int, mpoint: mPoint?) {
}

When using split payment option and after getting callback in displayPaymentConfirmation, you need to call getTxnStatus method to retrieve status of the transactions. When calling the getTxnStatus, pass session ID (available in mPoint class) to retrieve all transactions from the current session.

To call getTxnStatus, use the following code sample:

if(isSplitPaymentApplicable){
    	if(mpoint!!.sessionId != null && mpoint.sessionId.isNotEmpty()){
   		mPoint.delegate = this
mPoint.getTxnStatus(-1, "", mpoint.sessionId, clientInfo)
  	  }
}

To get transaction statuses response implement following delegate method:

override fun handleTxnStatus(arrListTxnStatusInfo: ArrayList<mPointTxnStatusInfo>?, paymentStatus: Int, arrListLinkedTransactions: ArrayList<mPointLinkedTransactions>?, mPoint: mPoint?) {
        when (paymentStatus) {
           MPOINT_PAYMENT_STATUS_PENDING.id -> // Payment is Pending
           MPOINT_PAYMENT_STATUS_COMPLETE.id -> // Payment is Successful
           MPOINT_PAYMENT_STATUS_FAILED.id -> { // Payment is Failed
                        var pendingAmount: Long = 0
                        if(null != arrListTxnStatusInfo && arrListTxnStatusInfo.size > 0){
                        for (txnStatusInfo : mPointTxnStatusInfo in arrListTxnStatusInfo){
                                // Retrieve Pending Amount
                                pendingAmount = txnStatusInfo.pendingAmount
                            }
                        }
                      }
    }

The merchant front end reads the response received to know the payment status. Read the paymentStatus parameter to know the status of the payment. If a transaction status has payment status as:

  • Pending: call the getTxnStatus API again till you get the payment status either as Successful or Failed.
  • Complete: the payment is successful.
  • Failed: retry the payment.

To retry the payment, initialize the payment with the pending amount. This helps a customer complete the payment using any option.

Send the pending amount you received from back end in the initialize request. After you initialize, a customer can complete the payment using any available payment option or can split the payment. This process repeats until the transaction is successful, fails, or maximum retry is attempted.

Note: If a customer decides not to retry a failed payment, call the Post-Status API as shown in the following code sample to notify that the session is complete.

mPoint.postStatus(mPoint.sessionId