Payment Gateway Integration PHP MySQL

Here I explain how to develop Payment Gateway Integration PHP & MySQL programming language. Actually nowadays every business owners are take their products & services in online mode. Because we are currently living on digital world & every people has smart phone even kids. So we need payment gateway process integration script for accept and collect payments from customers end. Therefore here I explain best gateway for collect payment from users side.

Number of payment service providers are available in India & around world. But most of Indian business owners are select India payment gateway who are provide best services. For example Razorpay is one of the best and high feature payment gateway providers with all type of payments such as UPI, QR code scanner, Debit/Credit Card, Net banking and more.

razorpay payment gateway integration php
credits – Razorpay

Already we are upload one article for how integrate Razorpay in PHP scripting language without database connection. Therefore in this tutorial we are explain with MySQL database for retrieve and store further details like Order ID, Razorpay ID, Customer phone number etc. Every project has database so we need help of MySQL for process back-end files. Best Payment Gateway for collect Online payments without any website or android application.

Through the WhatsApp we can able to share payment receipt for our customers. The processing step is very easy to create via Razorpay admin dashboard. They are provide more ways for help customers and at a time save business peoples time & money. Because both are important to execute business without any issues.

Competitor – PayU, CCAvenue, Cashfree, Stripe, PayPal etc

Actually competitors are lot when compare with payment gateway concepts. Behind the reason is if we create good gateway then we can earn Lakhs of money per month based on business peoples. This is the major reason for why competitors are compete their services. Once upon a time (before comes Razorpay) PayuMoney and Instamojo ruled most of business owner who are sell their products or services via online website.

But now entire thing was changed and currently Razorpay take over all customer including other countries. Reason is quality of services, 2% transaction fee, Customize option for premium plan, easy to integrate with our site or application, clear documentation and more. In the previous post we are compare into PayU vs Razorpay, once read the article to know some updated things.

Razorpay Features

  1. Instant Activation
  2. Easy to Integrate with App & Website
  3. API Automation
  4. 100+ Payment Options
  5. Reasonable Prices
  6. No Hidden Charges
  7. Customized Enterprise(Premium) Plan
  8. User Friendly Navigation
  9. Secure Payment Connections
  10. Fastest Support
  11. Create Payment Pages, Link & Button
  12. Smart Collect
razorpay php integration example

Payment Gateway Integration PHP & MySQL – Razorpay

Okay let’s see the steps for how create and integrate Razorpay payment gateway in PHP Languages. Some peoples are told like it’s support only PHP framework like Laravel, Codeigniter and not support Core PHP. But it support both and able to integrate and accept payments.

First you have to create one account on Razorpay and then Submit KYC for enable the live Mode. Without submit KYC we can’t receive live payments but able to testing virtual payments via test mode. In the test you can get Key Id & Secret key for integrate with our website or android, ios mobile application.

Razorpay SDK

Install Razorpay PHP SDK (Latest Version) via composer if you are working with Framework based projects. Otherwise just install SDK file on GitHub page and then paste on your current project. Then only we able to stored data from database, without SDK we can’t communicate with database side.

Source Code

First we have to create configuration file for integrate with Razorpay and connect into MySQL database. So here first you have to create config.php file and then copy below code for further implementation of code.


$keyId = 'rzp_test_9TB3asShG3RvdV';
$keySecret = 'zrpWBMrytnHq5UMUeVikNgfn';
$displayCurrency = 'INR';

//These should be commented out in production
// This is for error reporting
// Add it to config.php to report any errors
ini_set('display_errors', 1);

$host = "localhost";
$username = "root";
$password = "";
$dbname = "razorpay";

Download Code – Payment Gateway Integration PHP

The full source code available on below zip file. In above I have added just only database configuration file and don’t forget to add SDK file on your project. Already I told without SDK file we can’t communicate with database side.

Leave a Reply

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