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.

 

https://developer.paypal.com/docs/classic/lifecycle/sb_create-accounts/

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 https://www.sandbox.paypal.com.

2.       Login with your Business test account.

3.       Go directly to the button creation page by entering the following URL to your web browser: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_button-designer.

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="https://www.sandbox.paypal.com/cgi-bin/webscr" 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="https://demo.eleckey.net/paypal_keygen.aspx">

<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">

</form>

PayPal Payment Demo

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

 

https://developer.paypal.com/docs/classic/lifecycle/sb_create-accounts/

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 https://www.paypal.com/signup/account

         Create a live PayPal payment button. Then, replace it to your Sandbox test payment button. Follow the instructions at https://www.paypal.com/webapps/mpp/get-started

See Also

         Configuring Activation Server for PayPal KeyGen

         Order Confirmation Email Template

         Testing PayPal KeyGen

         Product Upgrade Purchase

         SMTP Configuration

         Email Template