Skip to main content
Before creating your first Checkout Session with Razorpay, you need a connected Razorpay account and the correct webhook events enabled in your Razorpay dashboard.

Step 1: Connect Razorpay

Follow the Razorpay Connection Setup guide to add your API keys and webhook secret. Come back here once the connection is active.

Step 2: Enable the required webhook events

Go to your Razorpay Dashboard: Settings → Webhooks → [your Flexprice endpoint] and enable all five events:
EventRequired for
payment.capturedPayment reconciliation
payment.failedPayment failure handling
payment_link.paidActivating the subscription when payment completes
payment_link.cancelledCleaning up when a customer cancels the payment link
payment_link.expiredCleaning up when the payment link expires
If payment_link.paid is not enabled, Flexprice will never receive payment confirmation and the subscription will stay inactive. Verify all five events are enabled before testing.

Webhook URL

Your Flexprice webhook URL follows this format:
https://api.cloud.flexprice.io/v1/webhooks/razorpay/<TENANT_ID>/<ENVIRONMENT_ID>
Find your TENANT_ID and ENVIRONMENT_ID in Settings → General.

Step 3: Verify the webhook secret

Flexprice validates the signature on every inbound Razorpay webhook. If the secret doesn’t match, events are rejected silently. Go to Settings → Connections → Razorpay in Flexprice and confirm the webhook secret matches what’s shown in your Razorpay dashboard for that endpoint.

Step 4: Test the flow

Use Razorpay test mode before going live. Test cards:
NetworkCard numberCVVExpiry
Visa4386 2894 0766 0153Any 3 digitsAny future date
Mastercard2305 3242 5784 8228Any 3 digitsAny future date
Test UPI:
UPI IDSimulates
success@razorpaySuccessful payment
failure@razorpayFailed payment
After a test payment, confirm:
  • Session status is completed
  • Subscription status is active
  • Invoice status is finalized
  • Your server received the checkout.session.completed event
If the session stays pending after payment, check the Razorpay webhook delivery log and confirm all five events are enabled on the correct endpoint URL.

Troubleshooting

SymptomLikely causeFix
Session stays pending after paymentpayment_link.paid not enabledAdd it in Razorpay Dashboard → Webhooks
Session fails immediately on creationRazorpay connection inactiveCheck status in Settings → Connections
Webhook secret mismatch errorSecret out of syncRe-copy the secret from Razorpay into Flexprice
Subscription stays inactive after paymentWrong tenant or environment ID in webhook URLVerify the URL in Razorpay matches the format above

Razorpay Connection Setup

Connect your Razorpay account to Flexprice.

Checkout Sessions API

Create your first session once Razorpay is configured.