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.
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.