Need to post form data from java and proceed to a website

Hi  all,

We have a site developed using struts. We are adding a payment gateway to it, however, my problem is this.
We need to post data to this site then proceed to this site for the customer to enter their credit card information and when successfully completed they are returned to our website. We sell online learning so the real issue is if they saw the return URL they could use this and get enrolled in classes without actually paying for them.

I need to know how to post form data to another website but have it hidden from the user. I can post from Java that's not the issue and retrieve the response, the issue is I need to go to the website with the posted data and have the customer interact with the site before returning to our site. I want it hidden and would prefer to do it using Java.

I may not have explained this correctly but hopefully, you get the idea.
A page that displays hidden text boxes would allow a user to see the return URL.
Any ideas would be appreciated.

Who is Participating?
sharath_kulalConnect With a Mentor Commented:
i just went thru their site and there is an option of "Merchant Direct" on this page:

This is based on  XML-based API and so you should be able to communicate from your server to their server thru XML for Credit Card authorizations, this seems to be a more flexible option and you would have better control of transactions on your server.

don't know what payment gateway u're using, but if the gateway provider has webservice for CC check. then you could have you're own screen for the customer to enter CC details and from your servlet call the webservice of the provider with CC details for authorization.

even if the provider doesn't provide you webservice, then check if they would accept URL query strings which you could create at the server.

hope this helps
rj_stoneAuthor Commented:
Payment gateway the customer wants to use is internetsecure
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Mayank SConnect With a Mentor Associate Director - Product EngineeringCommented:
The other web-site would've exposed a servlet or a web-service to which you need to post data and get the response - make use of that and you don't need to display anything to the user while that processing is taking place.
girionisConnect With a Mentor Commented:
> if they saw the return URL they could use this and get enrolled in classes without actually paying for them.

you could make this page secure and require a form-based authentication. Then anyone that would need to have access to this page would need to supply a username/password. By doing it you ensure that noone that hasn't paid can access the site.
rj_stoneAuthor Commented:
I saw the XML API but the client does not want any processing to take place on our site. They want all processing done on internetsecur's website.

So unfortunately we need to allow the users to interact with the site before redirecting back to us. I think I can make use of a hidden page and post from it via struts. If the address bar is hidden then the page name probably won't e visible.

Thanks for the ideas though. Its appreciated. I'll split the points betwwen you all.

Thanks for accepting, glad I was of help :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.