Tenant Onboarding — Razorpay
Audience: Hotel operators / tenant admins who want to enable online guest payments through KeyNova. Time required: ~15 minutes. Prerequisites: You are a KeyNova user with role
ADMINorSUPER_ADMIN, and you have (or are ready to create) a Razorpay account.
This guide walks through the self-serve flow for connecting a Razorpay merchant account to KeyNova. Once complete, guest payments from your booking engine, folio settlements, and payment links will route through your own Razorpay account — KeyNova never takes custody of the funds (Direct merchant model).
Settlements from Razorpay land in the bank account you registered with Razorpay, not in a KeyNova-controlled account. KeyNova orchestrates the payment and owns the ledger, audit, and reconciliation logic; it does not touch the money. PCI DSS scope stays contained — KeyNova is SAQ-A and never stores raw card data.
Step 1 — Create (or sign in to) a Razorpay account
- Go to https://dashboard.razorpay.com.
- Sign up (new) or sign in (existing).
- Complete KYC — PAN, GSTIN, bank account, and business proof documents. Razorpay typically approves within 2–4 business days.
- Once live, switch the dashboard toggle (top-right) to Live Mode. If you are onboarding a sandbox / staging KeyNova environment, leave it on Test Mode.
Razorpay keys are prefixed by mode. Test keys start with rzp_test_ and live
keys start with rzp_live_. KeyNova validates the prefix against the mode
you select and refuses mismatches.
Step 2 — Generate API keys in Razorpay
- In the Razorpay dashboard, open Account & Settings → API Keys.
- Click Generate Key (Live Mode).
- Razorpay shows you Key Id and Key Secret exactly once. Copy both to a password manager immediately — the secret cannot be retrieved later.
- If you lose the secret, regenerate the key; you will update KeyNova via Rotate credentials in Step 7.
You now have:
key_id, e.g.rzp_live_AbCdEfGhIj1234key_secret, e.g.4Jg9PxQZ...(32–40 chars)
Step 3 — Open KeyNova's Payment Providers settings
- Sign in to the KeyNova dashboard:
https://<your-tenant>.keynovahotels.com. - In the left navigation, open Settings.
- Click Payment Providers.
You see a list of connected accounts (empty on a fresh tenant) and an Add Merchant Account button.
Step 4 — Add a merchant account in KeyNova
-
Click Add Merchant Account.
-
Fill in the form:
Field Value Provider Razorpay Scope All properties (tenant-wide default) or Specific property (franchise / multi-entity) Property — (if Scope = Specific property, pick one) Mode Live (or Sandbox if this is a staging environment) Display name e.g. "Razorpay — Main" Key ID paste the key_idfrom Step 2Key Secret paste the key_secretfrom Step 2 -
Click Validate & Save. KeyNova calls
GET /v1/payments?count=1against Razorpay to prove the keys work. On failure you see the specific Razorpay error (e.g.Invalid API key). -
KeyNova stores the credentials envelope-encrypted (AES-256-GCM under a per-row DEK wrapped by AWS KMS — see Modular Payments Architecture §5).
-
On success, KeyNova displays the Webhook URL for this account:
https://api.<your-env>.keynovahotels.com/api/webhooks/razorpay-gateway/<merchant_account_id>Copy it — you need it in the next step.
You can hold only one active account per (tenant, property, provider).
Adding a second active account for the same scope returns
409 DUPLICATE_ACTIVE_ACCOUNT. Deactivate the old one first, or use a
different property scope.
Step 5 — Register the webhook URL in Razorpay
-
Back in the Razorpay dashboard, open Account & Settings → Webhooks.
-
Click + Add New Webhook.
-
Paste the Webhook URL from Step 4.
-
Choose a Secret — 32+ random characters. Razorpay uses this to HMAC the webhook body; KeyNova uses it to verify. Keep this value handy for the next step.
-
Under Alert Email, enter the inbox that should receive Razorpay-side webhook delivery failures (operator, not developer).
-
Under Active Events, enable the exact set KeyNova consumes:
payment.authorizedpayment.capturedpayment.failedrefund.processedrefund.failedorder.paid
Do not enable anything else — KeyNova ignores extra events, but more events means more noise in the
WebhookEventaudit log. -
Click Create Webhook.
Step 6 — Paste the webhook secret back into KeyNova
-
Return to KeyNova Settings → Payment Providers and open the account you just created.
-
Click Add Webhook Secret.
-
Paste the secret you set in Step 5.
-
Click Save.
-
Click Send Test Webhook. KeyNova triggers Razorpay's built-in test webhook feature and waits for round-trip delivery. You see:
- ✅ Test successful —
isActiveflips to true; you're live. - ❌ Signature mismatch — the secret doesn't match. Rotate the secret in Razorpay and re-paste in KeyNova.
- ❌ Timeout — the webhook URL isn't reachable. Check the URL is exactly what KeyNova provided (no trailing slash, correct environment).
- ✅ Test successful —
Once the test passes, the account card shows a green Active badge. Your tenant is now accepting online payments via your Razorpay account.
Step 7 — Rotating credentials later
You need to rotate keys if:
- A staff member who knew the secret leaves the organization.
- Razorpay shows a suspicious login or rotates your keys.
- You are doing routine rotation (recommended every 12 months).
- Generate a new key pair in Razorpay (Step 2).
- In KeyNova, open the account and click Rotate credentials.
- Paste the new
key_idandkey_secret. KeyNova validates against Razorpay atomically — if validation fails, the old keys remain active. - Click Save. Rotation is instant — there is no dual-key grace period.
- If you also rotated the webhook secret in Razorpay, paste the new secret via Rotate webhook secret.
Every rotation writes an AuditLog entry visible at
Settings → Audit Log filtered by merchant_account.rotated. The entry
records:
- Who rotated (user id + role).
- When (timestamp + IP address).
- Key prefix before/after (e.g.
rzp_live_AbCd • • → rzp_live_XyZw • •). - KMS key version used to encrypt.
The full secret is never logged — only the 6-character prefix, matching the platform-wide Pino redactor.
Troubleshooting
"Credentials validation failed — Invalid API key"
- You copied the key from Test Mode but selected Live in KeyNova (or vice versa). Re-check the Razorpay mode toggle.
- The key was revoked in Razorpay. Generate a new pair.
- Extra whitespace around the pasted secret. Re-copy cleanly.
"Test webhook — signature mismatch"
- The secret in KeyNova doesn't match the one in Razorpay. Most commonly caused by a trailing newline when pasting. Rotate the secret in Razorpay and paste again, being careful not to include surrounding whitespace.
- The webhook URL has an extra path segment (e.g. trailing
/) and Razorpay is delivering to a 404. Confirm the URL is byte-exact.
"Test webhook — timeout"
- The wrong environment's URL was used. Staging URL pasted into Live Razorpay, or vice versa.
- KeyNova api-gateway is down. Check status page.
- Razorpay IPs are not reaching our ingress. If you are on a self-hosted KeyNova deployment, verify ingress whitelisting.
"Payments initiated but stuck in PENDING_USER_ACTION"
See the operator troubleshooting appendix in Modular Payments Architecture §8. Most common cause: guest abandoned checkout — no action needed, the nightly reconciler will expire the attempt after 2 hours.
"Account deactivated unexpectedly"
KeyNova auto-deactivates accounts after repeated ProviderAuthErrors (keys
were rotated on the Razorpay side without a matching KeyNova rotation). Fix
the upstream issue, then Rotate credentials — a successful validation
re-activates the account.
"I need to move from Sandbox to Live"
Mode is immutable after a successful payment — this is intentional, to
prevent historical reinterpretation of test vs real money. Create a new
LIVE account with your live keys, and then deactivate the sandbox account.
What happens next
Once your account is active:
- Booking engine deposits route through it automatically for all new
bookings (after the
PAYMENTS_V2_BOOKING_ENGINEfeature flag flips for your tenant — Phase 1 of the migration plan). - Folio settlement can be collected online via Send Payment Link from the folio detail page.
- Refunds are triggered from the reservation, folio, or payment-link detail pages and route automatically to the provider+account of the original attempt.
- Metrics appear in Grafana under KeyNova Payments. The alert set
is documented in the oncall runbooks under
hmp-infrastructure/monitoring/runbooks/.
See also
- Modular Payments Architecture
- Payments API Reference
- Oncall runbooks (live in the
hmp-infrastructurerepo):hmp-infrastructure/monitoring/runbooks/payments-provider-down.mdhmp-infrastructure/monitoring/runbooks/webhook-signature-failures.md