Indian Payment Gateway Solution/ RazorPay Checkout

Hello there, I’m showcasing you how we can able to integrate Razorpay checkout & API.

RazorPay Supports UPI, Debit Cards, Credit Cards, Pay Later/ EMI, Netbanking, Wallet

I’ve integrated Razorpay’s payment link API.
Implemented on one glide’s template.

https://razorpay.glideapp.io

There are multiple ways to integrate this,

  1. In this demo app, App will send the Payment link on mobile no.as a text SMS as well as on email address just in 4-5 sec. Customers can pay directly from that unique link.

  2. Retrieving custom url to app itself. So, generating real-time link is so easy, but fetching that link to glide needs in-app load facility. Only Pro Apps will allow that, you’ve to wait 7-10 Seconds for that. You can put a loader gif even. And then you can also put webview this pay link.

  3. If your products are less, then you can generate links at the time of registration for the first time.

I found it so easy and flexible with RazorPay. Even it’s API Documentation is too easy to implement.
You can generate unlimited links.

Here you can create Razorpay account https://rzp.io/i/ordIOjC

5 Likes

Hey @Purvang_Joshi,

This is really awesome work. I have been trying to integrate Paytm into my app, but only half way there.

what I did was, create a Paytm business account. then used the dashboard to create a set of payment links, 50,100,200,300. ( since all my products are within that range) then attached those links to buttons and make them appear based on what product users selects. this either takes them directly to Paytm website or open the app for direct payment with the amount pre selected.

The only issue i have is gettign the order status back into my google sheet. I dont any experiece with API integration and dont know how to call the API via JSON into the sheet with appscripts. Is there a way you could help me on this? If i can call the api value of transaction ID/Order ID into the sheet, i can match that with the mobile or email user registerted with and credit the amount into the app.

1 Like

Sure. Will look into this. Based on my experience with Indian payment gateway, the api infrastructure of razorpay is too good other than new in the market. You’ve more flexibility in terms of transaction management.
I’ve one client who wants to transfer 40% of the transaction value to the merchant on the product bases. I’ve implemented this type of cases and it worked best for me.
I’ll sure work on paytm case asap. :v:

3 Likes

@Purvang_Joshi and @Manan_Mehta I just came across https://www.pabbly.com/ which integrates various payment gateway with Google Sheet using Webhook.

They also have easy to understand videos on how it works.

Just thought to share it with you.

4 Likes

Hi @Purvang_Joshi can you please share a tutorial or documentation, on how to integrated razorpay into glide?

Hey, will share you for sure next week.

Hey Bro, sorry to bother but any update on this?

Hey, I’m away from work. Will be back after 12th.

HI Purvang,

Thanks for this topic. A few questions.

  • Does razorpay include all common online payment methods for India? (i’m from Europe, and diving into the Indian market right now).
  • Do Indian people generally prefer their prices in Rupee or would Dollar work as well?
  • Can I see an integration of Razorpay in an app? (I checked your app in the comments, but for me it just functions as a form. I’m not being redirected, maybe i’m missing something)

Thanks!
Wouter

Just noticed razorpay does not accept companies outside India :frowning:

Yes. I think you may need registration of indian company. You can establish foreign unit if your company matured enough.

Hi @Purvang_Joshi

Can you please share a tutorial on this? I am trying to integrate Razorpay in my app but I have no idea how API works.

Thanks

Pratik

Hey,
I’m on my way to do this. You’ll receive it shortly.

1 Like

Thanks Purvang. Would be really helpful.

Hey @Pratik_Shah
RazorPay has introduced a new version for Payment Links API. I was figuring out last week how we can integrate in such a way that it interacts with us faster and smoother process.

In this method, we’ll be sending Payment Links (UPI & Standard) to customers.
When a button clicks, we’ll fire an API that is located at Apps Script. Then, the Customer will receive a text message or email message of the payment procedure.

Types of Payment Links:
First of all, we need to check, we have a legacy API Contract configured or a new one.
For that, you need to refer to this Payment Links
For mine, it’s a new API contract

UPI: It’s working on Android Only as of now. When the customer clicks the payment link, all UPI apps installed on the phone will appear.
Standard: For all type of payment methods.

Fire an API

Step: 1 Create API key from RazorPay Dashboard
Step: 2 We're going to create UPI enabled payment link. Copy this code

function doGet(e) { //Displays the text on the webpage. return ContentService.createTextOutput("This is a GET Request!"); }

function doPost(e) {

var body = JSON.parse(e.postData.contents);
var name = body["params"]["Name"]["value"];
var email = body["params"]["Email"]["value"];
var number = body["params"]["Number"]["value"];
var Desc = body["params"]["Description"]["value"];
var Fees = body["params"]["Fees"]["value"];
var Rfrnc = body["params"]["Reference"]["value"];

var headers = {
“Authorization”: Basic ${Utilities.base64Encode("API KEY:VALUE")}
};

var customer = {
“name”: name,
“email”: email,
“contact”: number
};

var payload = {
“amount”: Fees,
“currency”: “INR”,
“description”: Desc,
“customer”: customer,
“notify”: {
“sms”: true,
“email”: true
},
“upi_link”: “true”,
“callback_url”: “https://example-callback-url.com/”,
“callback_method”: “get”
}

var options = {
“method” : “post”,
“payload” : JSON.stringify(payload),
‘headers’: headers,
‘contentType’: ‘application/json’,
};

var url = “https://api.razorpay.com/v1/payment_links”;
var response = UrlFetchApp.fetch(url, options);
Logger.log(response);
}

Step 3: Click deploy button on right top corner of the apps script. Click on setting button then deploy it as a web app. Then select access as anyone. After final clicking on deploy button, you’ll have a URL. Copy that URL.

Step: 4 Make a Webhook Action Button on Glide App.
Paste URL to API Input Value.
Add the Following Values and Link them with your tables.
Name
Email
Number
Description
Fees
Reference

Note: You can add more parameter. Here is API Reference, Payment Links Copy Parameters from Request body. Add them to Payload and also fetch it from postdata.
Note: If you want to make a link for 245 Rs then the value of your fees will be 24500. You’ve to add paise as two figure value. Don’t add (.)
Note: Reference ID Should be Unique. You can even assign Row ID.

Getting Back to the Sheets

Whenever user pays successfully, razorpay's webhook will send us data.
Step: 1 Create a new Apps Script Project. Don't add to the existing File. Because Already one web app deployed over there.
Step: 2 Copy this code, enter the fields you need to print in sheet. Enter extra parameters from this sample payload,
https://razorpay.com/docs/webhooks/payloads/#payment-link-paid

Code:

function doGet(e) {
//Displays the text on the webpage.
return ContentService.createTextOutput(“This is a GET Request!”);
}

function doPost(e) {

var body = JSON.parse(e.postData.contents);
var amount = body["payload"]["payment_link"]["entity"]["amount"];
var description = body["payload"]["payment_link"]["entity"]["description"];
var email = body["payload"]["payment_link"]["entity"]["customer"]["email"];
var contact = body["payload"]["order"]["entity"]["customer"]["contact"];
var created_at = body["payload"]["payment_link"]["entity"]["created_at"];
// Add Extra Fields you need

//Converting Created Date (Unix) to GMT Formatted

var formattedDate = Utilities.formatDate(created_at, "GMT+5:30", "MM-dd-yyyy HH:mm:ss");
var sheet = SpreadsheetApp.getActive().getSheetByName("Webhook");

sheet.appendRow([amount,description,email,contact,formattedDate]);  

}

Step: 3
Deploy it as a web app and copy url.

Step: 4
Go to RazorPay Dashboard → Settings → Webhook → Add New Webhook → Paste COPIED URL → Scroll to the last → Activate “payment_link.paid” Action

Now it’ll automatically send data to the sheets.

Let me know If any error occurs. This also can be integrate with Integromat and it’s also so much easy. But this saves a lot of bucks. There are many methods/ API you can integrate with razorpay and glide. It depends upon your usecase.

@Manan_Mehta Hey Dude, Check this. I’ve made it through Webhook Actions.
@Amal Hey, Sorry for the late. This tutorial will surely help you to understand how this works.

4 Likes

:exploding_head:

2 Likes

Thank you @Purvang_Joshi for your time to share the details. Simply amazing!

2 Likes

is razorpay free?

No. Each payment gateway charges 1 to 5 percentage on transaction.
Its vary on payment mode.

Razorpay offers 3 months of zero convenience fee. Don’t know whether its working currently or not.

1 Like

Do they charge for integrating them to our app? Or only on transactions?