Mobile App Integration
In case of Android Mobile App Integration the transaction flow remains the same. In addition, only
the following parameter needs to be passed at the time of web view calling i.e. “referer” header
parameter must be present in the transaction request. If this parameter is not defined in the request
header while sending the payment request during web view call, it will be declined by the Payment
Gateway as they have a validation on the said parameter.
Merchants to add the “Referer” parameter in request header. For reference, refer to the below
attached desktop browser header information.
On click of F12 go to network tab, In header block the Referer parameter containing the merchant
url verifies that the request is coming from an authorized domain If this parameter is not defined in
request header while sending the payment request during web view call, it will get declined by the
payment gateway.
Mobile App Integration
Below are the steps to integrate mobile app transaction.
REQUEST
Android:
1) On click of pay button, invoke a webview. We load the url to our server that redirects to payment
gateway.
WebView webView = (WebView) view.findViewById(R.id.pg_webview);
StringBuilder queryparamBuilder = new StringBuilder().append(pgURL)
.append("opCode").append(EQUALS)
.append(opcode).append(APPENDER)
.append("amount").append(EQUALS)
.append(charge).append(APPENDER)
.append("tx_date").append(EQUALS)
.append(date).append(APPENDER)
.append("tx_id").append(EQUALS);
String queryparams = queryparamBuilder.toString();
2) Add headers and Referer to the url and send a GET request to the server as we could not add
headers in POST for Android Webview
Map<String, String> extraHeaders = new HashMap<String, String>();
SharedPreferences preferences = getActivity().getSharedPreferences("patient",
MODE_PRIVATE);
String sessionId = preferences.getString("sessionID" , null);
Long expires = preferences.getLong("expires", 0);
Log.i(TAG, "sessionID -- " + sessionId + " expiry " + expires);
extraHeaders.put("Authorization", AUTHTOKEN );
extraHeaders.put("Set-Cookie", "sessionID="+sessionId+" ; expires="+ expires);
extraHeaders.put("Referer", REFERER_URL);
webView.loadUrl(pgURL, extraHeaders);
webView.getSettings().setJavaScriptEnabled(true);