In this tutorial, we will learn how to create Buy Now Button using PayPal.
I assume that you have basic knowledge of HTML.
See Demo.
Source Code:
Lets start from the beginning of the code.
To create a PayPal Buy Now Button, we need to specify few variables.
- On Line #5 business tells PayPal where to deposit the money.
- On Line #7 cmd is used to tell PayPal what type of transaction is being made. Since we are creating Buy Now button, its value is “_xclick”.
- On Line #9 item_name is used to tell the product name to PayPal.
- On Line #10 amount tells PayPal the price of the product.
- On Line #11 currency_code tell PayPal the currency of price. The default is USD. List of allowable values of Currency Codes can be found here.
- On Line #14 quantity tells PayPal the total number of product bought by the customer.
When a customer clicks on the Buy Now button, all these variables are passed to PayPal.
The process is shown in the following image (Copied from PayPal)
For more information on PayPal, you can refer the following link:
- PayPal
- PayPal Sandbox
- PayPal Website Payments Standard Integration Guide: PDF HTML
- PayPal Sandbox User Guide: PDF HTML
- Merchant Setup and Administration Guide: PDF HTML
- HTML Variables for Website Payments Standard
In the next tutorial, we will learn about PayPal Instant Payment Notification (IPN).
6 Comments
oh thats a nice tutorial . but i guess you dont have to go through all thoe codes , looks scary to me . I just added paypal buy now button in my blog , and included the code using adsense ad manager so that i dont have to insert it manually inside the page . That makes it clean and easy to insert without breaking page elements .
Hi Sourish, thanks for your comment. I included the code for those who want to learn how to include Buy Now button in their websites. This tutorial can be used to add Buy Now button on websites which are not using WordPress also.
Yes , we can even change the Buy Now Button to something fancy . Like the buy now button on other sites , paypal gives the option to choose your own
Yes, we can either use the different buttons provided by PayPal or any other button. But the classic PayPal Buy Now button is like a trademark. 😛
Hi,
I am starting a Tumblr page and I would like to sell items from there. I tried to paste the HTML code for a PayPal button but I don’t think this works in Tumblr.
Any suggestions on how to get that little ‘Buy Now’ button next to my Tumblr pic? Or something similar?
Thanks in advance.
i’m having the same problem with my tumblr account…. if someone could help us out here, that would really be delightful… 🙂 thank you.