Jump to content

Recommended Posts

Sorry if I was a bit unclear... i need to send it using POST without a form... I have a webshop where the user can chose different payment methods and if the for an example choose credit card they will come to a page thats sends the data to payson... however payson needs to receive the data with POST instead of GET (if they could receive it with get I could send them one long URL with query strings) but it this case I don´t know how to get the page to collect all the variables and then send them with POST :(

for this, you'll need to use sockets. there's probably some documentation on payson's site. if not, peruse the manual's section on sockets (starting with fsockopen) and maybe hop on over to paypal's development resources, because they have code samples that construct a request in the same way.

Why can't you just use a form with hidden variables?

 

because that would require the physical submission of the form, unless one was to use javascript to submit the form upon loading of the page, but one should avoid relying on javascript to make their app work.

Why can't you just use a form with hidden variables?

 

because that would require the physical submission of the form, unless one was to use javascript to submit the form upon loading of the page, but one should avoid relying on javascript to make their app work.

 

No javascript needed. Put all the needed elements in a form...either hidden or inputs they can change...then a BUY button that submits the form to payson.

No javascript needed. Put all the needed elements in a form...either hidden or inputs they can change...then a BUY button that submits the form to payson.

 

the only problem is that then you're at the mercy of payson, and are forced to physically send the user there. constructing with sockets allows for seamless integration.

 

both perfectly doable ways, i guess it just depends on the OP's goal.

I think that akitchin understands my problem... i have got one page called "checkout.php" on this page you can chose payment method either invoice or credit card (payson) - when the user has made his choice and press submit "order.php" is called and what it does is that it collects all the data such as name, address, totalprice etc. it also checks the payment method and if it is credit card (payson) it will send all the data to payson... my problem is that payson only can receive it as POST so if I only had one payment method i would just have one form that sent all the data directly to Payson however in this case I must first check the payment method and then send it forward with the right data. It is a bit complicated to describe, but I hope you understand? thanks a buch for all comments...

I think that akitchin understands my problem... i have got one page called "checkout.php" on this page you can chose payment method either invoice or credit card (payson) - when the user has made his choice and press submit "order.php" is called and what it does is that it collects all the data such as name, address, totalprice etc. it also checks the payment method and if it is credit card (payson) it will send all the data to payson... my problem is that payson only can receive it as POST so if I only had one payment method i would just have one form that sent all the data directly to Payson however in this case I must first check the payment method and then send it forward with the right data. It is a bit complicated to describe, but I hope you understand? thanks a buch for all comments...

 

in this case, one option is to have a final confirmation page (AFTER the user has selected payson as their payment method) with the hidden form inputs as rhodesa has suggested. otherwise, you could have them select the payment method BEFORE entering their information, which allows them to go straight from information entry to payment processor since you're already aware that they need to head that way.

 

the final option, and probably the one that's more work, is going my route and constructing the POST request using sockets or cURL as mentioned above. with so many other options though, it's unlikely that this is worth the effort.

All of this depends on the exact method and architecture you are using to interface with the payment processor. For example, if the payment processor is expecting only the payment details, using a form with hidden fields will result in truck-loads of purchases that only cost the visitor $0.01

 

The payment processor's site will contain code examples that should be followed for any method or system architecture you are using.

Basically....you can't. You could have the server send a POST with cURL or fsockopen(), but any session data that is started with the server can't be transferred to the user...so that won't work. And, once the user has submitted the data to your site, you can't force a redirect to payson with another post. The only thing you can do is output a form and submit it with javascript, which is a bad solution. If this site won't accept GET or doesn't have some API to do this stuff, you should probably look for a different credit card processing company.

 

My recommendation is to make a review shopping cart page, that submits to a Payment method page. When it submits to this page, put any data you want to keep into your database. Then, if they click a local method, submit it to one of your pages, and if they click the credit card option, have it submit directly to payson (via a hidden form). You will end up with some extra records in your database from people going to the payment page, and then changing their mind...but just flag those records after a day and not receiving payment.

Thanks for all the help... really appreciate it :) I think I´m gonna start looking for another credit card processing company.... anyone has any recommendations? Paypal? I want something thats not to expensive since I recently launched the shop and therefore doesnt have too many orders yet...

While there is something out there that is cheaper then PayPal, I consider it worth the money. User's seem so much more comfortable using that then entering their info on some site they have never heard of. Plus, the APIs they have are VERY in-depth

While there is something out there that is cheaper then PayPal, I consider it worth the money. User's seem so much more comfortable using that then entering their info on some site they have never heard of. Plus, the APIs they have are VERY in-depth

 

 

I managed to POST the variables finally... however I encountered another problem so I will try PayPal instead... this is the code to POST variables without using forms:

 

<?php

//

// A very simple PHP example that sends a HTTP POST to a remote site

//

 

$ch = curl_init();

 

curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/tester.phtml");

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS,

            "postvar1=value1&postvar2=value2&postvar3=value3");

 

curl_exec ($ch);

curl_close ($ch);

?>

 

 

the problem with using curl is that the server is posting the data, not the client. so after you do the curl part, and send the user to payson to enter their credit card info, it doesn't know who the user is...again, cus the server made the post

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.