# 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2F8niint5KkCxutEdZqBRV%2Fimage.png?alt=media&#x26;token=54f91b68-696a-4b29-b943-735bd905c54d" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FTJTIuVQ97J1CPvKdWd7v%2Fimage.png?alt=media&#x26;token=af71b398-bfe6-47cc-b179-01b08fac37a6" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FJvd80Qr0Pp5VS3rQsCy6%2Fimage.png?alt=media&#x26;token=014485e1-c990-4f64-b313-6ac1089e19b9" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2F0mHiQBFuvbrDrynyuLcI%2Fimage.png?alt=media&#x26;token=41f29720-437e-463d-8ca0-e1e109850b82" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FlLY7VSjUUAjn5wEylYev%2Fimage.png?alt=media&#x26;token=ae961815-fe61-4b94-ba6f-62b5dd701929" alt=""><figcaption></figcaption></figure>
5. Copy the **Client ID** and **Client Secret** from this section.<br>

   <figure><img src="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2F0FAoWUjcndD43zC3xikc%2Fimage.png?alt=media&#x26;token=da34cfee-eb6b-4c22-be95-0b400edfada5" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2Ftf6caoYKPCkoabRWdDG5%2Fimage.png?alt=media&#x26;token=38404b75-68af-41b4-ba56-9572d759097c" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2F29BuxWuyNzsCBznht6u0%2Fimage.png?alt=media&#x26;token=a08bc3fc-87e2-4830-af3b-d2e5d891ef1e" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FXWpuioda7Ka0Y8ZF7qGr%2Fimage.png?alt=media&#x26;token=89295012-b3bd-46ba-bc60-cef330edee4e" 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="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FXO0DmQA0yzEJ1hbcQhOv%2Fimage.png?alt=media&#x26;token=f151a3a5-23c4-4617-8c87-d6555774fa2f" alt=""><figcaption></figcaption></figure>

***

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

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

   <figure><img src="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FGbDdHLoBXXRT1prnJ40x%2Fimage.png?alt=media&#x26;token=fde56a10-3fad-4d2f-8375-4f6d86e48bfd" alt=""><figcaption></figcaption></figure>
2. Select the payment chat component.<br>

   <figure><img src="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2F22WCjwtyWFAsqrtCq6RN%2Fimage.png?alt=media&#x26;token=e37ab07c-b8eb-4f19-837b-76acb767a58b" alt=""><figcaption></figcaption></figure>
3. Add Razorpay as the payment gateway from the available options.<br>

   <figure><img src="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FN0DTUYibBUk2WBYo05pc%2Fimage.png?alt=media&#x26;token=ee3a4579-b040-4e67-b171-f43d39ca73d8" 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.
