# Integrate BotPenguin with Razorpay

### **Prerequisites**

To successfully integrate Razorpay with BotPenguin, you will need:

* A **BotPenguin** account.
* A **Razorpay** account.
* A **WhatsApp bot**

This integration enables your WhatsApp bot created on BotPenguin to collect payments via Razorpay.

#### **Step 1: Login to BotPenguin and Select WhatsApp Bot**

1. Go to [BotPenguin](https://www.botpenguin.com) and log into your account.
2. Navigate to the dashboard and select the WhatsApp bot you want to integrate Razorpay with.<br>

   <figure><img src="/files/3CLghm4106iWFZ0dr7dj" alt=""><figcaption></figcaption></figure>
3. Ensure that this bot is set up for handling customer interactions.

***

#### **Step 2: Navigate to Third-Party App Integrations**

1. After selecting your WhatsApp bot, locate the **Third-Party App Integrations** option in the bot settings.<br>

   <figure><img src="/files/4aAHRGn2zJWJZoU0vb3A" alt=""><figcaption></figcaption></figure>
2. Click on this section to view available integrations.
3. Search for **Razorpay** in the list.
4. Click on the **Connect** button next to Razorpay.<br>

   <figure><img src="/files/FWlZeiFvL10d4dZbExz8" alt=""><figcaption></figcaption></figure>

***

#### **Step 3: Obtain Razorpay API Keys**

To connect Razorpay with BotPenguin, you need the **Client ID** and **Client Secret** from your Razorpay account.

**Steps to Get API Keys from Razorpay:**

1. Log into your Razorpay account.
2. Use the search bar at the top to search for **API Keys**.<br>

   <figure><img src="/files/l3ALX1gCCqbghoQ5ISdm" alt=""><figcaption></figcaption></figure>
3. You will be redirected to the **API Key Management** page.
4. If no keys are available, click on **Generate New API Key**.<br>

   <figure><img src="/files/FIPkqT878JiNkFzu3kpH" alt=""><figcaption></figcaption></figure>
5. Copy the **Client ID** and **Client Secret** from this section.<br>

   <figure><img src="/files/N01J9X3yZv6xKHzFh1i8" alt=""><figcaption></figcaption></figure>

***

#### **Step 4: Connect Razorpay to BotPenguin**

1. Return to the BotPenguin dashboard.
2. Paste the **Client ID** and **Client Secret** into the Razorpay integration fields.<br>

   <figure><img src="/files/03Cn9PqO4y89G6YT41g3" alt=""><figcaption></figcaption></figure>
3. Save the changes.

***

#### **Step 5: Configure Webhooks for Razorpay**

To ensure that payment events are tracked correctly, you need to configure webhooks in Razorpay.

**Steps to Configure Webhooks:**

1. In your Razorpay account, go to **Account Settings**.
2. Find and click on the **Webhooks** section.<br>

   <figure><img src="/files/VZHMc7FJYmfBjxbC3yPj" alt=""><figcaption></figcaption></figure>
3. Click on **Add Webhook**.
4. Go back to BotPenguin and copy the **Webhook URL** from the integration settings.
5. Paste this URL into the Webhook URL field in Razorpay.<br>

   <figure><img src="/files/cWRw1QHCtrzSOtI371Q7" alt=""><figcaption></figcaption></figure>
6. Scroll down to select the following events:
   * `payment.failed`
   * `payment_link.paid`
   * `payment_link.partially_paid`
   * `payment_link.expired`
   * `payment_link.cancelled`
7. Click **Create Webhook** to save your configuration.<br>

   <figure><img src="/files/lSDH4dNViw2ZK7Nvpe8A" alt=""><figcaption></figcaption></figure>

***

#### **Step 6: Edit Chatbot Conversation Flow**

1. Navigate back to your BotPenguin bot editor.<br>

   <figure><img src="/files/nD9nxmH3pGfaup6x9ow5" alt=""><figcaption></figcaption></figure>
2. Select the payment chat component.<br>

   <figure><img src="/files/iHZVmgu4hc4Sl4VUlC19" alt=""><figcaption></figcaption></figure>
3. Add Razorpay as the payment gateway from the available options.<br>

   <figure><img src="/files/Z3bMY8WzljZXUtH6qfqt" alt=""><figcaption></figcaption></figure>
4. Customize the conversation flow to guide users through the payment process.

***

#### **Conclusion**

Your BotPenguin WhatsApp bot is now successfully integrated with Razorpay. You can collect payments seamlessly and track payment events through the configured webhooks. This integration ensures a smooth payment experience for your users directly through WhatsApp.\
\
If everything is correct and you are still unable to move forward, write to us at <support@botpenguin.com>. We will respond back within 48 business hours.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.botpenguin.com/bots/whatsapp-bot/3rd-party-apps-integrations/botpenguin-integrations/integrate-botpenguin-with-razorpay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
