Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Have an account? Sign In

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Tech Answered Logo Tech Answered Logo
Sign InSign Up

Tech Answered

Tech Answered Navigation

  • Home
  • Tutorials
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us
Home / Questions /Q 3842
Next
In Process
dynamicapps5
dynamicapps5

dynamicapps5

  • India
  • 103 Questions
  • 59 Answers
  • 2 Best Answers
  • 184 Points
View Profile
  • 0
dynamicapps5
Asked: January 8, 20222022-01-08T06:14:27+05:30 2022-01-08T06:14:27+05:30In: Programming Related

razorpay payment gateway integration in php, example code

  • 0

I am doing a eCommerce website and it’s almost done. I want to integrate razorpay gateway to website. How can I implement the razor pay integration code in PHP? Can  anyone showing an example code for integration of razor pay using php code?

how to integrate razor pay gatewayhow to integrate razor pay gateway with php coderazor payrazor pay gateway php code with examplerazor pay integration coderazor pay integration php code
  • 1
  • 754
  • 0
  • 0
Answer
Share
  • Facebook

    Related Questions

    • How to recover images from Google Drive.
    • How to initialize an" int" variable in C++?
    • What is the difference between modules and packages in Python?
    • How to insert data in java through database?
    • How to run java code in eclipse
    • Direction
    • Do you need math for software engineering?

    1 Answer

    1. Swathi

      Swathi

      • India
      • 35 Questions
      • 35 Answers
      • 5 Best Answers
      • 157 Points
      View Profile
      Swathi
      2022-01-10T19:34:19+05:30Added an answer on January 10, 2022 at 7:34 pm

      Razorpay allows you to grow your business and power your finance. Razorpay is a user-friendly payment gateway that provides payment solutions in an easy way. To integrate Razorpay gateway in your e-commerce project using PHP, follow the below steps:

      Step 1: Create Razorpay Account

      Create a Razorpay account and generate KeyID and secret key. This is done by selecting the setting option->API key. Then it asks KeyID and secret key. 

      To test payment functionality let us keep creating the Razorpay account in Test mode. If you want to test in live mode then KYC is asked, so that KYC form filling should be completed and activation of your account will be done.

      This is done after account creation and in the Razorpay dashboard. To know the process of creating a Razorpay account, go through the below link.

      How to create an account on Razorpay?

      Step2: Update Razorpay config details:

      If we use “Test app” to integrate the Razorpay gateway, we need to update config.php with key ID and secret key from Razorpay.

      Step 3: Create a form with Item details.

      In index.php file, we will create HTML code with item details and customer details to send to perform payment. We have pay.php on action to handle the payment.<div class=”container”>
      <div class=”row”>
      <div class=”col-sm-12″>
      <h2>Example: Razorpay Payment Gateway Integration in PHP</h2>
      <br><br>
      <div class=”col-sm-4 col-lg-4 col-md-4″>
      <div class=”thumbnail”>
      <img src=”prod.gif” alt=””>
      <div class=”caption”>
      <h4 class=”pull-right”>₹49.99</h4>
      <h4><a href=”#”>My Test Product”</a></h4>
      <p>See more examples like this at <a target=”_blank” href=”https://www.phpzag.com/”>phpzag</a>.</p>
      </div>
      <form id=”checkout-selection” action=”pay.php” method=”POST”>
      <input type=”hidden” name=”item_name” value=”My Test Product”>
      <input type=”hidden” name=”item_description” value=”My Test Product Description”>
      <input type=”hidden” name=”item_number” value=”3456″>
      <input type=”hidden” name=”amount” value=”49.99″>
      <input type=”hidden” name=”address” value=”ABCD Address”>
      <input type=”hidden” name=”currency” value=”INR”>
      <input type=”hidden” name=”cust_name” value=”phpzag”>
      <input type=”hidden” name=”email” value=”test@phpzag.com”>
      <input type=”hidden” name=”contact” value=”9999999999″>
      <input type=”submit” class=”btn btn-primary” value=”Buy Now”>
      </form>
      </div>
      </div>
      </div>
      </div>
      </div>

      Step 4: Handle item details for payment.

      Step 5:Perform payment with Razorpay:

      We will include Razorpay API checkout.js and handle payment functionality. The sample Php code appears like this:

      <button id=”rzp-button1″ class=”btn btn-primary”>Pay with Razorpay</button>
      <script src=”https://checkout.razorpay.com/v1/checkout.js”></script>
      <form name=’razorpayform’ action=”verify.php” method=”POST”>
      <input type=”hidden” name=”razorpay_payment_id” id=”razorpay_payment_id”>
      <input type=”hidden” name=”razorpay_signature” id=”razorpay_signature” >
      </form>
      <script>
      var options = <?php echo $json?>;
      options.handler = function (response){
      document.getElementById(‘razorpay_payment_id’).value = response.razorpay_payment_id;
      document.getElementById(‘razorpay_signature’).value = response.razorpay_signature;
      document.razorpayform.submit();
      };
      options.theme.image_padding = false;
      options.modal = {
      ondismiss: function() {
      console.log(“This code runs when the popup is closed”);
      },
      escape: true,
      backdropclose: false
      };
      var rzp = new Razorpay(options);
      document.getElementById(‘rzp-button1’).onclick = function(e){
      rzp.open();
      e.preventDefault();
      }
      </script>

      I hope the above sample code might help you. You may also read:

      Do you need math for software engineering?

      • 2
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    Related Questions

      • Answers: 0

      How to recover images from Google Drive.

      Currently, I lost my all image from my phone. can anyone senior from the team tell me how to Recover my all data from google drive?

      • Answers: 0

      How to initialize an" int" variable in C++?

      Hello, I have a C++ programming language in my engineering. I want to know what are C# variables. How to initialize the "int" variable in C++? In how many ways can we initialize an int variable C++. Can anyone please

      • Answer: 1

      What is the difference between modules and packages in Python?

      Hello, I have recently taken up python in my engineering.., python being one of the most trusted and preferred languages on desktop and being one of the high-level programming languages I now want to write a code for the Fibonacci

      • Answers: 0

      How to insert data in java through database?

      Hello.. I have opted for java course in my engineering and took up a project "online shopping" where I have to create a database in MYSQL with products information and I now want to link it with Java and run

      • Answers: 0

      How to run java code in eclipse

      Recently, I am given a task to take up a survey on the topic "Feedback of ABC school" I would like to create a google form and run a java code using eclipse. How to run a code in eclipse

    Stats

    • Questions 1,802
    • Answers 1,879
    • Posts 7
    • Best Answers 70

    Recent Questions

      • Answers: 0

      What are the Tax Benefits on Top-Up Loan?

      A regular home loan gives tax advantages

      • Answer: 1

      Can Everyone see your Cameo on Snapchat

      I used Cameo as my selfie instead of my bitmoji image in snapchat. Can Everyone

      • Answers: 0

      how to find wifi password on phone when connected

      I want to have good wifi connection, but currently using phone data, I asked my

      • Answers: 0

      Home Loan Prepayment

      Home loan prepayment happens while you pay off your loan in complete or in part earlier

      • Answer: 1

      what is managed it services?

      What are called manage it services? Can you want give me an example to explain

    Explore

    • Home
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help

    Footer

    Recent Comments

    • Giten on Can Everyone see your Cameo on Snapchat
    • swiftit_uae on what is managed it services?
    • Moon on message request not showing on instagram how to fix
    • Vignesh ratan on Unable to connect to my wifi on new Android tv saying saved how to fix
    • Ritesh on What are the best Dth services in India
    Ask A Question

    Archives

    Tags

    laptop buying guide (1) laptop buying key points (1) laptop choosing points (1) points to remember for buying laptop (1) things to consider before buying laptop (1)

    Social media

    © 2021 @ Techanswered.com.
    Terms, Privacy policy & Sitemap.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.