PayPal Purchase Button

The following provides a guideline how to create the PayPal payment (i.e. Buy Now) button that allows customers to purchase the product on your website. PayPal provides a virtual testing environment called Sandbox that you can easily test the entire payment process. Once the testing is successful, you can then make a switch to the live PayPal environment.

Creating Sandbox Accounts

To get started, you need to create test accounts under the Sandbox environment for testing PayPal payment transaction. You basically need to create two test accounts. One is the Personal type that represents the buyer in a transaction. The other is the Business type that represents the merchant in a transaction. To create Personal and Business test accounts, follow the instructions provided in the PayPal developer site, under the link below.

Creating PayPal Payment Button

When creating a PayPal payment button, you can customize your button and specify your product and price. Importantly, you must specify the Item ID that matches the EcommerceProdID2 field of your product defined in the Products table of the Activation Server. The PayPal payment button is provided as a short HTML snippet that you can use it to create a purchase page.

To Create a PayPal Payment Button

1.       Go to the PayPal Sandbox site at

2.       Login with your Business test account.

3.       Go directly to the button creation page by entering the following URL to your web browser:

4.       Under the Choose a button type drop-down list, select Buy Now.

5.       Under the Item name field, enter your product name.

6.       Under the Item ID field, enter the value from the EcommerceProdID2 field of your product defined in the Products table of the Activation Server.

7.       Under the Price field, enter your product price.

8.       Click the Create Button button. The Add your button code to your webpage page appears.

9.       Under the Website tab, you can copy the HTML snippet for the payment button.

Adding Payment Button

To add a PayPal payment button for your product, just copy and paste the HTML snippet to your webpage. In addition, you need to add a hidden field named notify_url to the HTML form in order to interface with the PayPal KeyGen. Below is the sample HTML code for the PayPal payment button.


<form action="" method="post" target="_blank">

<input type="hidden" name="cmd" value="_s-xclick">

<input type="hidden" name="hosted_button_id" value="QTGP38G3UR43J">

<input type="hidden" name="notify_url" value="">

<input type="image" src="" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

<img alt="" border="0" src="" width="1" height="1">


PayPal Payment Demo

You can learn more from the demo and try it out at the following URL.

Going Live

Once you have finished testing the PayPal payment button, you can make a switch from the Sandbox to the live PayPal environment. The steps include:


         Create a live Business account. Follow the instructions at

         Create a live PayPal payment button. Then, replace it to your Sandbox test payment button. Follow the instructions at

See Also

         Configuring Activation Server for PayPal KeyGen

         Order Confirmation Email Template

         Testing PayPal KeyGen

         Product Upgrade Purchase

         SMTP Configuration

         Email Template