Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 10th, 2006, 12:18 PM   #1
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 4 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
inputing on one form for two forms

I'm building a website for this client and they want a shopping cart (on our site) and then able to use paypal's shopping cart (which is basically just a button on our site to add it to their cart. I don't want to have her half to input the information on both forms, so does anyone know a way I can have 1 form go to two different places or when she hits the submit button it also puts it into the other form page? Let me know if you need anymore details.
PhilBon is offline   Reply With Quote
Old Mar 10th, 2006, 12:26 PM   #2
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 224
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
You could have a javascript function to copy the data from the first form over to the second form and then return true in the OnSubmit even for the first form. Guess that depends on how its setup, i'm not really sure
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi
freelance scripts - http://ryanguthrie.com/index.html
Mocker is offline   Reply With Quote
Old Mar 10th, 2006, 12:32 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Here is how I handled it on a site soon to go live. The cart is local ('my' cart). When the customer checks out, they have two buttons available -- a pay by mail and a PayPal button. If they click the Pay By Mail button I open up a separate window, gather the shipping information, validate it, and submit the order. The server also validates the information and enters the order. The details of the order are contained in 4 tables in a MySQL database.

If the customer selects the PayPal button, I submit the value of the cart, in its entirety (including shipping and tax) to PayPal with a unique order idendification number (the same number used in the Pay by Mail approach). The buyer is not required to supply any information to me -- PayPal collects it or has it. PayPal handles the transaction and redirects to me, with an indication that the amount was paid or cancelled. If the amount was paid, the redirection includes a transaction token unique to the order/transaction. I hit PayPal again with the transaction token and an authorization number. They respond with the customer's details (same as my Pay by Mail shipping information) and I then submit to the server in precisely the same way as I do for Pay by Mail. I send an email link to the seller and another to the buyer. These bring up a order details page containing the customer information and a detailed list of the items ordered, as well as shipping and tax charges. The seller's page has more abilitiy, in that the order may be marked as shipped, etc. The buyer also gets a link to PayPal, if PayPal was used, so that he/she may verify the payment in that way.

You have a number of options with PayPal. You may have PayPal do the shipping and or tax. You may submit items individually. You may have PayPal supply the cart. I find my way to be preferable, as the action is the same regardless of the payment method chosen, and will remain the same even if my client adds another payment method.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 10th, 2006, 12:54 PM   #4
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 4 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
I like your method really well. My question is (and I might just have to go looking on PayPal) how do you send your whole cart that way? Is what you send the cost of the cart (as in the grand total) or is it all the items? If you wouldn't mind I'd really like to be able to talk to you more on this, DaWei. If you have time could you possibly lead me throughh setting it up as well? Thanks Guys!
PhilBon is offline   Reply With Quote
Old Mar 10th, 2006, 1:56 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
As I said, you have many options with PayPal, from single-item, buy-now thangy to submission of a total that represents the entire order. I chose the later approach because I already had a cart and order-submission procedure in place before the client decided to add PayPal. Initially, my client wanted PayPal to add shipping and tax, which is okay, and easy enough to do, but it departed from the procedure in place and required bookkeeping function on the server that keyed on whether or not the payment was cash or PayPal.

For testing with PayPay, you use something called the 'sandbox'. You need a business account with PayPal, but you duplicate this in the sandbox. The sandbox also allows you to establish fake 'buyer' accounts, with credit card numbers, bank name and account numbers, all that good hooraw.

Really, for ease of use, I recommend you submit the total cart value to PayPal as a single item. Make your own decision about tax and shipping. The cart contents need to be identified with a unique value, of course, for your own handling purposes.

Go to www.sandbox.paypal.com. Establish an account there and in their Developer Central. As you are doing that, you will come across a number of things, including links to their various methods of interface. Download some of those PDF documents. Make a seller and some buyer accounts.

Initially, PayPal reacted with the user through ordinary form submissions and redirections. There are a couple of different overall ways to interact with them. Things like Payment Data Transfer. Instant Payment Notification. There are is also, now, the option of transacting data with XML files. I chose to forego that at this time.

Dig around, familiarize yourself with options. If you have further questions, feel free to post back. You need to consider the design of your operations prior to coding. Just recommending that you patch and ding things with Javascript is not a truly viable response and will result in mostly a mess.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC