Welcome to Techno Smarter QA, Questions, Answers Community
Welcome to Techno Smarter Q&A, where you can ask questions and receive answers from other members of the community. Ask the Technical & Programming related questions that you want. Guests Posting are allowed.
+3 votes
46 views
I want to create an e-commerce website in HTML and PHP. I want to integrate PayPal buy Now button in PHP. I am creating an eCommerce website using PHP and MYSQL database. I wont to know, how to add a buy now button on the PHP eCommerce website to sell products.
in PHP by (170 points) 4

2 Answers

+2 votes

Paypal payment gateway offers you to use many PHP SDK or source code for the PayPal payment button on the PHP website. If you are creating e-commerce on the PHP website then you should understand the complete concept of integration via Paypal payment gateway. As you know, WordPress provides better plugins without any coding but if you are a developer and want to integrate the PayPal payment gateway button on the PHP website then you will need Paypal integration KIT. 

There are many Paypal PHP kits available on the Internet or at  Github of PayPal

Follow the steps to create an eCommerce website in PHP with Paypal buy now button. 

How to integrate the PayPal payment gateway button on the PHP website?

1. We do not provide code. We help in error and suggest better development. First of select Paypal payment gateway PHP kit for development. 

2. You are creating an e-commerce website in PHP then you have to create a database table for all products. Table columns like-, product id, product name, description, image,  price, etc. and Create PayPal success table. 

3. Insert some products in that database table. We use this table to display the products on the website and buy with PayPal payment gateway. 

4.  Display all the products on the website page with PHP While Loop. While loop will help you fetch and display all the products on the website.  

5. You must create a details button for the product show page. Create a show page and display the product name, image, price, etc. 

Suggested tutorials - 

https://technosmarter.com/php/next-and-previous-buttons-with-mysql-database

https://technosmarter.com/php/how-to-create-blog-using-php-and-mysql-database

6. There should be a buy now button. Use the Paypal payment gateway kit and configure the required details. In PHP PayPal integration KIT, you will get a buy now button. 

Use this buy now button to redirect on the Paypal website. 

7. After payment successfully, the customer will be redirected on your website and the success data will be store in another Paypal payment gateway table. 

You can get another best PHP source code for this solution -

Integrate PayPal payment gateway in PHP with MYSQL database | PHP scripts

If you another issue then comment here - 

by (6.7k points) 7 27 60
edited by
+1 vote

I was also searching for this solution. I created an eCommerce website in PHP with an MYSQL database and Paypal payment gateway. The eCommerce website contains many products with a unique ID. You can use a unique ID and can display the products on the PHP website.  You can find the Paypal PHP kit on the internet or direct it to PayPal developer

Integrate PayPal buy now button in PHP eCommerce website 

Create products and display them on your website with a button buy Now. Do you know, how to get an ID value with GET method and use that ID to fetch data from the database? 

Like - Select image, title, price from table_name where id = $id ; 

The $id will save the GET value from the URL. 

for reference, you can check Update operation in PHP -  

Create another checkout page. The checkout page will be contained the Paypal payment form ( Paypal payment gateway PHP KIT ). 

Fetch all the data related to id and use with the Paypal payment gateway kit. You will get a submit button with PayPal PHP KIT. Change the submit button value and make it pay now.  

In this way, you can create an eCommerce website in PHP and sell your physical and digital products with Paypal payment gateway. 

by (8.9k points) 8 22 61
...