payment.captured, order.paid, and subscription.activated.
Endpoint path
The webhook handler follows the plugin’s path convention under your Better Auth mount point:Confirm the exact path in your server if requests return
404. You can inspect the plugin’s registered endpoints in your framework’s route logs or by listing Better Auth routes.Headers
Razorpay sends the webhook signature in a request header: The endpoint also relies on standardContent-Type: application/json headers from Razorpay.
Verification
The plugin verifies the signature usingrazorpayWebhookSecret from your plugin options. It computes an HMAC-SHA256 of the raw request body and compares it with the header value using a timing-safe comparison.
Responses and errors
Supported events
The plugin handles the following Razorpay events and routes each to its corresponding callback. All events also invoke the top-levelonEvent handler if you provide one.
Subscription webhooks update the local
subscription table (status, period dates, counts) before your callbacks fire.
See Webhook events for more detail on each event and payload shape.
Local testing
Because Razorpay can only deliver webhooks to a public HTTPS URL, use a tunnel for local development:https://abc123.ngrok.io/api/auth/razorpay/webhook. Choose the events you want to receive and set the same secret you use in razorpayWebhookSecret.