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:

Product Name: Test Product Price: $ 25.00 USD Quantity:

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)
buy now basic checkout experience How to include Paypal Buy Now button on your website ?

Demo

Product Name: Test Product
Price: $ 25.00 USD

Quantity:

For more information on PayPal, you can refer the following link:

In the next tutorial, we will learn about PayPal Instant Payment Notification (IPN).

Related posts: