PayPal JavaScript Express checkout Integration in PHP MySQL – Part 1

PayPal JavaScript Express Checkout in PHP and MySql
Written by Yogesh Koli

As a developer we always needs to deal with e-commerce applications where payments transactions comes into place and then we need to build a system where user/customer should able to pay online from your application to purchase something, to do so I am going to provide very simple and secure way to implement this kind of functionality to your application.

Now a days there is lot of payment option available but from all them PayPal provides very good interface and opportunity to implement Payment features and important point is it’s secure you can implement PayPal in any website or application it just works out of the box and it’s popular globally.

PayPal becomes convenient way to you and your customer, PayPal makes simple and easier way to get paid and increase your sales.

Tutorial Features:

  • Login screen for the demo (we will have a predefined user ready to login and test the demo)
  • Product Listing with Add to Shopping Cart Button
  • Add Product to Shopping Cart
  • Remove Product From Shopping Cart
  • Shopping Cart page with good design
  • PayPal Express Checkout Button (this button will help us to get paid)
  • My Orders Page with order listing details such as Order Total and Ordered items.
  • Logout the user from the demo

You can checkout the live demo and Tutorial Overview Video:

Live Demo

Tutorial Overview Video:

Let’s dive into it:

Step 1: Database Design

We are going to need users, product details, order details and order items table for this application, so go ahead and create MySQL tables as showing below:

PayPal JavaScript Express Checkout

PayPal JavaScript Express Checkout




Order Items:

Insert Dummy Products:

Insert few dummy products into the products tables, you can use following sql script to insert required dummy products for this demo.

Step 2: Setup Sandbox Account

You are going to need PayPal sandbox account to proceed, visit and sign-up for new developer account.

After getting account created login to your PayPal development account and from the left menu visit Sandbox Account section, where you will see create account button, click create account to get following screen and then enter required details, such as email address and password for you sandbox account as showing below:

Don’t forgot to select Business (Merchant account), as you will be a Merchant at PayPal to accept payments.

Account Details:

Create Sandbox account - Enter Account Details

Create Sandbox account – Enter Account Details

Next enter payment methods details, such as PayPal sandbox account balance, select back verified account to yes and select credit card type and finally click Create Account button

Payment Methods:

Create sandbox account enter payment methods

Create sandbox account enter payment methods

Step 3: Create PayPal REST API Application

Visit My Apps & Credentials section from left menu of PayPal developer account and scroll down to see REST API apps section, click Create App button to proceed creating new REST API Application.

Create New REST API Screen

Create New REST API Screen

By creating REST API application you will have client id and client secrete for the development environment to access PayPal API restfully from the backend, later on you can make this application as a live application if you  are done with your required development and testing, after making it live you would be able to accept real payment from real users, but before doing this you need have active verified PayPal account and make sure your sandbox user is active PayPal user which is having bank account setup and verified.

So move on to the next step you will have following scree to create new REST API, fill in the required field such as Application name and select a sandbox user as showing below:

Create New App:

Create New REST API Screen

Create New REST API Screen

Click Create App button to create new Application, now you should get following screen which gives you recently created application details  such as an account name, Client ID and Secrete code:

REST API Application Details Screen

REST API Application Details Screen

So far we have done with the basic required settings and Database Setup now it’s time to start creating new PHP Application.

Click below link to follow Next steps of this tutorial:

PayPal Express checkout in PHP MySQL – Part 2

About the author

Yogesh Koli

Yogesh Koli is a software engineer & a Blogger lives in India. He's driven by an addiction to learning and a love for adventure. he has 5+ years of experience working with the front-end, back-end, web application development, and system design.

2 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
2 Comment authors
Luisyves Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

newest oldest most voted
Notify of

Thanks Yogesh for your job, excelent! Works fine! This one was the best that I found in the web.


HI SIR, I ‘m very interested with your demo.
please, could you send me all source code, I’d like to integrated this in my web site.

my mail adress is :