Integrating SDK

6. Integrating SDK

Velocity SDK enables asynchronous communication using the delegate/interface pattern. The SDK enables your mobile application to implement the methods defined by mPoint payment interface.

To integrate the payment methods using the Velocity SDK, complete the following steps:

  1. Integrate the SDK using the CPD credentials for communicating with Velocity POP.
    1. Add the SDK path in Gradle file with specific version provided by CPD.

    Note: The versions of these files are updated at regular intervals. Check with the CPD technical team if you have the latest version.

    1. Add nexus repository path in Gradle file
    2. Run Gradle Build command.
  2. allprojects {
                repositories {
    maven {
    url = uri("")
    credentials {
    username = "default-read"
    password = "CPMRead4321"
  3. Instantiate the SDK using the CPD credentials for communicating with Velocity POP.
  4. Initializing a payment using the SDK involves the following tasks:
    1. Invoke the initialize method on the SDK instance.
    2. Handle the SDK call back through the selected payment method.
    3. Construct the graphical user interface (GUI) for enabling customers to make payment using their selected payment method.
  5. Note: Instantiating and initializing a payment are common to all payment methods such as card payment, save cards, APM, and wallet.

  6. Implement the following interfaces:
    1. mPointWalletDelegate
    2. mPointSchemeOwnerDelegate
    3. mPoint3DSecureDelegate
    4. mPointDelegate
    5. mPointWebViewDelegate
    6. mPointSchemeOwnerDelegate
    7. mPointForeignExchangeDelegate
    8. mPointGetBalanceDelegate

You can authorize a payment with an SDK for one of the following payment methods:

  • Card payment
  • APM
  • Wallet
  • Aggregators
  • Offline Payments
  • Vouchers
  • Split Payment

Note: CPD recommends you implement the following call back error methods for error handling in your application:

  • handleStatus is called for high-level errors when the back-end rejects the request and returns one or more status codes giving the reason, or for operations that do not return any data, where the back-end returns the operation status.
  • handleError is called for low-level errors such as network connectivity problems.

Note: For handling web-view redirects, SDK supports devices with Android 5.0 (application programming interface, or API, level 21) and above only.

6.1 Instantiate SDK

To instantiate the SDK, you must:

  • Implement interfaces.
  • Ensure that you have all the prerequisites.

Instantiate the SDK by providing the appropriate configuration details as shown in the following code sample:

this._mpoint = mPoint(URL ("[CPD provided URL]"),  
        "password", [PASSWORD]  
        clientid, [CLIENT ID]  
        accountid, [ACCOUNT ID]  
        RecordMap<String, String> (), 
this._mpoint.mode = mPoint.OUTPUT_MODE.NONE)

Note: Instantiating the SDK is common for all payment methods.

6.2 Initialize Payment

Initialize the payment transaction by invoking the initialize method of SDK as shown in the following code sample:

var mobile: Long = [MOBILE NUMBER];
var email: String = "[EMAIL ID]";
var countryId = CountryConfig.USA;   //[AMOUNT] for USA
var currencyId = [CURRENCY_ID]
var operatorId = countryId * 100;
var amount = [AMOUNT];
amount= amount*100;
var orderID : String = "[ORDER ID NUMBER]";
var mPointOrderInfo = [ORDER_INFO_AID_DATA]
var txnType: String = mPointTxnInfo.TXN_TYPES. MPOINT_SHOPPING_ONLINE; // An example of Search and Book Flow
mPointClientInfo  clientInfo = mPointClientInfo(appid, appversion, mPoint.LANGUAGES.da) 

mPointInitializePaymentInfo paymentInfo = mPointInitializePaymentInfo()
                        paymentInfo.amount = amount
               = CountryConfig.COUNTRIES.getValues().get(countryId)
                        paymentInfo.operator = operatorId
               = mobile
               = email
                        paymentInfo.language =
                       paymentInfo.clientinfo = clientInfo
 paymentInfo.txnType = txnType
       paymentInfo.setHmac(hmac) // if hmac is available OR
                        paymentInfo.secretSalt = salt // if salt value is available
   paymentInfo.order = mPointOrderInfo
   paymentInfo.authToken = authToken
   paymentInfo.sessionId = sessionId (required during payment retries)

Note: Consider the following items:

  • Do not send a float number in the int amount. The SDK handles a float number by multiplying it with 100. For example, the floating digit 100 becomes 10000 and 100.29 becomes 10029.
  • Invoking the initialize method is same for card payments, stored cards, APM, wallets and aggregators.

The following are optional parameters: mPointOrderInfo, authToken, and sessionId.

The following table shows a description of initialize payment parameters.

mobileIntegerYesThe MSISDN of a customer without International Dialling Code.
Note: Mobile number can be mandatory or optional, based on the requirement of a merchant or a PSP.
deviceIdIntegerYesThe identification number of a device from which a customer makes a transaction.
emailStringNoThe email address of a customer.
Note: Email can be mandatory or optional, based on the requirement of a merchant or a PSP.
countryIdIntegerYesThe CPD-specific country code, which is available on request.
currencyIdIntegerYesThe CPD-specific ID of a currency selected for making payment.
amountIntegerYesThe total amount that a customer is charged for a payment transaction in a country’s smallest currency. For example, the smallest currency of USD is penny. If the transaction amount is $120.30, then the amount field contains value 12030.
orderIdStringNoThe alphanumeric order ID that a merchant generates.
Note: Some Payment Providers have strict guidelines for the orderId. The recommended pattern is "[a-zA-Z0-9._-]
operatorIdIntegerYesThe identification number of a customer’s Mobile Network Operator. A typical value is “country id” multiplied by 100.
hmacStringNoIt is deprecated from version 2.3.1 onwards and is applicable only for the mRetail SDK.
mPointOrderInfoObjectNoThe object of mPointOrderInfo. It contains details of order data and is required only for airlines.
authTokenStringNo The token that CPD provides for making payment.
sessionIdIntegerNoThe session ID of a transaction. It is required only for required only if a customer retries making payment.
ObjectYes The object of mPointInitializePaymentInfo. It contains all details required to construct initialize an API request.
search and bookObjectObjectThis is meant for travel merchants only. Refer to Search and Book Workflow for details.

You can implement the following methods as part of the call back response for initializing a payment. Implement the displayAvailablePayments call back method to display the available payment method as shown in the following code sample:

override fun displayAvailablePayments(availablePayments: mPointAvailablePayments?, mpoint: mPoint?) {}

In availablePayments, the following sub-objects are available:

  • Card
  • Stored card
  • APM
  • Third-party wallet
  • Aggregators
  • Offline payment
  • Vouchers
  • Split Payment