Connect Razorpay to B6AI
Set up the Razorpay integration end to end, from creating credentials in Razorpay to verifying the live connection and using it in your bots.
Overview
The Razorpay integration lets bots collect payments inside a conversation, create a payment link or order, then confirm the payment automatically via webhook.
It’s ideal for taking bookings, deposits and one-off charges without sending the customer to a separate flow.
What you can do with Razorpay
Once connected, your bots and agents can use Razorpay inside conversations and automations. Typical uses include:
- Create an order or payment link and share it in chat.
- Confirm payment status in real time via webhooks.
- Read a payment’s history and status on request.
- Issue refunds from a conversation (where enabled for your account).
How the integration works
B6AI calls the Razorpay API using your Key ID and Key Secret (Basic auth), and verifies incoming events with a webhook secret (HMAC signature) so it can trust payment confirmations.
Always build and test with test-mode keys first, then switch to live keys once you’re confident.
Prerequisites
Make sure all of the following are in place before you start. Each one is required, skipping any will cause the connection to fail later.
- A Razorpay account (test mode works immediately; live mode requires KYC activation).
- Permission to generate API keys and add webhooks.
- The Enterprise Admin role in B6AI.
Create or prepare your Razorpay account
If your organization does not already use Razorpay, create an account first. Existing customers can skip to the next step.
- Sign up at razorpay.com.
- For live payments, complete KYC activation. Test mode is available right away.
Choose a connection method
B6AI supports more than one way to connect Razorpay. Pick the one that fits your organization’s policies, the rest of this guide works for either.
| Method | When to use it | Notes |
|---|---|---|
| Test keys | Building and verifying safely | Keys start with rzp_test_… and never move real money. |
| Live keys | Production payments | Keys start with rzp_live_… and require KYC activation. |
Generate your Razorpay API keys (Key ID & Key Secret)
B6AI authenticates with Razorpay using your Razorpay API keys (Key ID & Key Secret). Follow these steps exactly, each field you copy here is entered into B6AI later.
- In the Razorpay Dashboard, choose Test or Live mode using the toggle at the top.
- Open Account & Settings → API Keys → Generate Key.
- Copy the Key ID (rzp_test_… or rzp_live_…) and the Key Secret, the secret is shown only once.
- Open Settings → Webhooks → Add New Webhook, set the URL to the value B6AI shows during connection, select the events below, and copy the webhook secret.
Required permissions & scopes
Grant only the scopes below. Each one maps to a specific B6AI capability; requesting fewer reduces risk and speeds up any review your Razorpay administrator performs. The table explains exactly what each scope allows and why it is needed.
| Scope / permission | What it allows | Why B6AI needs it |
|---|---|---|
| Key ID + Key Secret | Authenticate all API calls | Create orders/links and read payment status |
| Webhook: payment.captured, order.paid | Receive payment confirmations | Confirm a payment automatically in the conversation |
| Webhook: refund.processed | Receive refund events | Confirm refunds you initiate from chat |
Finish configuration inside Razorpay
Complete these steps in the Razorpay console before connecting B6AI, so the credentials are fully active.
- Enable the webhook and select at least payment.captured and order.paid.
- Switch from test to live keys (and update the webhook) only when you’re ready for real payments.
Connect Razorpay in B6AI
Now enter your credentials in B6AI. Signed in as an Enterprise Admin, open Settings → Integrations, find the Razorpay card and click Connect, then complete the form. Every field is explained below.
- In B6AI, open Settings → Integrations → Razorpay.
- Choose test or live mode to match your keys.
- Paste the Key ID, Key Secret and webhook secret.
- Click Save: B6AI creates a test order to validate the keys.
{
"provider": "razorpay",
"key_id": "rzp_test_…",
"key_secret": "…",
"webhook_secret": "…",
"mode": "test",
"currency": "INR"
}| Field | What it is | Example value |
|---|---|---|
| Key ID | Your public API key | rzp_test_1A2b3C… |
| Key Secret | Your secret API key | 9zYx… |
| Webhook secret | Verifies event signatures | whsec_… |
| Mode | test or live (must match the keys) | test |
| Currency | Default order currency | INR |
Verify the connection
Confirm the integration is live before you rely on it in a bot.
- Confirm the Razorpay card shows “Connected”.
- Run the test: it creates a test order.
- Complete a payment using Razorpay’s test cards and confirm the webhook marks the order paid.
Troubleshooting
If the connection fails or an action does not work, match the symptom below to its cause and fix.
| Symptom / error | Likely cause | How to fix it |
|---|---|---|
| authentication error (BAD_REQUEST_ERROR) | Wrong Key ID/Secret, or mode mismatch | Re-copy the keys; make sure test/live mode matches the keys |
| Signature verification failed | Wrong webhook secret | Re-copy the webhook secret from the dashboard |
| Payment not captured | Auto-capture is off | Enable auto-capture, or capture the payment in the flow |
| Refund failed | Insufficient balance or refunds not enabled | Fund the account or enable refunds for your account |
Limitations & rate limits
Keep these constraints in mind so your bots behave predictably at scale.
- Live mode requires completed KYC.
- Refund availability and supported currencies depend on your account.
- API rate limits apply; every event signature is verified before it’s trusted.
Security best practices
- Grant only the scopes and permissions listed above, never request more “just in case”.
- Rotate your Razorpay API keys (Key ID & Key Secret) on a regular schedule, and immediately if you suspect exposure.
- Restrict the Enterprise Admin role (which manages integrations) to a small, trusted group.
- Prefer a dedicated service account or bot user over a personal login, so access survives staff changes.
- Review the integration’s activity in the B6AI Activity Logs periodically for unexpected calls.
- Disconnect the integration the moment a credential leaks; then rotate it in Razorpay before reconnecting.
Recommendations
- Test against a sandbox or non-production Razorpay account before connecting live data.
- Document which bots and flows depend on this integration so changes are predictable.
- Set a recurring reminder to review scopes and rotate credentials.
- Enable only the capabilities you actually use today; you can widen scopes later.