Step 1 : SDK installation and set up
- Add the following as a dependency in your app-level build.gradle
- Implementation 'com.paytm.easypay:easypay:8.5.0-RC-2'
-
Paytm Assist requires SMS Permission to process OTPs, add following lines in your manifest file:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
-
Runtime permission can be accessed via:
if (ContextCompat.checkSelfPermission(this@MainActivity, Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.READ_SMS, Manifest.permission.RECEIVE_SMS), 101)
}
Step 2 : Initialization of Paytm SDK
To initialize the Paytm SDK, use below classes:
Step 3 : Initiate Payment
To invoke Paytm assist following code is required
mPaytmAssist.startConfigAssist(this, true, true, R.id.framelayt, mWebView, mActivity, orderId, "TESTMID");
mPaytmAssist.startAssist();
In which params of startConfigAssist is as follows :
ATTRIBUTE |
DESCRIPTION |
configContext
Context |
Context object (above it's referred as this ). |
isEasyActive
Boolean |
Flag to enable /disable Assist (above it's referred as true ) for app has preference in app. |
isEasyEnabled
Boolean |
Flag to enable/disable assist (above it's referred as true ) if to be decided. |
viewID
Integer |
Frame layout id where pop up is placed(above it's referred as R.id.framelayt ). |
webView1
WebView |
instance of webview where PG page will be loaded (above it's referred as mWebView ) |
activity
Activity |
Instance of Activity ( above it's referred as mActivity ) |
orderID
String |
OrderID of the txn ( above it's referred as orderId ) |
mid
String |
MID of merchant ( above it's referred as TESTMID ) |
Add following line in your activity's onDestroy
mPaytmAssist.removeAssist();