# Razorpay Demo (Indian Payment Gateway)

This demo shows you step by step how to build a mini-app from scratch. [Razorpay](https://razorpay.com)[ ](https://razorpay.com) 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](https://razorpay.com/docs/api/).

### # Process Overview <a href="#process-overview" id="process-overview"></a>

| Steps            | What to do                                                                  |
| ---------------- | --------------------------------------------------------------------------- |
| 1. Register      | Register with Razorpay and get an API key                                   |
| 2. Create        | Create the app                                                              |
| 3. Settings      | Set up basic app information                                                |
| 4. Auth          | Set up app authentication                                                   |
| 5. Actions       | Add the "create payment link" action and edit action information and inputs |
| 6. Flows         | Edit subflow for the action and get action outputs                          |
| 7. Actions       | Edit action outputs                                                         |
| 8. Testing       | Install the draft app and test it                                           |
| 9. One Time Urls | Add a one-time URL to receive the payment result                            |
| 10. Triggers     | Add a trigger to send payment result                                        |
| 11. Testing      | Test again                                                                  |

### # 1. Register <a href="#id-1-register" id="id-1-register"></a>

First thing first, registers a [Razorpay](https://razorpay.com) account and get your API key in your **Settings** - **API Key**:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FOOwfj1rYegDcsWK1Eic2%2Fapp2-71.0d957efc.png?alt=media&#x26;token=6a9e71a0-daee-41d2-9638-24bbafe36fab" alt=""><figcaption></figcaption></figure>

### 2. Create <a href="#id-2-create" id="id-2-create"></a>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FMGjN0NidfVZLROhvpsr2%2Fapp2-0.e875bda2.png?alt=media&#x26;token=cddee61a-6a92-41a1-8c32-29ae3d791c4b" alt=""><figcaption><p>]</p></figcaption></figure>

On your dashboard, follow steps 1 to 7 in the above screenshot to create a version 2 app and enter the app builder.

### 3. Settings <a href="#id-3-settings" id="id-3-settings"></a>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FZLCRwcMmv18m1My6Wr6T%2Fapp2-1.be92c2fc.png?alt=media&#x26;token=0c83a5c3-acc2-492c-96c4-a616096135f1" alt=""><figcaption></figcaption></figure>

In the settings section, click on **Edit** to edit app information including app name, description, logo and cover image.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FIRR0OJRFOmK0C0MlJqAu%2Fapp2-2.5e10b38c.png?alt=media&#x26;token=0db4ed64-6b75-40d8-a8dd-3b4172a6187b" alt=""><figcaption></figcaption></figure>

Users can view your app information before they download your app.

### 4. Auth <a href="#id-4-auth" id="id-4-auth"></a>

According to [Razorpay Auth Document](https://razorpay.com/docs/api/#api-authentication), `key_id` and `key_secret` are required with **Basic Auth** authentication.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FNLGjtZRqHbpGImq7gwpE%2Fapp2-5.fd541a82.png?alt=media&#x26;token=5e94a5b1-4d0e-4471-ad36-d9770e42091b" alt=""><figcaption></figcaption></figure>

In the **Auth** section, select **Api Key** as **Auth Type** and click **Edit** to add the 2 auth inputs.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F92zPFylnXG8Ygdo8r8Cb%2Fapp2-6.3742cf9d.png?alt=media&#x26;token=a8045641-0527-4b09-9500-e49bfdcf9e4c" alt=""><figcaption></figcaption></figure>

Click on **Save** when you finish adding `key_id` and `key_secret`:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FK2GIPeYUYgnc6aDaewDz%2Fapp2-7.4ef231d4.png?alt=media&#x26;token=afe3df4c-7e7e-455a-b44a-83099914b020" alt=""><figcaption></figcaption></figure>

### 5. Actions - Inputs <a href="#id-5-actions-inputs" id="id-5-actions-inputs"></a>

Now we have set up the authentication part of your app, let's add actions!

API used: [Create payment link](https://razorpay.com/docs/api/payments/payment-links/#create-payment-link).

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FJ4pXwOSWQBs7qPTlRPcO%2Fapp2-11.1056a42f.png?alt=media&#x26;token=9004ae35-7296-4a48-95b8-2102852bea86" alt=""><figcaption></figcaption></figure>

Follow steps 1 to 6 in the above screenshot to create the action and start editing it.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fwr4Oyw1FDFN8MzqvVEe7%2Fapp2-12.755aa2cb.png?alt=media&#x26;token=132f8287-8b81-485a-b5cd-29abdef2e0cc" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FK9AWC8aDYohDapCIV64p%2Fapp2-13.67b8f483.png?alt=media&#x26;token=9cb0b3cc-2f45-4f43-bc03-1165dbf828b4" alt=""><figcaption></figcaption></figure>

Have your documentation and Rapidbott side by side, and copy and paste information accordingly.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FD8bzV6vsC2H0on0UX5Cu%2Fapp2-14.1c186281.png?alt=media&#x26;token=79bd26a8-8230-4054-83b1-5b6cf9717467" alt=""><figcaption></figcaption></figure>

For optional parameters, de-select the **Required?** toggle and provide a default value if you need to.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FMVBykL6YhhEMQ37fw3of%2Fapp2-15.2e5fbe21.png?alt=media&#x26;token=232cdbf3-5b99-4756-af68-8c722e4b39fc" alt=""><figcaption></figcaption></figure>

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.

{% hint style="danger" %}
Note

Always remember to click on **Save** instead of cancel before you exit the action editing.
{% endhint %}

After editing the action information and inputs, create a subflow to run when users call this action:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FXoKcFZ6zJKVuIGLt9soE%2Fapp2-17.f30ff680.png?alt=media&#x26;token=381987f0-94b3-421d-b631-bfafa12f4201" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FHiyu6X1DZ0SAXTDVrc39%2Fapp2-18.2e2dbdec.png?alt=media&#x26;token=24e74d4f-5d62-47f9-9f6f-1f62399c8ecf" alt=""><figcaption></figcaption></figure>

### 6. Flows <a href="#id-6-flows" id="id-6-flows"></a>

Go to the **Flows** section and enter the subflow we just created:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FC9we2aSTWNW4n9LbAXR6%2Fapp2-65.65662652.png?alt=media&#x26;token=2e86ca7b-8850-4108-8ff7-630c463a02b0" alt=""><figcaption></figcaption></figure>

In the case of creating a payment link, one external request should be enough:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FBNAqHz0d3EjYStou2Zg5%2Fapp2-19.da4fc370.png?alt=media&#x26;token=ec587695-7cec-4dd7-bae9-d5ad0e322a96" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F80UdhLWWcH1ujlR53rWE%2Fapp2-20.5db8e9ab.png?alt=media&#x26;token=4e58964c-8ebe-4ecc-96de-95644b8cb44a" alt=""><figcaption></figcaption></figure>

Select `POST` type, paste the URL, select `Body` - `raw` - `JSON` and then copy the 2 parameters, amount and currency.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FQozg67mjeb43yl0Ixnt9%2FUntitled.png?alt=media&#x26;token=81de9190-600d-447c-be62-da4dd95a7481" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Ff8iYYqi0McScnkG2ivo6%2FUntitled.png?alt=media&#x26;token=99ca8d42-0aff-40d1-b159-6bcd2c7dac0a" alt=""><figcaption></figcaption></figure>

When you insert app fields, the "Test body content" shows. It's to specify testing values for the fields. **Without test value, the testing can fail**. Let's set the amount to `1000` and the currency to `INR`:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FIBouv7bZaRaib2uLUGuP%2FUntitled.png?alt=media&#x26;token=e5928ea1-eb0a-4d4f-8992-226809412cfc" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
TIP

When you use `{{` to call a field, make sure there is no character like `"` right behind it. See the screenshot below.
{% endhint %}

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F414db90Yvkb7z1NNk3ed%2Fapp2-24.d2d73af7.png?alt=media&#x26;token=ac8605ad-bc46-40bc-8914-45e519330972" alt=""><figcaption></figcaption></figure>

For authentication, we've mentioned Razorpay API is using **Basic Auth**:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FfdyHXVWeRDHf4fi1EBRo%2Fapp2-25.8bda55ae.png?alt=media&#x26;token=90083601-a0ca-44b7-9639-6c1b62d95bdc" alt=""><figcaption></figcaption></figure>

Select **Basic Auth**, fill in app fields and do remember to put your test `key_id` and test `key_secret`.

Seems all good now, hit the **Test** button:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F0XyPsoqX5mkhSAEGyETa%2Fapp2-26.6ee695a6.png?alt=media&#x26;token=7efc0b1f-66e1-410e-bca7-13e9bf86730f" alt=""><figcaption></figcaption></figure>

Follow steps 1 to 8 to save your testing result to app fields and click **Save**.

Excellent! The request is completed and we've got the `payment_link_id` and `payment_link` that we need from the response data.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FqRvgK5ZPFx4tKqjxi6SW%2Fapp2-27.cfdcbf21.png?alt=media&#x26;token=7c5ed56b-faa7-4829-ab84-7a8c09662185" alt=""><figcaption></figcaption></figure>

`payment_link_id` is an ID to track a payment link and `payment_link` stores the link itself.

Try visiting the payment link:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F45ePf0hkxQ6DS7qqqdg1%2Fapp2-29.1ae62a74.png?alt=media&#x26;token=d2ee18ed-2c6b-4d8a-a425-a7d1c02694c1" alt=""><figcaption></figcaption></figure>

Perfect! Now how do we return the payment link and the ID to the chatbot? Don't forget that we haven't set up the **Action Outputs** yet!

Save and publish your subflow, then let's get back to the **Actions** section:

### 7. Actions - Outputs <a href="#id-7-actions-outputs" id="id-7-actions-outputs"></a>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fv5TlULKkkdTYIVxXMrf9%2Fapp2-28.7cfac0b1.png?alt=media&#x26;token=4a88b2eb-8d1e-4852-aadc-3d40417cb03c" alt=""><figcaption></figcaption></figure>

Add the 2 outputs and click on 2 **Save** buttons to save not only the output editing, but also the action editing.

### 8. Testing <a href="#id-8-testing" id="id-8-testing"></a>

On your dashboard, follow the screenshots below to install your app in the draft version since it hasn't been published yet:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FvDyP5qja4483My7MXSS2%2Fapp2-66.949313c6.png?alt=media&#x26;token=fe8b32a1-34f8-4a32-aa44-cab8e6fd9604" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FVzOiOSvcjpkgZmQu7rb8%2Fapp2-67.54432319.png?alt=media&#x26;token=1e2319b7-2e31-4205-afc4-13d2abd9e1ba" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FPnHX7jAr2hwDfc4RjgaU%2Fapp2-68.6753cd58.png?alt=media&#x26;token=e84e0973-0c83-464b-b39b-ff5344ea6844" alt=""><figcaption></figcaption></figure>

Fill in your credentials and save:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FSmdMr7QAyc3gvKgQJyp9%2FUntitled.png?alt=media&#x26;token=e4ffd8c8-9fe2-40ba-93cf-ba5af3f85c52" alt=""><figcaption></figcaption></figure>

Update your credentials here if you need to:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FX4bp9DRjdWCI16XTLQj5%2Fapp2-70.200e9460.png?alt=media&#x26;token=26cb186e-7c41-47fb-af01-b370c921e0a9" alt=""><figcaption></figcaption></figure>

Pick any one of your chatbots, e.g. Facebook chatbot:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FkwrNeKvQj69xViuHL3aX%2FRapidbott%20Support%20Razor%20Pay%20Mini%20App.png?alt=media&#x26;token=094339c3-936d-42c5-9050-69f242c045ce" alt=""><figcaption></figcaption></figure>

Create an **Action Step**, go to **Integrations**, then select your app action.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FpP8zTLKKcjDvJtGI2MzO%2FUntitled.png?alt=media&#x26;token=ccab77a9-bed0-4022-b53f-cb1c193ff4d0" alt=""><figcaption></figcaption></figure>

Fill in inputs, setup outputs and click **Save**:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F2SoJs4AHdHY2gJwgwSyW%2Fapp2-74.90906203.png?alt=media&#x26;token=3c2a1f62-b2bc-4896-82c5-4ac33ead7469" alt=""><figcaption></figcaption></figure>

Add 2 more **Send Message Steps** to handle 2 different situations:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FwI6pFKT0QuTHMDSLJaay%2FRapidbott%20Support%20Razor%20Pay%20Mini%20App%201.png?alt=media&#x26;token=a962269d-2842-48e9-bf87-3245359ffc1d" alt=""><figcaption></figcaption></figure>

Print out the result and also put the payment link on an URL button.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FF1FeayRxGs6edmURYhSI%2Fapp2-76.58aaefde.png?alt=media&#x26;token=055f69fe-5e9a-4f53-b1a2-dd597b8ef409" alt=""><figcaption></figcaption></figure>

Preview from the **Action Step**, and you will see this message sent to your Messenger:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F2PJGjuPtGdaWQaTZ7lqC%2FUntitled.png?alt=media&#x26;token=23ef82e9-0f93-4199-85f8-e422169f983a" alt=""><figcaption></figcaption></figure>

Click on the **Pay** button and you should see the Razorpay payment page shows a US$99.99 payment:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fra6shKHl0grS2STZNoIV%2Fapp2-78.bc4cae3f.png?alt=media&#x26;token=6f61c7c0-4153-4047-b85c-ace56cc72308" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
what if the message is not received?

You might fail to receive this message because some payment links can be blocked by Facebook automatically. You might want to choose some URL shortening services like Bitly, etc. (Bitly app is available in the Rapidbott app store)
{% endhint %}

In the case the message isn't received on the Facebook side, please check it in **Live Chat**:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fop64S4N0dZ0ZWDI4GOfe%2FRapidbott%20Support%20Razor%20Pay%20Mini%20App%202.png?alt=media&#x26;token=2d11617b-61da-45d5-bae2-3f8438c7dd9b" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
TIP

When a message is displayed in **Live Chat** conversation, it means the system has sent it out.
{% endhint %}

The action seems working just fine!

### 9. One Time Urls <a href="#id-9-one-time-urls" id="id-9-one-time-urls"></a>

Your app is almost there! Wait, the payment is done on Razorpay's website, how do I know was the payment paid or failed? Well, payment providers usually provide a parameter called **Callback URL**:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F9ltZsZ8i2FH3PTaomQ9k%2Fapp2-30.ffba87c7.png?alt=media&#x26;token=fb036f99-2c75-459d-9d20-6bd460fde741" alt=""><figcaption></figcaption></figure>

According to the documentation, `callback_url` is where Razorpay sends back the payment result. So that means, we need to give Razorpay a `callback_url`, telling them where to send the information back.

A One Time Url can be used as a **Callback URL** here.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fiqz6vbAVgf95LK4trGBz%2Fapp2-31.6258112c.png?alt=media&#x26;token=7261e5d5-fc22-4eb1-989f-ca9536eef864" alt=""><figcaption></figcaption></figure>

Follow steps 1 to 5 in the above screenshot to create and edit the One Time Url.

Let's open up another webpage of the app before you enter the one-time URL editing page.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FUCIhZWKIHlaSzBUj1aP4%2Fapp2-80.ea988ec0.png?alt=media&#x26;token=b170aa7d-cd3a-4d27-b552-85aad69e4810" alt=""><figcaption></figcaption></figure>

Goto your "Create Payment Link" action on Page2 and add up the 2 parameters to the body section:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FpnHKgvryDfcBD5CGNEyx%2Fapp2-32.e2f62a47.png?alt=media&#x26;token=9e9a27f5-b3e2-403a-8bcb-7a7d0e0476f5" alt=""><figcaption></figcaption></figure>

Listen to payload for a live test. Please note that the test URL need to be pasted in "Test body contents" instead of "Body content":

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FjHFCnWmLazapT17MQlOc%2FRAPID%20RAZOR(1).png?alt=media&#x26;token=102e6406-678c-498d-837a-20ec3f0d6d22" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FVWAwMlxqzYTLDVRlYssU%2FRapid%20Razor%201.png?alt=media&#x26;token=b589ba02-9e0e-4e41-8c3c-fc25ab587c8f" alt=""><figcaption></figcaption></figure>

When you finish, click on **Test** and you will get a payment link as you have seen before. Visit the payment link and make a test payment:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fg3Ody2D1vADyrlMM0gPZ%2FRapid%20Razor%202.png?alt=media&#x26;token=547ce61c-8ce6-4cde-bb0a-8fa179eec8c7" alt=""><figcaption></figcaption></figure>

Use a [test card](https://razorpay.com/docs/payments/payments/test-card-upi-details/) to simulate the payment process.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FR6FUz3Kq9DVvyZFwe9T5%2Fapp2-36.c73e967d.png?alt=media&#x26;token=fc3e09c9-bbbd-4d34-b5ba-b939bd132327" alt=""><figcaption></figcaption></figure>

Give **random OTP** code and **Submit**.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F0rbq9NBZNpBrSKLqO84R%2FRapid%20Razor%203.png?alt=media&#x26;token=0f0d4079-b4f3-49b7-9a5e-486750e47a13" alt=""><figcaption></figcaption></figure>

Finally, click on **Done** and you will see the data we need when a real payment is paid:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FrsBDOjxeMje2LP7G3NkM%2Fapp2-38.42b0a1ef.png?alt=media&#x26;token=8fdc5109-680c-47dc-9417-fdc6f72bca53" alt=""><figcaption></figcaption></figure>

We've now finished the first section, parameters, in a "One Time Url".

**Web Forms** is to collect extra information via a web form, which is not a must for the case. Let's go direct to design our **Web Page**:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fm90v887neDb2mMwuuuts%2Fapp2-81.806f341a.png?alt=media&#x26;token=dc6ff8d7-d2ae-47b7-a6b7-95567044dec3" alt=""><figcaption></figcaption></figure>

Look nice. At the bottom, give an expiration interval for the one-time URL. By default, the link expires in 10 minutes. The final step for **One Time Url** is to specify a subflow to run when this page is opened by users:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FNwN1GiaxXYo08Wfwofb1%2Fapp2-82.e989be8f.png?alt=media&#x26;token=dd3a8573-dde7-461a-96d9-e464061da839" alt=""><figcaption></figcaption></figure>

Don't forget to click **Save** in the upper-right corner and the one-time URL is done:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FXK1IAvvJrIHGPcWUMyIV%2Fapp2-83.8c8340be.png?alt=media&#x26;token=5c8c7b29-9b39-4b87-bf66-89b639161068" alt=""><figcaption></figcaption></figure>

After setting up the one-time URL, let's add it to the **Create Payment Link** action:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FPwpSLfzRaDaazgj4hHxM%2Fapp2-93.c104585f.png?alt=media&#x26;token=100a1ba1-d4bd-4069-9ef9-49614559472c" alt=""><figcaption></figcaption></figure>

In the **Create Payment Link** subflow, add a **Get One Time Url** action before the external request (click and drag to move).

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FBXKy4XktCLSkDJkJD1pf%2FUntitled.png?alt=media&#x26;token=697897e4-d4f5-4a7b-90bc-1d032b84bb0d" alt=""><figcaption></figcaption></figure>

Save the new generated URL to an app field, then edit the external request to insert the field:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F0BvXVPHPqCJ5sQFR9cNf%2Fapp.rapidbott.png?alt=media&#x26;token=4fb19192-f0a7-4d02-82c2-0749a72148cc" alt=""><figcaption></figcaption></figure>

Save the editing and publish the subflow.

### 10. Triggers <a href="#id-10-triggers" id="id-10-triggers"></a>

The app now can receive payment results from Razorpay, let's send the result back to the chatbot via a trigger.

![mini-app2](https://docs.uchat.com.au/assets/img/app2-85.54ab8cac.png)

Follow steps 1 to 6 in the above screenshot to create a trigger and start editing it:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F7sQ4ku1kdzZkX8DUWxOG%2Fapp2-86.5f803a0d.png?alt=media&#x26;token=a8483117-9759-4818-9563-d07cc0c16ffc" alt=""><figcaption></figcaption></figure>

Here is where you specify what data to send back to the chatbot, in this case, we send both `payment_status` and the whole `payment_result` JSON.

![mini-app2](https://docs.uchat.com.au/assets/img/app2-87.96a63955.png)

After that, we can fire the trigger in the subflow which the one-time URL runs when payment is received:

![mini-app2](https://docs.uchat.com.au/assets/img/app2-84.4db0bfa2.png)

### 11. Testing <a href="#id-11-testing" id="id-11-testing"></a>

{% hint style="info" %}
TIP

Since your app is still in the draft version, any changes made to the app will be updated to all installed apps as well. Simply refresh the webpage to get the most updated version of the app.
{% endhint %}

Nothing to edit in the previous chatbot flow but the trigger needs to be set up in **Automation** before you test the payment process again:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FkD7ZPb2t1twRb9r2JG3N%2FRapidbott%20Basics.png?alt=media&#x26;token=157e6d6b-7b05-4cd9-b8de-dd7ce09b9723" alt=""><figcaption></figcaption></figure>

Follow steps 1 to 4 in the above screenshot to add the trigger and name 2 custom fields to save the data in the chatbot:

![mini-app2](https://docs.uchat.com.au/assets/img/app2-90.32a25d57.png)

Create a new subflow for this trigger. The subflow will be run once the chatbot received the data from the app:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FdzPXkaxtyXEVEYL6f2Yk%2FRapidbott%20Support%20Razor%20Pay.png?alt=media&#x26;token=da468fb9-abf8-4527-9c90-cdb70d300fc0" alt=""><figcaption></figcaption></figure>

In the subflow, simply print out the data we received:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FRUsZAjP7mCsvXanZs457%2FRapidbott%20Support%20Razor%20Pay%202.png?alt=media&#x26;token=e17ecabb-cd98-4244-9169-7c39332d9c0a" alt=""><figcaption></figcaption></figure>

All good now, let's publish the subflow and get back to the previous subflow to preview from the **Action Step** again:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F3WeBjwF2g4bbuBLj7sKO%2FUntitled.png?alt=media&#x26;token=6c275c21-42ea-44d6-940a-a796fa9e4044" alt=""><figcaption></figcaption></figure>

Another link received, click **Pay** and use the test card again to process the payment:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FZ1KzEjyBWFy71HwxVdIh%2Fapp2-89.d737ce01.png?alt=media&#x26;token=d444ac8c-5dd7-47b9-81db-a91546fd5da6" alt=""><figcaption></figcaption></figure>

The designed webpage shows as expected:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2F9nNbVu7Q4gJy8CsP96HN%2FUntitled.png?alt=media&#x26;token=2366b29b-61fc-4d56-a278-e2e6266b2ad8" alt=""><figcaption></figcaption></figure>

Ding! A message was received in Messenger as well:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fl5Ehhy3iPCosmGyzT332%2Fapp2-97.3de049a0.png?alt=media&#x26;token=6303182b-feda-4cfc-ac78-240f25bc73bf" alt=""><figcaption></figcaption></figure>

**🚀 Congrats!! You made your first app! 😍**
