cancel
Showing results for 
Search instead for 
Did you mean: 

payment gateway

Former Member
0 Kudos

Dear All,

I am developing a new application in Webdynpro Java for payment gateway.

Requirement is : we have to call a Bank's URL on click of a button and we need to pass some parameters also (like user details, payment amount etc). Then on the Bank's URL, user will process with the Payment options and will Pay. On Successful payment, the message will be displayed and it will call the Webdynpro application again. Just like we pay our online mobile bills.

Guys, please help me out with some useful info to start this development. Anybody's having code / pdf for this ??

Anyone ???

Regards,

Nikesh Shah

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You could use HTTPConnection class of java to such communications:

HttpURLConnection conn = null;

try {

URL url = new URL(urlString);

conn = (HttpURLConnection) url.openConnection();

conn.setDoInput(true);

conn.setDoOutput(true);

conn.setUseCaches(false);

conn.setRequestMethod("POST");

conn.setRequestProperty("SOAPAction", "http://sap.com/xi/WebService/soap1.1");

if (internalAuthorization)

conn.setRequestProperty("Authorization", "Basic " + encode(user + ":" + password));

conn.connect(); //(http connection is made)

String convalue = conn.toString();

OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream());

out.write(request); //message parameters to the URL

out.flush();

out.close();

switch (conn.getResponseCode())

{

case 200:

if (conn.getInputStream() != null && !skipResponse)

{

dataParser = new XMLParser(conn.getInputStream(), false);

ArrayList xiError = dataParser.generateTagData("faultstring");

if (xiError != null && xiError.size() > 0 && "System Error".equals(((HashMap)xiError.get(0)).get("faultstring")))

{

String errorCode = "";

ArrayList code = dataParser.generateTagData("code");

if (code != null && code.size() > 0)

errorCode = ((HashMap)code.get(0)).get("code").toString();

throw new Exception ("Service Error: "errorCode"\nPlease contact administrator for further assistence.");

}

}

break;

case 401:

throw new Exception ("Authorization failed. Userid or password may be incorrect.");

case 408:

case 500:

case 503:

case 504:

throw new Exception ("Service Unavailable: "conn.getResponseMessage()".\nPlease contact administrator for further assistence.");

default:

throw new Exception ("Unknown Error Occured. Please contact administrator for further assistence.");

}

} catch (Exception e) {

e.printStackTrace();

throw new XIException(e.getMessage());

}finally{

if (conn != null)

conn.disconnect();

}

Hope this will help.

Jawed Ali