Skip to content Skip to sidebar Skip to footer

Payumoney Redirecting Page After Successful Transaction

I am developing a sample application with PayUMoney Transaction. The app functions well. But I am looking for redirecting the page to an Activity after the successful transaction.

Solution 1:

I faced the similar issue.I assume you have integrated payUMoney using sdk. Your sdk will be having a WebViewActivity which is used to redirect user to success/failure screen after transcation has been completed. Add a button on server side naming "ok" or "continue" on success/failure url screen.Detect click of that button in your SDK's WebView Activity and finish the activity.

Ask your web developer to add an html button on success/failure url:

<button type="button" onclick="ok.performClick();">OK</button>

This is how you can detect click on an html button in WebViewActivity of your SDK:

 mWebView = (WebView) findViewById(R.id.webview);
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setDomStorageEnabled(true);
            mWebView.getSettings().setLoadWithOverviewMode(true);
            mWebView.getSettings().setUseWideViewPort(true);
            WebSettings ws = mWebView.getSettings();
            mWebView.addJavascriptInterface(newObject()
            {
                @JavascriptInterfacepublicvoidperformClick(String status)
                {
                    // Deal with a click on the OK button//    Toast.makeText(mContext,"Payment Success",2000).show();//  Log.e("status payment-------->",status);finish();

                }
            }, "ok");

Solution 2:

Here's a solution on the android and the HTML side code, also we can detect the value of the HTML button in android

Android Code

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;


publicclassMainActivityextendsAppCompatActivity {

@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    WebView mWebView=findViewById(R.id.webView_paypal);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mWebView.loadUrl("http://192.168.1.21:8081/DeepLinking/");
    mWebView.addJavascriptInterface(newObject()
    {
        @JavascriptInterfacepublicvoidperformClick(String strl)
        {
            Log.e("TAG ","HTML Button Value : "+strl);
        }
    }, "btn_success");
}
 }

HTML

<html><head><metacharset="ISO-8859-1"><title>Test Page</title><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script></head><body><br><buttontype="button_Success"value="Success"onclick="btn_success.performClick(this.value);">Success</button><br/></html>

Solution 3:

PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam,
                        getActivity(), R.style.AppTheme_default, true);

Use third params(isOverrideResultScreen) as true

Post a Comment for "Payumoney Redirecting Page After Successful Transaction"