Split Payment

Velocity Android Software Development Kit Integration Guide

The split payment option allows customers to split the payment into equal amounts or to enter amounts to split the payment. To allow split payments, you need to check initialize payment response. If a split payment is available, you get split payment node in the response with all required details. You need to read the details from the initialize-payment response. See func override fun displayAvailablePayments(availablePayments: mPointAvailablePayments?, mpoint: mPoint?) {} for how to read split payment node.

After you read the split payment node as shown in above method, you have an array of split payment combinations of type mPointSplitCombination. Store that array for later use. It is the responsibility of the front end to give a UI which provides the customer a toggle switch to choose to split a payment or not. The front end also has to filter and select an appropriate combination object from the combinations array to perform a split payment transaction using the appropriate payment type.

The table below lists the payment type IDs for various form of payments.

Payment methodPayment Type ID
Card1
Voucher2
Wallet3
APM4

The following options are currently available combinations to perform split payment:

  • Card + Card
  • Voucher + Card
  • Voucher + APM
  • Voucher + Wallet

The combination object has an array of mPointSplitPaymentType which includes payment type ID, sequence, and a boolean property is_one_step_authorization. To perform a split payment with Card + Card, the front end needs to filter and send a combination object with Payment Type ID as 1 for both the sequences. Similarly, the front end needs to filter and send an appropriate combination object in the authorize request to perform a split payment with other forms of payments.

The is_one_step_authorization property has an important role to play in a split payment ecosystem. If is_one_step_authorization value is true, the authorize request needs to include details of both forms of payment. If it is false, the authorize request needs to be called separately for both forms of payment.

After the completion of the first authorize request, the front end needs to call getTxnStatus api, from override fun displayPaymentConfirmation(txn: mPointTxnInfo?, code: Int, mpoint: mPoint) {} method. The response is returned in handleTxnStatus method shown below. If the is_one_step_authorization value is true, you need to poll getTxnStatus api until it returns a success or failure. If value of is_one_step_authorization is false, you need to read the pending amount from the response and make an initialise payment request with that pending amount and session ID.

Refer to the below sample code sample to understand how to call authorize, getTxnStatus and initialize methods.

🚧

Note: This code sample is taken from our application to give you an idea of how to integrate or call any given method on mPoint SDK. You need to implement your own classes wherever required.

The code show below is a sample of the calling authorize with split payment method with Card + Card.

var mPointSplitCombination: mPointSplitCombination? = null
var priceInfo: PriceInfo? = null
 
for(splitCombination in this.splitPayment!!.splitCombinations){
    for(paymentType in splitCombination.paymentType){
        if(paymentType.id == mPointCardInfo.PAYMENT_TYPES.CARD.id ){
            mPointSplitCombination = splitCombination
        }
    }
}
 
priceInfo = PriceInfo(getCountryCode(country),
                    (((tempAmount.toFloat()) * getDecimalPointMultiplierFromCurrencyId(currencyCode)).roundToLong()),
                    null, null, null, currencyCode,  -1)                  
                                       
if(null != mPointSplitCombination && null != priceInfo && isSplit){
        _mPoint.authorize(mPointAuthorizeInfo(cardtype)
            .setClientInfo(clientInfo)
            .setViaAuthToken(true)
            .setPassword(authToken)
            .setCardNo(java.lang.Long.valueOf(cardNumer))
            .setCardExpMonth(Integer.parseInt(expiryMonth))
            .setCardExpYear(Integer.parseInt(expiryYear))
            .setCvc(tempCvv).setNameOnCard(cardName)
            .setStoreCard(isSaveCard)
            .setCardValidFromMonth(validMonth.toInt())
            .setCardValidFromYear(validYear.toInt())
            .setForeignExchangeOffer(foreignExchangeInfo)
            .setAddressInfo(addressInfo)
            .addAdditionalData(additionalData)
            .setInstallmentValue(installmentValue)
            .setPendingSplitAmount(priceInfo)
            .setSplitCombinations(mPointSplitCombination))
}