PayU Payment Integration in Android Issue

2.4k views Asked by At

I am trying to integrate Payment Gateway (PayU) in Android through WebView. I am able to send the data to the PayU through POST. After successful transaction, the page is not redirecting to the "surl" i.e successUrl / "furl" i.e FailureUrl. It always shows page not found.

Following is the code of WebView:

webView = (WebView) findViewById(R.id.webview1);
String postData = "Required Data sent to PayU by POST";
webView.setWebViewClient(new WebViewClient(){
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
         Log.d("Page_Started",url);
    }

    @Override
    public void onPageFinished(WebView view, String url) {
         Log.d("Page_Finished",url);
    }
});

webView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSupportMultipleWindows(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setSupportZoom(true);       //Zoom Control on web (You don't need this
//if ROM supports Multi-Touch
webView.getSettings().setBuiltInZoomControls(true);
webView.postUrl(action, EncodingUtils.getBytes(postData, "BASE64"));

In Log, its not showing any success url / failure url. I always get a message from PayU that Page Not Found-404

Do I have to make some changes in webView? Its working perfect in WebPage, not working in Android.

2

There are 2 answers

0
HSpector On

After transaction Payu POST the transaction status response back your surl/furl according to the transaction status.

Please make sure that your surl/furl accept POST request.

2
Ronak Joshi On

After a long searching and changing in code. Finally, i got proper solution of this problem. For testing just you this parameters, merchant key:"gtKFFx" , salt: "eCwWELxi". After launching payumoney screen. To enter debit card details use this details, Name on Card: Any name, Card Number: 5123456789012346, CVV: 123, Expiry Date: 05/2017. When i used this credentials and numbers it working very well and redirecting to my particular success URL.