wnowak1
07-03-2004, 06:15 PM
I'm having issues with the passed back parameters after a successful sale from 2CO.
According to 2checkout's docs, if a sale is approved, the browser can be redirected to your website passing back parameters for you to store in a database, etc.
The docs fail to mention how these variables are passed. Are they passed by the POST method or GET method?
I've tried to setup a script that handles both POST and GET methods in PHP and no luck.
I'm comfortable using PHP and MySQL and handling both POST and GET methods of a form.
Thanks
mr_wuss
07-03-2004, 07:02 PM
i would assume they are passed back in a POST method, do they give an example URL that would be passed back?
blahblah.com/blah.php?this=that&purchased=something&totalprice=33
ect
barrywien
07-03-2004, 08:00 PM
Passback is via POST method with 2Checkout, you can store the variables sent back into your database.
There support forum has a little more information on the exact variables they pass back, as well as custom variables you can put through.
wnowak1
07-04-2004, 12:16 AM
Yeah I have looked at the vars they pass back...
I'll make another post with a screenshot. I have to have 5 posts to post links...
wnowak1
07-04-2004, 12:18 AM
http://icarus.uic.edu/~wnowak1/2co.jpg
The button: "Click Here To Finalize Your Order"
is a POST form with hidden values.
When you click on this link, it takes the user to my site's PHP script which accepts HTTP_POST_VARS. The script displays all the parameters that were passed back, but they have no values.
On the other hand, when you click on the "CLICK HERE" it points to my site's PHP script using GET variables.
This makes no sense on 2CO side because a customer will click the button to finalize button.
My goal is to thank the customer for ordering, and submit the data into a database and other stuff.
Is this because I'm using a DEMO sale?
Thanks.
wnowak1
07-04-2004, 03:26 PM
We (2C0 & I) got it resolved.
Thanks!
xerohosting
07-04-2004, 05:24 PM
any chance of telling us what the problem was for future reference?
wnowak1
07-04-2004, 06:41 PM
Sure...
The problem was this:
In 2CO Admin page, you can select the default approved.php page upon a successful sale. When you add products, you also have the option of providing an approved page for the particular product. My product had the following: approved.php?order=1 which takes precedence over the default approved.php (That’s were the problem was)
As a result, the parameters passed via POST did not work but GET did work.
There is a new problem now with the KEY that 2CO passes. md5 in php generates a different key than 2CO's perl script. The key is used to determine if the customer actually came from 2CO or if it’s a fake. I've yet to find a solution to this.
thesiren
07-15-2004, 01:43 AM
So does that mean that you can't include a query string in your passback url?
wnowak1
07-15-2004, 04:37 AM
Well, turned out that the problem was related because i was in DEMO mode. The tech later told me this. This is vertion2 of their system, so there are some bugs. The issue is fixed on their end as well.