PHP Razorpay Payment Gateway Checkout Integration

If you are looking for Razorpay payment gateway checkout integration in PHP, then this tutorial is exactly for you.

razorpay payment gateway

In this post we explained the quick razorpay checkout integration process with live demo.

You can accept payments from your website and app, by integrating with the Razorpay Payment Gateway. Lets check it quick process:

Razorpay Payment Gateway Integration Steps

  1. Get Razorpay Key Id
  2. Create a Product Payment Form
  3. Write Ajax process and Payment Authorization API code
  4. Create a Success page

Step 1: Get Razorpay Key Id:-

First, you need generate the Razorpay Key ID. For this click on ‘Setting’ left menu option, in API Keys tab, click to generate key Id and secret key.

razorpay api keys

You can directly API keys page via this link : https://dashboard.razorpay.com/app/keys

Step 2: Create a Product Payment Form:-

In this step, we need a payment form page, where we need to integrate Razorpay payment gateway.

We have created an index.php file for product payment form. In this an HTML form is created.

Now add the below script code in index.php file, this code will perform an action on the form submit button click. This is the Razorpay checkout js code which populates the payment popup form.

Step 3: Write Ajax process and Razorpay Payment Authorization API code:-

In this step, we have created ‘ajax-payment.php’ code file to handle ajax post request.

Here, you can do database insertion part and checking that payment is authrized or not with the help of Razorpay API call.

Step 4: Create Success Page:-

After a successful payment process, the user will redirect to a success page. In the above index.php file, after getting the success response back, we have to redirect the user to the success.php page.

Use below success.php file code

That’s it. Using these steps you can easily integrate Razorpay payment gateway on your web application.

Recommended Posts For You

About Harish

I am professional web developer and blogger. Use this blog to share own api and other web development experience with you. I do accept paid work. Write to me at - [email protected]

View all posts by Harish