Friday, November 07, 2008

Paypal Integration

I recently have been setting up an ecommerce site from the ground up. One of the task at hand was to incorporate Paypal as a method to the checkout process. Paypal offers many ways to do this. From APIs that process the credit cards on your site to passing off variables over, to simply adding a buy now button on each product.

I opted for a middle of the road option at first, which they label _cart. HEre is the code:


This option allows you to gather your products in your shopping cart and send each item to be listed individually on one invoice in the Paypal site. The problem is that this option does not allow the developer to submit discount or coupons.

This posed a major challenge as the site I was building makes use of coupons and other special promotions such as free shipping based on benchmarked dollars spent.

The solution, set the cmd hidden field to _xclick and pass all the items in one description field. It's not as pretty or user friendly as the previous solution, but you then only have to pass Paypal a total amount which includes all discounts, tax, shipping charges all in one line.



The bottom line is that as you are developing Web sites you will be thrown several curves. You will encounter a multitude of problems. The best thing to do is to go at it, do some research and thing of simple solutions. Don't get wrap up on the problem, the best solutions are simple, effective, and best of all easy to code.

Labels: , , , , , ,

Digg This Del.icio.us Slashdot

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home