Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
22 views2 pages

Android App Payment Integration

The document discusses steps for integrating mobile app transactions in Android. It describes passing a 'referer' header parameter when making a payment request via a web view to validate the request is coming from an authorized domain. It provides an example of adding headers like referer and making a GET request to a server URL with query parameters to load a payment gateway URL in a web view.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Android App Payment Integration

The document discusses steps for integrating mobile app transactions in Android. It describes passing a 'referer' header parameter when making a payment request via a web view to validate the request is coming from an authorized domain. It provides an example of adding headers like referer and making a GET request to a server URL with query parameters to load a payment gateway URL in a web view.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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);

You might also like