This is the last part of Custom UI SDK integration where you will find the information about different optional methods available in the SDK. These can be optionally integrated based on your requirements and use cases.
This is the last part of Custom UI SDK integration where you will find the information about different optional methods available in the SDK. These can be optionally integrated based on your requirements and use cases.
This method can be used to invoke and complete the transaction through Paytm app. The method can be used in below two cases:
Integration - Type2: Merchants not receiving client id and user’s SSO token can invoke the Paytm app to enable users to complete the transaction using the wallet and other saved instruments of Paytm user.
Note: With the version com.paytm.nativesdk:core-wr:1.2.0 the user shall be redirected automatically to the webview in case Paytm app is not present on the user device.
paytmSDK.openPaytmAppForAddMoneyToWallet(activity)
Method Params:
Parameter | Description |
---|---|
Activity context | SDK needs the context of activity |
You can perform the thematic customisations of the consent checkbox to make it relevant as per your App design. You can customise the theme such as color, font, etc. using the attributes in the XML.
Use the attributes below in your XML to customize the consent checkbox:
Attribute | Type | Description |
---|---|---|
consentTextAppearance | reference | This attribute can be used to set text appearance of the consent text |
consentCheckboxColorStateList | reference | This attribute can be used to set button tint list of the consent button |
consentBackgroundColor | color | This attribute can be used to set the background color of consent button and text |
consentButton | reference | This attribute can be used to set button drawable for the consent button |
Usage Example:
<net.one97.paytm.nativesdk.common.widget.PaytmConsentCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Allow <Merchant> to fetch Paytm instruments"
app:consentButton="@drawable/customised_checkbox"
app:consentCheckboxColorStateList="@drawable/consent_colorstatelist"
app:consentTextAppearance="@style/ConsentTextAppearance"
app:consentBackgroundColor="@color/gray"/>
The method userHasSavedInstruments can use it to check if the user has any saved Payment instruments. You can invoke this method and see if any saved instruments are there before showing the consent checkbox to the user.
Usage:
PaytmPaymentsUtilRepository paymentsUtilRepository =PaytmSDK.getPaymentsUtilRepository()
paymentsUtilRepository.userHasSavedInstruments(context, mid)
Method Parameters:
Parameter | Type | Description |
---|---|---|
context | Context | Context needed to make a query |
mid | String | Merchant id needed to fetch saved instruments of user |
Response:
This method will return a boolean parameter.
Value | Description |
---|---|
True | User is logged in and has saved instruments |
False | Either the user is not logged in or has no saved instruments |
In case you are integrating the UPI Push flow i.e. you intend to show the Paytm user’s UPI linked bank accounts on your checkout page, you can use these optional methods to enable the user to check its account balance or set the UPI MPIN.
Model Name: UpiDataRequestModel
Creation of Object:
UpiDataRequestModel requestModel = new UpiDataRequestModel(vpa,bankAccount)
Constructor Parameters:
Parameter | Type | Description |
---|---|---|
vpa |
String | Virtual Payment Address(eg.xyz@paytm) |
bankAccount |
String | JSON string representing a bank account for UPI |
Method Parameters:
Parameter | Description |
---|---|
Activity context | SDK needs the context of activity |
UpiDataRequestModel upiDataRequestModel | UPI request data |
Usage:
paytmSDK.fetchUpiBalance(this, upiDataRequestModel)
Response:
Result will be received in PaytmSDKCallbackListener
and can be obtained as shown:
{ // value of data
"statusCode": 100,
"statusMsg": "SUCCESS",
"totalBalance": "12345.6"
}
Model Name: UpiDataRequestModel
Creation of Object:
UpiDataRequestModel requestModel = new UpiDataRequestModel(vpa,bankAccount)
Constructor Params:
Parameter | Type | Description |
---|---|---|
vpa | String | Virtual Payment Adress(eg.xyz@paytm) |
bankAccount | String | JSON string representing a bank account for UPI |
Method Parameters:
Parameter | Description |
---|---|
Activity context | SDK needs the context of activity |
UpiDataRequestModel upiDataRequestModel |
UPI request data |
Usage:
paytmSDK.setUpiPin(this, upiDataRequestModel)
Response:
PaytmSDKCallbackListener
and can be obtained as shown:
{"statusCode":100,"statusMsg":"SUCCESS"}
The method getNBList is available in the SDK for the Fetch NB Payment Channel API. The method can be used to get the list of Netbanking instruments along with their success rate and the icons available for your mid.
Method Signature:
fun getNBList(callback: PaymentMethodDataSource.Callback<JSONObject>)
The returned result will be of NBResponse type. The bank's list can be fetched using the PayChannelOptions object that includes the list of banks.
Method Parameters:
Attribute | Description |
---|---|
callback | Callback to get the response received by the API request invoked by the above method |
Usage:
PaytmSDK.getPaymentsHelper()
getNBList(object:PaymentMethodDataSource.Callback<JSONObject> {
override fun onResponse(response: JSONObject?,) {
Toast.makeText(this@BaseInstrumentActivity, getMessage(response),
Toast.LENGTH_LONG).show()
}
override fun onErrorResponse(error: VolleyError?, errorInfo: JSONObject?) {
Toast.makeText(this@BaseInstrumentActivity,
getMessage(errorInfo) ?: "Error fetching NB List",
Toast.LENGTH_LONG).show()
}
})
The sample response of Fetch NB channel can be found below:
class="language-javascript">{
"head":{
"requestId":null,
"responseTimestamp":"1591622928848",
"version":"v1"
},
"body":{
"extraParamsMap":null,
"resultInfo":{
"resultStatus":"S",
"resultCode":"0000",
"resultMsg":"Success"
},
"nbPayOption":{
"displayName":"Net Banking",
"isDisabled":{
"status":"false",
"msg":""
},
"payChannelOptions":[
{
"isDisabled":{
"status":"false",
"msg":null
},
"hasLowSuccess":{
"status":"false",
"msg":""
},
"iconUrl":"AXIS.png",
"isHybridDisabled":false,
"channelCode":"AXIS",
"channelName":"Axis Bank"
},
{
"isDisabled":{
"status":"false",
"msg":null
},
"hasLowSuccess":{
"status":"false",
"msg":""
},
"iconUrl":"HDFC.png",
"isHybridDisabled":false,
"channelCode":"HDFC",
"channelName":"HDFC Bank"
}
]
}
}
}
PayChannelOptions contains the items listed below:
String channelName - Bank Name
String channelCode - Bank Code
String iconUrl - Bank Logo URL
HasLowSuccess hasLowSuccess - Information about the bank’s success rate (HasLowSuccess contains Boolean status and String msg )
The method fetchBinDetails is available in the SDK for the Fetch Bin details API. The method is used for the transaction using a payment source of a new Credit/Debit card. The method can be used to get the card details and get the last 15 minutes success rate of the bin. The method need to be called when user has entered the first 6 digits of the card..
Method Signature:
PaymentsDataImpl.fetchBinDetails(cardSixDigit,
token value, token type, mid, reference id, object :
PaymentMethodDataSource.Callback {
override fun onResponse(response: JSONObject?) {
}
override fun onErrorResponse(error: VolleyError?, errorInfo: JSONObject?) {
}
})
Method Parameters:
Attribute | Description |
---|---|
cardSixDigits | First six digits of the card |
token | Token value used(access/txntoken) |
tokenType | It can be "TXN_TOKEN", "ACCESS" |
mid | Merchant ID |
referenceId | Unique ID between 10 to 20 digits and is only required in case of tokenType as ACCESS. It should be similar to the value used in access token generation. |
Note: Paytm SDK builder is required to be created first in case using this method with transaction token.
The sample response to Fetch Bin can be found below:
{
"head":{
"requestId":null,
"responseTimestamp":"1591622928848",
"version":"v1"
},
"body":{
"extraParamsMap":null,
"resultInfo":{
"resultStatus":"S",
"resultCode":"0000",
"resultMsg":"Success"
},
"nbPayOption":{
"displayName":"Net Banking",
"isDisabled":{
"status":"false",
"msg":""
},
"payChannelOptions":[
{
"isDisabled":{
"status":"false",
"msg":null
},
"hasLowSuccess":{
"status":"false",
"msg":""
},
"iconUrl":"AXIS.png",
"isHybridDisabled":false,
"channelCode":"AXIS",
"channelName":"Axis Bank"
},
{
"isDisabled":{
"status":"false",
"msg":null
},
"hasLowSuccess":{
"status":"false",
"msg":""
},
"iconUrl":"HDFC.png",
"isHybridDisabled":false,
"channelCode":"HDFC",
"channelName":"HDFC Bank"
}
]
}
}
}
This method is used to fetch the bank code through which the last successful Netbanking transaction was done.
Usage:
PaytmPaymentsUtilRepository paymentsUtilRepository =PaytmSDK.getPaymentsUtilRepository()
paymentsUtilRepository.getLastNBSavedBank()
Method:
This method will return a string parameter.
Value | Description |
---|---|
"ICICI" | If a user has used ICICI bank in his last net banking transaction |
“” | Empty if no such bank is saved |
Note: This method will return the bank code using which successful transaction using NetBanking was done
The method getLastSavedVPA is used to fetch the VPA used for the UPI collect transaction by the user. This can be used to show by the merchant on its checkout page as a preferred or last vpa used by the user for the successful transaction.
Usage:
PaytmPaymentsUtilRepository paymentsUtilRepository =PaytmSDK.getPaymentsUtilRepository()
paymentsUtilRepository.getLastSavedVPA()
Response:
This method will return a string parameter.
Value | Description |
---|---|
"abc@xyz" | If a user has used this VPA in his last UPI collect transaction |
“” | Empty if no such VPA is saved |
Please change the following configurations based on your requirements.
setServer (Server server) - Use this to test the APIs on the merchant Integration environment. Default value is Server.PRODUCTION
PaytmSDK.Builder builder =
PaytmSDK.builder(context, mid, orderId, txn, amount, this);
if(isStaging) {
PaytmSDK.setServer(Server.STAGING)
}
else{
PaytmSDK.setServer(Server.PRODUCTION)
}
PaytmSDK paytmSdk = builder.build();
setAssistEnabled (boolean enablePaytmAssist) - Use this to enable Paytm Auto Assist feature (Auto reading OTP). The default value is False. This method is only available in the sdk version com.paytm.nativesdk:core-ep:1.0.0. Should be used only in case merchant wants to use Paytm Assist.
setLoggingEnabled (boolean enableLogging) - Use this to enable the logs in case required to debug any issue. By default, its value is set as False.
- keep class net.one97.paytm.nativesdk.** { *; }
- keep interface net.one97.paytm.nativesdk.** { *; }