homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / WebmasterWorld / Ecommerce
Forum Library, Charter, Moderators: buckworks

Ecommerce Forum

2Checkout - How to Pass Back Variables
Very Confused....Anyone Able to Suggest?

 6:20 pm on Jan 27, 2005 (gmt 0)


I'm sure there are an abundance of users on here who use 2checkout, maybe you can help. I've tried going through there own forums / ticket system, without to much luck...but i can always count on WW.

I used to have a V1 account, and the checkout information used to be passed back for the order via the email message. I nowunderstand that this is now not possible in V2, and information must be "passed back to a script" on the server.

Right now, i have the passback set to:

I'm a little confused however, as to how i go about passing my "custom variables" to this page - and then go about retrieving this later so i can record this info offline. How do i set this up?

For example,
I have a custom variable in my form set as "Description", in which a client enters a short descriptions.

How would i get this variable to show up so i can retrieve it later? I've looked through out the forusm, and i can say i am sinsceerely lost.

Any help is appreciated.
~ Very confused..



 4:35 pm on Jan 28, 2005 (gmt 0)

First you need a database (MySQL for example).

Your database then needs a "Description" type field.

Then your PHP script must take the value it is sent, I believe Checkout passes them like form variables. At the end of checkout a user presses a "confirm" button which submits the info to your script. The PHP script then takes the form value, (example: form.description) and puts that in the database.

Next you setup a page that displays all your orderes or creates a spreadsheet or emails the customer. Really ther e is no limit to what you can do!

I know this all sounds harsh, but search google for some PHP tutorials and I'm sure you'll be on your way rather quickly.


 4:55 pm on Jan 28, 2005 (gmt 0)

This may help:

Put your cart in "test mode", then add this little script to your passback page...

print '<pre>';
print '</pre>';

This will show you everything that gets sent back to you. I can't remember if you can send custom fields though. I store custom info in my DB right before they move on to 2CO, then tie it together on the callback by using the cart id.


 6:38 pm on Jan 28, 2005 (gmt 0)

Hi Guys,

Thanks for the help, it's making a *little more* sense now.. although, i'm still confused. To tell you the truth, i can't believe why i'm so confused, i'm generally "pretty good" at this stuff. Let me tell you where my understanding fails...

I have my script setup "fine" with 2CO i believe. Customer fills in "my form" (off of the 2CO site)...then pressess proceed to 2C0 Checkout. The 2CO variables (cardholdername, address, etc) are passed to the checkout, and the client does not need to re-enter them on the checkout sceren.. When the client clicks "submit/order/confirm", he is sent to my passback URL.

Now my question is, during the process, my "custom variables " (lets say ICQ #, AIM Screename) are lost somewhere in these routine. Or rather, i don't have a mean's of capturing them.

I have MySQL, and PHP, and all that fun stuff. All my forms are PHP, as is my passback URL (confirmation.php).

Can i get these variables passed to my MySQL database so i can view them in phpMyadmin? is that what i'm gathering? What would i name this database? How would i let the "scritp" know taht this is the database that i want variables passed to? Would i just called the database "form", or am i confused?

Thanks for your help...i'll do a little more resarch, but i think im' getting the hang of it (albeit slowly).
I gather that if i can get teh items to be posted to my database (and thus accessible by PHPMYADMIN, i can then just cut and paste the variables into my own spreadsheet...although tedious, it would work).

Let me know if i'm on teh right track / where im' waivering. Your help is always appreciated.



 6:57 pm on Jan 28, 2005 (gmt 0)

Ok, what you need to do is record your custom variables before they get sent to 2CO. When you record this info, you tie it all together with the "cart_order_id". "cart_order_id" is a param you send to 2CO and it gets sent back.

So it's like this:

1) User fills shopping cart

2) User decides to check out

3) You present them with your form to collect custom info. This form will submit to a script on your site. In this script, you record the custom info in the db with a cart_order_id. Then, you auto-redirect to the 2CO checkout page and include the "cart_order_id".

4) When 2CO sends them back to you, you can then update the DB again with "paid" address etc.

I hope this helps you out some.



 7:26 pm on Jan 28, 2005 (gmt 0)

[quuote]1) User fills shopping cart [/quote]

Done :) In fact, all i'm selling is 1 reaccuring product. SO that's easy enoguh. I don't use any cart system or anyting of that nature, just the 2CO functions.

[quuote]2) User decides to check out [/quote]

Still following :)

[quuote]3) You present them with your form to collect custom info. This form will submit to a script on your site. In this script, you record the custom info in the db with a cart_order_id. Then, you auto-redirect to the 2CO checkout page and include the "cart_order_id". [/quote]

Ok ....this is what i didn't understand. So basically, instead of having the site redirect directing to 2CO - you are saying i need to have it send the info to my own script which will record the info in my database, and only then forward it to 2CO? What is such a script? :)

[quuote]4) When 2CO sends them back to you, you can then update the DB again with "paid" address etc. [/quote]

Ok...kinda following..so basically i gather i need this script that will

a) Write the info to my database and.
b) Then forward them onto the 2CO checkout page.

Am i right? or should i just resort to paypal (just kidding :)

Thanks again Birdman for all your help.



 7:24 am on Jan 29, 2005 (gmt 0)

If you use v2, you just need to post any of your own
to variables (AIM#, ICQ#...) to https://www2.2checkout.com/2co/buyer/purchase
and then it will send back these variables to your php script.


 2:38 pm on Jan 29, 2005 (gmt 0)

Hi IProgram :) I know that much..that is the exact routine i'm using (in V2), but i don't know how to "capture" those variables so i can actually use them.....


 3:09 pm on Jan 29, 2005 (gmt 0)

To access the passback variables in PHP, use the $_POST array:


I don't use V2, so I did not know you could get custom vars passed back. The system I use only passes a predetermined set of vars.

Beware of one thing...DO NOT FULLY RELY ON THE PASSBACK SCRIPT! I find orders from time to time that never made it back to my script. It could be that the buyer doesn't click that last button after the purchase or it could also be that the connection timed out during the passback. Either way, it's not completely reliable so you should download your CVS report from 2CO and compare it to your records.


Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Ecommerce
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved