Forum Moderators: buckworks
Using the new "PayPal shopping cart" (buttons) you can very easily integrate PayPal payment processing into nearly anything from a full blown shopping cart, to email invoices, to custom buttons to display with one of a kind items.
I have recently written a shopping cart (Perl/CGI) script that generates the [Add to Cart], [View Cart] and [Checkout] buttons dynamically. It's very simple to do. I have also recently begun sending email invoices with PayPal payment buttons... nice, simple, easy to understand.
The rates aren't bad either... no monthly merchant account fees... if you don't make money you don't pay them anything.
For a typical cart, you'll need these variables:
item_name_[x]
quantity_[x]
item_number_[x]
amount_[x]
on0_[x]
where [x] is the index of the number of items contained in your cart. This is pretty much it.
IPN is just a string that paypal passes to your script. Just take the string and break it down and do whatever you want with it. Most people just take the quantity associated with the item, and deduct from your product DB. You can also use it as a trigger to email your customers about the status of the payment and such.
Another note: I find it easier to "package" your cart into an order "object", so both paypal and your credit card payment can use the same object in the check out process. This makes further update much easier and you don't need to manage 1 set of scripts for paypal and another set of scripts for credit card.
I first went to the developer site and downloaded all the related PDF documentation. I printed these out, put them in a binder, and spent a day carefully reading through them. Then I spent half a day designing how it would integrate with my system, and another day writing a PHP script that would be my IPN processor. Paypal POSTS to this script whenever a payment (or refund) is made. It's a complex script that has nearly dozen steps, but once made it is secure and reliable.
Next, I created a personal account and sent about a dozen $1.00 test payments (which I later refunded). This is what they recommend, and it allowed thorough testing of the system. Now, I can collect credit card payments and issue refunds and my site user's accounts are automatically updated to reflect the change. All I do is read the email notices from the script to make sure everything went okay.