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
  • 115 Questions
  • 61 Answers
  • 2 Best Answers
  • 183 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
  • 1,119
  • 0
  • 0
Answer
Share
  • Facebook

    Related Questions

    • write a program to calculate the electricity bill in java
    • What is mean by Java script and. How is it work in web technology?
    • which computer language is easy to learn
    • 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?

    1 Answer

    1. Swathi

      Swathi

      • India
      • 35 Questions
      • 35 Answers
      • 5 Best Answers
      • 154 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

      • Answer: 1

      write a program to calculate the electricity bill in java

      I got a assignment to write a java program to calculate the electricity bill. Can anyone help me regarding the example program to calculate the electricity bill in java.

      • Answer: 1

      What is mean by Java script and. How is it

      What is mean by java script in web technology? Is java script is hard to learn ? In what order i should learn Java script?

      • Answer: 1

      which computer language is easy to learn

      i am a b tech student, completed my computer education. which computer language is easy to learn, i want to start my career in programming, suggest me computer language which takes less than 6 months and easy to learn.

      • 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

    Stats

    • Questions 1,898
    • Answers 1,978
    • Posts 8
    • Best Answers 71

    Recent Questions

      • Answers: 2

      tvs raider vs honda sp 125 which is better compare

      I have plans to purchase a bike for myself. I am looking forward to buy

      • Answer: 1

      tata sky vs airtel vs dish tv vs sun direct

      I bought a new TV and I want to have a new dish TV connection.

      • Answers: 2

      Volume is not coming on Star sports 1 HD channel

      On Tata sky HD there is a new channel for Star sports 1 HD. It

      • Answer: 1

      Why can't I share a Snapchat story?

      I try to post Snapchat story on my Snapchat account and I couldn't do it.

      • Answer: 1

      legrand vs havells vs anchor vs goldmedal which switches are

      We are constructing our own house and I am looking for the best brand in

    Explore

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

    Footer

    Recent Comments

    • Tarun on tvs raider vs honda sp 125 which is better compare sp 125 vs TVS raider
    • shree on tvs raider vs honda sp 125 which is better compare sp 125 vs TVS raider
    • Rajesj on tata sky vs airtel vs dish tv vs sun direct
    • Ramul raj on Volume is not coming on Star sports 1 HD channel on Tata sky how to fix
    • Dinesh on Volume is not coming on Star sports 1 HD channel on Tata sky how to fix
    Ask A Question

    Archives

    Tags

    android 11 release date (1) Google News App (1) if x+y+z=0 show that x3+y3+z3 is equal to (1) if x+y+z=0 show that x3+y3+z3=3xyz (1) if x+y+z=0 show that x3+y3+z3=3xyz solution (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.