Backbench Docs
  • Introduction
  • Getting Started
    • BBLANG
    • Node
    • Python
    • Go
  • Backbench Features and UI workflow
  • API Reference
    • BBLANG
    • Node
    • Python
    • Go
  • 3rd Party Integrations
    • Login using Facebook
    • Login using Google
    • Login with Twitter
    • Login using LinkedIn
    • Connection with MongoDB
    • Connection with MySQL
    • Geo Location Integration
    • Integration with AWS S3
    • Integration with Google Cloud Storage
    • Integration with Razorpay
    • Integration with Stripe
    • Integration with Mailchimp
    • Integration with Segment
    • Sending Emails with SendGrid
    • Sending Emails with Mailgun
    • Sending SMS with Twilio
    • Sending Push Notification with Pushwoosh
  • Troubleshooting and support
    • CNAME Support
    • FAQS
    • Error Codes
  • Testing
Powered by GitBook
On this page
  • What You'll Need
  • Prerequisites for the app
  • Frontend
  • Backend
  1. 3rd Party Integrations

Integration with Razorpay

PreviousIntegration with Google Cloud StorageNextIntegration with Stripe

Last updated 6 years ago

What You'll Need

Backbench account - , the personal account will always remain free to use.

Razorpay account – sign up and generate your test credentials i.e key id and secret key (www.razorpay.com).

Prerequisites for the app

  1. Sign In to Backbench account.

  2. Select +, in the upper right corner to create a Bench. For example, say "bench_one" and select CREATE or hit Enter.

Frontend

  • Select +, in the upper right corner of file manager to create a html file . For example, say "razor.html" and select CREATE or hit Enter.

  • Copy and paste the code module from below.

  • Replace KEY-ID from Razorpay test dashboard.

  • Select save.

<html>
<form action="/razor" method="POST">
<!-- Note that the amount is in paise = 50 INR -->
<script
    src="https://checkout.razorpay.com/v1/checkout.js"
    data-key="KEY_ID"
    data-amount="5000"
    data-buttontext="Pay with Razorpay"
    data-name="Merchant Name"
    data-description="Purchase Description"
    data-image="https://your-awesome-site.com/your_logo.jpg"
    data-prefill.name="name"
    data-prefill.email="support@razorpay.com"
    data-theme.color="#F37254"
></script>
<input type="hidden" value="Hidden Element" name="hidden">
</form>
</html>

Backend

  • Select +, in the upper right corner to create a Module. For example, say "razorpay.js" and select CREATE or hit Enter.

  • Copy and paste the code module from below.

  • Replace API key from test dashboard.

  • Select save.

var request = require("request");
module.exports.endpoint = function(req, cb) {
    request(
        "https://API_KEY@api.razorpay.com/v1/payments/?count=5&skip=1",
        function(error, response, body) {
            if (error) {
                console.log(error);
                cb({
                    d: error.message
                });
            }
            console.log("Response:", body);
            cb(undefined, {
                Response: response.body
            });
        }
    );
};
template:rhome()->{ 
    ' <form action="/razor" method="POST">    
<!-- Note that the amount is in paise = 50 INR -->
<script
    src="https://checkout.razorpay.com/v1/checkout.js"
    data-key="key"
    data-amount="100"
    data-buttontext="Pay with Razorpay"
    data-name="Merchant Name"
    data-description="Purchase Description"
    data-image="https://your-awesome-site.com/your_logo.jpg"
    data-prefill.name="name"
    data-prefill.email="support@razorpay.com"
    data-theme.color="#F37254"
></script>
<input type="hidden" value="Hidden Element" name="hidden">
</form> '
}

razor:rhandler(req)->{
    res = bb:http:get({
    url:"https://key:secrect@api.razorpay.com/v1/payments/?count=5&skip=1"
    })
    
    bb:log(res);
    return (res);
}

The API-KEY here is a combination of Key ID and Key Secret. After generating the keys from the dashboard, you must download and save them securely. e.g. )

Sign Up
https://<key-id>:<key-secret>@api.razorpay.com