SDK Integration for Offline Payment

11. SDK Integration for Offline Payment

Some merchants facilitate customers to make offline payment at their partner establishments. This section provides integration details for such offline payments.

11.1 Instantiate SDK

See Instantiate SDK for details.

11.2 Initialize payment

See Initialize Payment for details.

Note: For offline payment, if holding fee is applicable, send it in initialize-payment request. Refer to the following code sample to see how to send holding fee. Front end needs to have a provision to accept
holding fee.

// Set holding fee to mPointInitializePaymentInfo builder if holding fee is present
paymentInfo.holdingFees = Holding Fee amount

When creating Airline Data or Order Info for offline payment, pass the holding fee details as shown in the following code:

var lineItem = mPointLineItem(...)

lineItem.addAdditionalData("session_token", sessionToken)
lineItem.addAdditionalData("hold_fee_amount", holdFee)
lineItem.addAdditionalData("hold_fee_currency_code", currencyCode)
lineItem.addAdditionalData("hold_period", holdPeriod)

Note: The setAuthToken parameter can be optional or required, depending on merchant requirement.

11.3 Authorize Payment

When you initialize a payment for offline methods, send the authorize call to the SDK to process payment as shown in the following sample:

var addressInfo = [mPointAddressInfo]  
var authToken = [AUTH_TOKEN] 


Note: The setAuthToken parameter can be optional or required, depending on merchant requirement.

11.4 Presentment Currency

See Presentment Currency for details.

Note: Consider the following items:

  • If you use FX opt-in and FX opt-out, send the mPointForeignExchangeInfo object in subsequent calls such as authorize.
  • To create mPointForeignexchangeinfo object for offline method flow, set isDccOpted as false.
  • For mPointForeignexchangeinfo object, set value for service type id as PCC_OPT_OUT. The process is similar to FX Opt-out Transaction.

11.5 Payment Confirmation

Implement the displayPaymentConfirmation call back method to receive the transaction status as shown in the following code sample:

override fun displayPaymentConfirmation(txn: mPointTxnInfo?, code: Int, mpoint: mPoint) {
        Log.d(TAG, "displayPaymentConfirmation")

11.5.1 Handle Error

When using the split payment option, 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(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?) {
            runOnUiThread {
                var pendingAmount: Long = 0
                if(null != arrListTxnStatusInfo && arrListTxnStatusInfo.size > 0){
                    for (txnStatusInfo : mPointTxnStatusInfo in arrListTxnStatusInfo){
                        // Retrieve Pending Amount
                        pendingAmount = txnStatusInfo.pendingAmount
                when (paymentStatus) {
                    // Poll getTxnStatus()
           -> {
                        if(pendingAmount == 0L)
                            // Split Payment Successful
                            // Retry Payment with Pending Amount
           -> {
                        // Retry Payment with Pending Amount

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 until 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 action 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 retries are 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:


Refer to Handle Error for details.

11.5.2 Handle Status

Refer to Handle Status for details.