Razorpay Payment Gateway Integration

Razorpay Payment Gateway Integration in PHP and MySQL

In this article, We will discuss in detail about the Razorpay Payment Gateway Integration in PHP and MySQL. Before writing the PHP code, We need to create the Razorpay account on the Razorpay Official Website.

Source Code link available in the bottom

Activate your Key ID and Key Secret on Razorpay Dashboard

Once you have completed the registration process go to the setting section and activate your AppID and SecreteID.

The sample Razorpay secrete ID and App ID given below.

Creating Database

We need to store the customer’s information with payment status as “PENDING” in MySQL database, before sending the request to the Razorpay Payment Gateway. So we will create the Database and one database table. The Database script is given below.

Creating PHP Form

Form is required to post the customers information to the Razorpay Payment Gateway for processing the request. The form Code is given below.

Razorpay Payment Gateway

Now we will send the customer information to the Razorpay payment gateway, when user click on the submit button and also insert one record into the database table with payment status as “PENDING“.

Razorpay Payment Gateway Integration in PHP

Creating pay.php

Now Creating verify.php to get the response from Razorpay Payment gateway and update the response in a database table.

Razorpay Confirmation page



Razorpay Payment gateway integration

Razorpay integration
Razorpay Payment Gateway response page


We explained how to integrate Razorpay Payment Gateway Integration in PHP and MySQL. Hope you like it so please like and share.

Read Also: How to display data from database in PHP in table

Read Also: How to make a dependent dropdown list using jquery Ajax Download