Your Paytm for business app is working and will keep working beyond March 15th, 2024. Click to know more

Integration with JS Checkout: Android

Webview for Android Platform

To support UPI intent PSP apps, merchants need to override the WebClient overridden method shouldOverrideUrlLoading(WebView view, String url) and include the below code in the same method.

Note: This solution is for the merchants who have integrated JS Checkout. To know more about JS Checkout integration, please refer to the JS Checkout document.

public boolean shouldOverrideUrlLoading(WebView view, String url) {
   if (url.startsWith("upi:")) {
       Intent intent = new Intent(Intent.ACTION_VIEW);
       return true;
   return false;

If the above-mentioned code is already integrated by the merchant then there is no need to do so by them again.


Steps to follow:-

  1. Merchants integrate the Webview in their Android application to open the Paytm gateway and show payable instruments to the user.
  2. Integrate WeClient in Webview to listen to events related to Webview.
  3. Add the above-mentioned method in Webclient to support UPI PSP apps from the Webview.


Mandatory code: 


To update Paytm UI about enabling the UPI intent. One needs to follow the below steps: 


1. Create a Javascript Interface and attach it with the Webview created for handling the transaction.

public  class PaytmJavaScriptInterface {

   public synchronized boolean enableUpiIntentPureWebView() {
    return true;


2. Add the JS interface created to the Webview so that UI is notified about enabling the UPI intent. Now, Add the below piece of code where you are initializing the Webview.

webView.addJavascriptInterface(new PaytmJavaScriptInterface(),"checkoutUpiIntent");


 Note: Java version is independent of the above piece of code.