How to integrate paytm wallet in android application?

Go to link :

and download Android+SDK

put below code in your function or where you want to start paytm stuff

public class MerchantActivity extends Activity {

protected void onCreate(Bundle savedInstanceState) {

//This is to refresh the order id: Only for the Sample App's purpose.
protected void onStart(){

private void initOrderId() {
Random r = new Random(System.currentTimeMillis());
String orderId = "ORDER" + (1 + r.nextInt(2)) * 10000
+ r.nextInt(10000);
EditText orderIdEditText = (EditText) findViewById(;

public void onStartTransaction(View view) {
PaytmPGService Service = PaytmPGService.getStagingService();
Map<String, String> paramMap = new HashMap<String, String>();

// these are mandatory parameters

paramMap.put("ORDER_ID", ((EditText) findViewById(;
paramMap.put("MID", ((EditText) findViewById(;
paramMap.put("CUST_ID", ((EditText) findViewById(;
paramMap.put("CHANNEL_ID", ((EditText) findViewById(;
paramMap.put("INDUSTRY_TYPE_ID", ((EditText) findViewById(;
paramMap.put("WEBSITE", ((EditText) findViewById(;
paramMap.put("TXN_AMOUNT", ((EditText) findViewById(;
paramMap.put("THEME", ((EditText) findViewById(;
paramMap.put("EMAIL", ((EditText) findViewById(;
paramMap.put("MOBILE_NO", ((EditText) findViewById(;
PaytmOrder Order = new PaytmOrder(paramMap);

PaytmMerchant Merchant = new PaytmMerchant(

Service.initialize(Order, Merchant, null);

Service.startPaymentTransaction(this, true, true,
new PaytmPaymentTransactionCallback() {
public void someUIErrorOccurred(String inErrorMessage) {
// Some UI Error Occurred in Payment Gateway Activity.
// // This may be due to initialization of views in
// Payment Gateway Activity or may be due to //
// initialization of webview. // Error Message details
// the error occurred.

public void onTransactionSuccess(Bundle inResponse) {
// After successful transaction this method gets called.
// // Response bundle contains the merchant response
// parameters.
Log.d("LOG", "Payment Transaction is successful " + inResponse);
Toast.makeText(getApplicationContext(), "Payment Transaction is successful ", Toast.LENGTH_LONG).show();

public void onTransactionFailure(String inErrorMessage,
Bundle inResponse) {
// This method gets called if transaction failed. //
// Here in this case transaction is completed, but with
// a failure. // Error Message describes the reason for
// failure. // Response bundle contains the merchant
// response parameters.
Log.d("LOG", "Payment Transaction Failed " + inErrorMessage);
Toast.makeText(getBaseContext(), "Payment Transaction Failed ", Toast.LENGTH_LONG).show();

public void networkNotAvailable() { // If network is not
// available, then this
// method gets called.

public void clientAuthenticationFailed(String inErrorMessage) {
// This method gets called if client authentication
// failed. // Failure may be due to following reasons //
// 1. Server error or downtime. // 2. Server unable to
// generate checksum or checksum response is not in
// proper format. // 3. Server failed to authenticate
// that client. That is value of payt_STATUS is 2. //
// Error Message describes the reason for failure.

public void onErrorLoadingWebPage(int iniErrorCode,
String inErrorMessage, String inFailingUrl) {


// had to be added: NOTE
public void onBackPressedCancelTransaction() {
// TODO Auto-generated method stub

Manifest.xml file
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

Like what you read? Give Gaurav Pandey a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.