Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

pdf icons

Create A PayPal Payment Button ( i.e. The Buy Now Button )

Payment transactions through PayPal are safe and very common for online shopping. PayPal can be used to sell products. Using PayPal you can easily create a simple Buy Now button and create your product page to sell products.

The following tutorial will teach you how to create a simple PayPal Buy Now button using a PayPal Sandbox.

To learn how to create a PayPal Sandbox account please refer to: http://www.opensourcevarsity.com/paypal/l8creatingsandboxaccountpaypal

To create the Buy Now button using a PayPal Sandbox account, login to your PayPal sandbox account by simply entering the URL https://www.sandbox.paypal.com/ in your Browser.

The homepage of PayPal Sandbox loads as shown in Diagram 1.

Enter the appropriate PayPal Email address and password {which was provided while creating account in PayPal Sandbox} and then click on Log In as shown in Diagram 1.

diagram1.png
Diagram 1

When you log into the PayPal Sandbox Test Environment, its home page appears as shown in Diagram 2.

Click on Test Accounts as shown in Diagram 2 to enter the personal and business test accounts.

diagram3.png
Diagram 2

Select the Business Account radio button and Click Enter SandBox Test Site as shown in Diagram 3.

diagram3.png
Diagram 3

You will be redirected to the login page of the Business Paypal SandBox Account as shown in Diagram 4.

Enter the appropriate Business PayPal Email address and password and then click on Log In as shown in Diagram 4.

diagram4.png
Diagram 4

Click on Merchant Services tab at the top menu provided in PayPal as shown in Diagram 5.

diagram5.png
Diagram 5

Various tools available for PayPal merchants can be viewed on the Merchant Services tab. They are:

  1. Buy now Button
  2. Add to Cart Button
  3. Send Invoice
  4. Virtual Terminal

Click on the Buy Now Button link as shown in Diagram 6.

diagram6.png
Diagram 6

In Step 1, from the drop down list box whose label is Choose A Button Type select Buy Now type of button and enter the required payment details as shown in Diagram 7.

NOTE:  There are other button types that are explained in other PayPal tutorials.

In our example, the following values were entered:
Choose a button type: Buy Now
NOTE: Other available options are Shopping cart, Donations, Gift certificates, Subscriptions, Automatic Billing and Installment Plan.
Item name: IT Book
Item ID: 001
Price: 45
Currency: USD

NOTE: You can select any currency from the drop down list.
Merchant account IDs: Select the radio button - Use my Secure merchant account ID (for security reasons).

Other facility:

  1. Customize the button.
  2. Enter the shipping cost in the given text box.
  3. Enter the percentage of tax rate to be included in the cost by entering the value in the given textbox.

diagram7.png
Diagram 7

The second tab is optional tab where you can track the inventory, profit & loss details as shown in Diagram 8.

diagram8.png
Diagram 8

The third tab is optional where you can set advanced features of PayPal button as shown in Diagram 9.

After executing all the above steps, click on Create Button as shown in Diagram 9.

diagram9.png
Diagram 9

Click Select Code to select all the button code. Copy the code (Ctrl + C) as shown in Diagram 10.

diagram10.png
Diagram 10

Open Notepad or any editor (such as Editplus, Dreamweaver) and paste the html codespec (button code) in the editor (wherever you want the button to be displayed on the webpage) as shown in Diagram 11.

Save the file as {filename}.html.

diagram11.png
Diagram 11

Now whenever the page containing the button is loaded in the Browser, the Buy Now button gets displayed in the following manner as shown in Diagram 12.

For this, run the HTML file in any Browser (like Firefox, Safari, Chrome and Internet Explorer). The PayPal button gets displayed on the specified location as shown in Diagram 12.

Click on the Buy Now payment button.

diagram12.png
Diagram 12

You will be redirected to PayPal Payment gateway page as shown in Diagram 13.

On this page you will be able to view the summary of ordered details.

For the confirmation of payment, the buyer has to enter the email address and password in the login section. Click on Log In as shown in Diagram 13.

diagram13.png
Diagram 13

After successful login, you can review your information (shipping address and PayPal methods) as shown in Diagram 14.

Click Pay Now for payment to proceed as shown in Diagram 14.

diagram14.png
Diagram 14

System will generate the following messages after your payment as shown in Diagram 15.

Thanks for your order
Test, you just completed your payment.
Transaction ID: XXXXXXXXXXXXXX
An email with your order summary has been sent to <email_id>.

diagram15.png
Diagram 15

The Personal Account gets debited for the correct amount as shown in Diagram 16.

diagram16.png
Diagram 16

The Business Account gets credited with the correct amount as shown in Diagram 17.

diagram17.png
Diagram 17

This shows the successful transaction between a personal and a business using the PayPal Buy Now button.

OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download
LinkShare_180x150
Artisteer - DNN Skin Generator
Tapestry Theme - A Tumblog-Style Theme for Wordpress