Razorpay integration
Razorpay is a popular payment gateway in India. Follow these steps to connect your Razorpay account to your community.
Prerequisites
Section titled “Prerequisites”- A verified Razorpay Account.
- Live Mode enabled for receiving real payments.
Step 1: Get API Keys
Section titled “Step 1: Get API Keys”You need to generate API keys to authenticate your application.
- Log in to your Razorpay Dashboard.
- Toggle the mode to Live Mode for production.
- Navigate to Settings > API Keys.
- Click on Generate Key (or Regenerate Key if you lost the old one).
- You will see a Key ID and a Key Secret.
- Key ID: Copy this and paste it into the API Key field in your settings.
- Key Secret: Copy this and paste it into the API Secret field in your settings.
Step 2: Configure Webhooks
Section titled “Step 2: Configure Webhooks”Webhooks allow us to receive real-time notifications about payments.
- In the Razorpay Dashboard, go to Settings > Webhooks.
- Click + Add New Webhook.
- Webhook URL: You will find two URLs in your settings page:
- Subscription URL: Use this for subscription-related events.
- One-time URL: Use this for one-time payment events.
- Note: You may need to create two separate webhooks if you use both.
- Secret: Create a strong secret password.
- Paste this secret into the Webhook Secret field in your settings.
- Enter the same secret in the Razorpay Webhook setup form.
- Active Events: Select the following events:
payment.capturedpayment.failedsubscription.chargedsubscription.haltedsubscription.cancelledorder.paid
- Click Create Webhook.
Troubleshooting
Section titled “Troubleshooting”Signature Verification Failed
Section titled “Signature Verification Failed”If you encounter a “Signature Verification Failed” error:
- Ensure the Webhook Secret in your Razorpay dashboard matches the one in your application settings exactly.
- Check if you are using the correct keys (Test vs Live) for the mode you are testing in.