How to handle Ruba webhooks in your app
To handle Ruba webhooks, create an endpoint in the dashboard, keep the raw request body, verify the signature with your signing secret, put the work in a queue and return a 2xx within a couple of seconds. Ruba follows the Standard Webhooks specification, retries failures up to 10 times and pays you to your own bank as your sales grow.
Why webhooks
Ruba signs its webhooks to the Standard Webhooks spec, so your app can check each one. Ahmed in Rawalpindi runs a web app. When a customer pays, his app must unlock the plan. Asking Ruba every minute “did anyone pay?” is slow and wasteful. A webhook flips it: Ruba calls your app the moment something happens.
Here are the delivery rules in plain words.
The receiver, step by step
- ArrivesRaw body and headersKeep the body exactly as received.
- VerifyCheck the signatureWith your signing secret.
- QueueStore the workProcess it after answering.
- AnswerReturn 2xx fastWithin about 2 seconds.
Set up the endpoint in Settings, then Webhooks. New endpoints start with order.paid selected, and you must choose at least one event. Ruba generates a signing secret when you create the endpoint. Store it safely and never put it in client-side code.
Verify in TypeScript
Ruba’s TypeScript SDK has a validateEvent function. Use the raw body, not a parsed one, or the signature check will fail.
import express, { Request, Response } from 'express'
import { validateEvent, WebhookVerificationError } from '@getruba/sdk/webhooks'
const app = express()
app.post('/webhook', express.raw({ type: 'application/json' }), (req: Request, res: Response) => {
try {
const event = validateEvent(
req.body,
req.headers,
process.env['RUBA_WEBHOOK_SECRET'] ?? '',
)
// Queue event for processing.
res.status(202).send('')
} catch (error) {
if (error instanceof WebhookVerificationError) {
return res.status(403).send('')
}
throw error
}
})In a Next.js app, the @getruba/nextjs adapter’s Webhooks handler does this for you and gives typed callbacks such as onOrderPaid and onSubscriptionCanceled. For other languages, use a Standard Webhooks library or implement the specification.
What Ruba does when you fail
Great for Short outages. Ruba keeps trying.
Watch for Register the final URL, with no redirect.
Great for Receivers that queue first.
Watch for Slow handlers cause repeat deliveries.
Great for Catching a broken receiver quickly.
Watch for Events are kept for 90 days, and you can redeliver.
What to do next
Build in the sandbox first. Read how to test payments in the sandbox. When you are ready to sell, see the early-access deal. Ruba has no monthly fee and charges 4% + $0.50 per sale.
Verify the signature, then act on the event. You start with no company and pay no monthly fee. Your early-access rate for your Ruba integration is 4% + $0.50 per sale, locked as long as the account stays open and in good standing. If a fee ever turns up that Ruba never told you about, Ruba refunds it and pays you $100. Terms apply. See the early-access deal.
Questions people ask
How do I verify a webhook?
Ruba follows the Standard Webhooks specification. The TypeScript SDK and the JavaScript adapters verify signatures for you. Keep the raw request body, check the signature with your signing secret, reject failures, and return a 2xx quickly.
What happens if my endpoint is down?
A network error or non-success response is retried up to 10 times with exponential backoff. A response that takes longer than 10 seconds is timed out and retried. If 10 consecutive events exhaust every retry, Ruba pauses the endpoint and emails every member of the shop.
Can I use localhost?
No. Endpoint URLs must be public https URLs. For local work, use an https tunnel.
Are events delivered in order?
events are delivered in order per endpoint. Because retries happen, make your handler idempotent so a repeated event does no harm.
How long are events kept?
Ruba keeps events for 90 days. From the endpoint page you can redeliver an event or reset the signing secret.
Sources
We check these when we update this guide. Rules can change, so check them yourself before you decide.
- Ruba: webhook deliveryChecked 26 Nov 2026
- Ruba: webhook endpointsChecked 26 Nov 2026
- Ruba: use Ruba with Next.jsChecked 26 Nov 2026
- Ruba: sandboxChecked 26 Nov 2026
- Ruba: pricing and feesChecked 26 Nov 2026