Programatically POST data securly

My problem is related to a credit card processing service with a hosted form option but I will try to make my question more generic. In order to use the hosted form (credit card processing company hosts it, not me), I have to pass them three unique identifiers (IDs). Those IDs cannot be made public and so the company has told me to POST them programmatically. I have been given examples of cURL and HTTPwebRequest by their tech support. After pointing out cURL and an HTTPwebRequest would result in information being collected from their site and returned to mine leaving an end user still on my website, obviously not the desired effect if I am trying to use the company's hosted form, their tech support has stopped answering my questions.

Is there a way to POST data programmatically without it being readable (by readable I mean things such as JavaScript and/or hidden fields in a form) and end up on the page you are POST-ing to?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Who is it you are using?
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
In ASP you are using xmlhttppost   I have an example here  In classic asp you first  have to build your post data as a string, then send it.  Your response will most likely be in xml format as well and you will need to parse the response.

if request.form("credit_card_no")<>"" then
'  keep adding fields
theURL = ""

'now use xmlhttp post to send data.  Any items you want hidden form people are in your variables and posted this way.

	DataToSend = "ssl_merchant_id =MerchNO& ssl_pin=MyPin&CC_NO=credit_card_no"
	dim xmlhttp 
	set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
	xmlhttp.Open "POST",theURL,false
	xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
	xmlhttp.send DataToSend
	Response.ContentType = "text/xml"
	Response.Write xmlhttp.responsexml.xml ' this is your response from the post but probably not used in your case
        Set xmlhttp = nothing

end if


Open in new window

If you are using PHP, many of the gateways will have PHP libraries to make this easier for you.
Ray PaseurCommented:
Who are these people?!  Payment processing is a completely normal online transaction; it happens thousands of times per hour all over the internet.  Support representatives who stop answering your questions -- well, that is a giant red flag.  You're right to avoid them.

Please step back from the technical details and just tell us what you want to do.  Example: Are you selling products and you need to collect payment?  If we understand your business needs and your geopolitical situation we can almost certainly help you get a good footing.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Dave BaldwinFixer of ProblemsCommented:
The 'standard procedure' is for the user to fill out the form, send it to your site using HTTPS, and when you receive it, you use 'curl' to send the data and your api keys to the processor using HTTPS also.  You get the results back in the 'curl' procedure.  None of the 'secret' info is exposed that way.

Paypal's express checkout works pretty much the same way except that you have to kind of do everything twice.  The initial forms are on your site.  You pass the sale info along with the ID info to them using 'curl' thru HTTPS and when you get a positive response, then you send your customer to Paypal where they put up their payment form on their site.  When that's all done, they send the customer back to your site for confirmation.  It's a bit of a pain but I think the idea with Paypal is that it takes so many steps to do the transaction that it makes it impossible to 'hack' them with a single POST request.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
It sounds like you are trying to use two different methods at the same time perhaps.  Using's example:

One option is to use their hosted form. The data never touches your server.  In this case, their server will post back to your server when the transaction is complete or fails but in a separate transaction. Or you would just get an email that the transaction processed.  When you say you have a hosted form, this is what I think of.
When they tell you there are several parameters you have to pass and not let it be made public, this is an advanced or direct post method where the form is hosted on your server, the customer enters data that passes through your server and the credit card and amount is sent to the gateway. The gateway sends back a code that will either be a yes or a code representing why it did not process.  With this type of transaction, you typically have an id number for the merchant, secret key, the credit card info, amount and a hash field (where you concatenate multiple fields together) and encrypt the hash field.  Some gateways are not requiring this anymore if you are sending over https.  
Which one of these methods are  you using?
jaw0807Author Commented:
Turns out the answer to my question was no. I was not receiving a response from the credit card processing company because my query was making its way up the tech support chain. There is no way to POST programmatically in a one-way direction, cURL, httpwebrequests whether xml or not and other such communication tools work in two directions i.e. they receive a response. The end solution was to cURL the three unique identifiers receiving back a web form with which to embed on my page with an action submitting it back to the credit card processing company. Very similar to Scott Fell's Direct Post example from The the credit card processing company just left that crucial piece of information out of their development guide.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jaw0807Author Commented:
Thanks for the help and responses to the question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.