Initialize Payment
Velocity Android Software Development Kit Integration Guide
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)
.setCountryId(countryId)
.setMobile(mobile)
.setEmail(email)
.setDeviceId(deviceid)
.setCustomerRef(customerRefId)
.setProfileId(profileId)
mPointInitializePaymentInfo paymentInfo = mPointInitializePaymentInfo()
paymentInfo.amount = amount
paymentInfo.country = CountryConfig.COUNTRIES.getValues().get(countryId)
paymentInfo.operator = operatorId
paymentInfo.mobile = mobile
paymentInfo.email = email
paymentInfo.language = mPoint.LANGUAGES.us
paymentInfo.setOrderno(orderID)
paymentInfo.clientinfo = clientInfo
paymentInfo.setCurrencyid(currencyId)
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)
mpoint.initialize(paymentInfo);
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 table shows a description of initialize payment parameters.
Parameter | Type | Required | Description |
---|---|---|---|
mobile | Integer | Yes | The 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. |
deviceId | Integer | Yes | The identification number of a device from which a customer makes a transaction. |
String | No | The email address of a customer. Note: Email can be mandatory or optional, based on the requirement of a merchant or a PSP. | |
countryId | Integer | Yes | The CPD-specific country code, which is available on request. |
currencyId | Integer | Yes | The CPD-specific ID of a currency selected for making payment. |
amount | Integer | Yes | The 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. |
orderId | String | No | The 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._-] |
operatorId | Integer | Yes | The identification number of a customer’s Mobile Network Operator. A typical value is “country id” multiplied by 100. |
hmac | String | No | It is deprecated from version 2.3.1 onwards and is applicable only for the mRetail SDK. |
mPointOrderInfo | Object | No | The object of mPointOrderInfo. It contains details of order data and is required only for airlines. |
authToken | String | No | The token that CPD provides for making payment. |
sessionId | Integer | No | The session ID of a transaction. It is required only for required only if a customer retries making payment. |
mPointInitialize PaymentInfo | Object | Yes | The object of mPointInitializePaymentInfo. It contains all details required to construct initialize an API request. |
search and book | Object | No | This 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
Updated 3 months ago