Razorpay Payment Gateway Integration using PHP with cURL

Razorpay is a popular payment solution provider available to businesses selling online in India.Razorpay provides clean, fast, secure payments services with hassle free integration. It allows online business to accept and process payments payments modes like including major Credit Cards, Debit Cards, Net-banking, Wallets & UPI. With the easiest integration, completely online onboarding, feature filled checkout and best in class performance, quickly go live with Razorpay and experience the future of payments.
In this tutorial, you will learn how to integrate Razorpay Payment Gateway using PHP with cURL.This is a very simple example, you can just copy paste and change according to your requirement.
Create Account and Integrate Payment Gateway
  • At first Create Account.
  • After successful sign up and generate Key ID and Secret Key
Razorpay Payment Gateway features:
  • All the major payment method like debit, credit card, netbanking
  • Razorpay payment gateway is very safe and secure
  • Easy and hassle free integration
  • Payment gateway kit available on multiple programming language
  • UPI and Multi Bank EMI options
Before started to implement the Razorpay Payment Gateway Integration using PHP with cURL, look files structure:
  • razorpay-payment-gateway-integration-using-php
    • css
      • style.css
    • images
    • templates
      • header.php
      • footer.php
    • constants.php
    • index.php
    • callback.php
    • success.php
    • failed.php
Step 1: Create a file named constants.php and define Key ID and Secret Key
Step 2: Create HTML form named index.php
Step 3: Create a file named callback.php
The file handles the payment process.
Step 4: Put the below script code in index.php file
We will use the chekout.js of razorpay payment gateway for duduction of payment.
Step 5: Create a file named success.php
Step 6: Create a file named failed.php
Create header.php and footer.php section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header and footer section.
header.php
footer.php