Razorpay Demo (Indian Payment Gateway)
This demo shows you step by step how to build a mini-app from scratch. Razorpay is a payment service provider in India. This demo will build a "Create Payment Link" action and a "Payment Paid" trigger. See documentation here: Razorpay Docs.
Process Overview
Steps | What to do |
---|---|
| Register with Razorpay and get an API key |
| Create the app |
| Set up basic app information |
| Set up app authentication |
| Add the "create payment link" action and edit action information and inputs |
| Edit subflow for the action and get action outputs |
| Edit action outputs |
| Install the draft app and test it |
| Add a one-time URL to receive the payment result |
10. Triggers | Add a trigger to send payment result |
11. Testing | Test again |
Register
First thing first, registers a Razorpay account and get your API key in your Settings - API Key:
Create
On your dashboard, follow steps 1 to 7 in the above screenshot to create a version 2 app and enter the app builder.
Settings
In the settings section, click on Edit to edit app information including app name, description, logo and cover image.
Users can view your app information before they download your app.
Auth
According to Razorpay Auth Document, key_id
and key_secret
are required with Basic Auth authentication.
In the Auth section, select Api Key as Auth Type and click Edit to add the 2 auth inputs.
Click on Save when you finish adding key_id
and key_secret
:
Actions - Inputs
Now we have set up the authentication part of your app, let's add actions!
API used: Create payment link.
Follow steps 1 to 6 in the above screenshot to create the action and start editing it.
By following the API documentation, you can see what parameters are required, what types of values are they and, are they mandatory or optional.
Click on Add Items in the Inputs section:
Have your documentation and UChat side by side, and copy and paste information accordingly.
For optional parameters, de-select the Required? toggle and provide a default value if you need to.
We suggest you fill in the Inputs first and left the Outputs after we finish the subflow for this action.
Put on the necessary description and guidance, and have a check on the preview section for your inputs.
Always remember to click on Save instead of cancel before you exit the action editing.
After editing the action information and inputs, create a subflow to run when users call this action:
Flows
Go to the Flows section and enter the subflow we just created:
In the case of creating a payment link, one external request should be enough:
Follow steps 3 to 5 in the above screenshot to start editing the external request. Don't know how to add an Action Step? Don't worry, try right-clicking your mouse.
Select POST
type, paste the URL, select Body
- raw
- JSON
and then copy the 2 parameters, amount and currency.
Replace 1000
and INR
with the amount and currency app fields by hitting the </>
button on the right side. In the pop-up, search the field by name and click to select:
When you insert app fields, the "Test body content" shows. It's to specify testing values for the fields.