androidhttp-redirecttransactionspayment-gatewaypayumoney

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. I am using payUMoney SDK Does anyone gone through this? Please guide me.. any kind of help appreciated. Thanks in advance


Solution

  • 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(new Object()
                {
                    @JavascriptInterface
                    public void performClick(String status)
                    {
                        // Deal with a click on the OK button
                        //    Toast.makeText(mContext,"Payment Success",2000).show();
                        //  Log.e("status payment-------->",status);
                        finish();
    
                    }
                }, "ok");