Connect Razorpay
Get the Key ID, Key secret and a webhook secret from your Razorpay dashboard and connect them in Payment Configuration.
Use this guide to connect the school's own Razorpay merchant account to the School ERP. Razorpay needs three values in the ERP: Key ID, Key secret and Webhook secret. Razorpay's dashboard has separate test and live modes, and each mode has its own keys.
Before you start#
- The school has a Razorpay merchant account. For live payments, Razorpay must have activated it.
- You have the school administrator's login for the School ERP.
- You can sign in to the Razorpay dashboard as the account owner, or as a user with rights to manage API keys and webhooks.
- Read Set up a gateway in Payment Configuration once.
Razorpay's screens change from time to time. If a menu below looks different, follow Razorpay's own documentation for API keys and webhooks.
Get your keys from Razorpay#
- Sign in to the Razorpay dashboard.
- Switch the dashboard to test mode. Start with test keys.
- Open the API keys page in the dashboard's account settings and generate a key.
- Copy the Key ID and the Key secret. Razorpay shows the secret only when the key is generated, so keep it safely until you have pasted it into the ERP.
- Decide a webhook secret: a long random phrase that you make up. You will type the same phrase in Razorpay and in the ERP. It must be different from the Key secret.
- In the payment capture settings, make sure payments are captured automatically. A payment that Razorpay has only authorised, and not captured, is not recorded as paid in the ERP.
Enter them in the School ERP#
- Open General Settings › Payment Configuration.
- Set Environment to Test / sandbox, then select Configure on the Razorpay card.
- Check that Test environment is selected.
- Paste into Key ID, Key secret and Webhook secret.
- Select Save settings.
- Select Test connection. A success message means Razorpay accepted the keys. It does not prove a payment will go through.
Register the webhook in Razorpay#
- In the ERP, select Copy Webhook URL below the form.
- In the Razorpay dashboard (still in test mode), open the webhooks page in settings and add a new webhook.
- Paste the address into the webhook URL box.
- Type the same webhook secret you entered in the ERP.
- Select the payment and refund events. Razorpay's documentation lists them.
- Save the webhook in Razorpay.
Razorpay's checkout returns the parent to the ERP on its own. The ERP also shows a Return URL; if Razorpay ever asks for a return or redirect address, use Copy Return URL and paste that.
Test, then go live#
- Run a test payment. See Test a payment end to end.
- When it works, switch the Razorpay dashboard to live mode and generate live keys.
- In the ERP panel select Live environment, paste the live Key ID and Key secret, and a new webhook secret for live.
- Tick Enable and use this gateway for fee payments, choose the other options, and select Save settings.
- Copy the live Webhook URL and add it as a webhook in Razorpay's live mode, with the live webhook secret.
- Select Test connection again for the live keys.
Good to know#
- Test keys and live keys never work in the other mode. If Test connection fails, check the mode first.
- The ERP confirms every payment with Razorpay before posting a receipt. The webhook makes confirmation quicker; the ERP still checks without it.
- Razorpay settlements are not fetched into the ERP. Record each bank settlement by hand. See Reconciliation and settlements.
- Refund from the ERP, not from the Razorpay dashboard. See Refund an online payment.
Troubleshooting#
| What you see | What to do |
|---|---|
| Test connection fails | Check that the keys are from the same mode as the environment in the ERP, and that no space was copied at either end. |
| Payments stay Awaiting confirmation for long | Check that payments are captured automatically in Razorpay, and that the webhook URL in Razorpay matches the one on the ERP screen. |
| You changed the keys and confirmations slowed down | The Webhook URL changes when keys change. Copy it again and update the webhook in Razorpay. |
