Enterprise-grade dunning architecture, simplified.
How Reviaid combines Edge Computing, smart asynchronous scheduling, and anti-spam deliverability to win back subscriptions.
Edge-Native Webhook Event Bus
Traditional dunning tools queue webhook ingestion on centralized monoliths, dropping events during traffic spikes. Reviaid deploys edge-native Hono endpoints across 300+ edge locations worldwide.
// Edge Runtime Route (Hono)
app.post("/v1/stripe/webhook", async (c) => {
const sig = c.req.header("stripe-signature");
const event = await stripe.webhooks.constructEventAsync(body, sig, SECRET);
if (event.type === "invoice.payment_failed") {
await queue.enqueueDunningSequence({
invoiceId: event.data.object.id,
customerId: event.data.object.customer,
amountDue: event.data.object.amount_due,
attemptCount: event.data.object.attempt_count,
});
}
return c.json({ received: true }, 200);
});Smart Async Dunning Queue
Blind retries trigger bank anti-fraud flags and decline permanently. Reviaid’s asynchronous queue (Trigger.dev / QStash) analyzes customer card country and local time to retry during peak banking clearance windows.
// Async Queue Sequence
export const dunningSequence = task({
id: "stripe-dunning-orchestration",
run: async (payload) => {
// 0h: Send immediate friendly notification
await mailer.sendFriendlyNotice(payload);
// Wait for optimal bank processing hour (48h delay)
await wait.forOptimalBankWindow({ hours: 48, tz: payload.userTz });
const retryResult = await stripe.invoices.pay(payload.invoiceId);
if (retryResult.status !== "paid") {
// Day 4: Inject dynamic 15% discount rescue code
await dunning.injectRescueCoupon(payload);
}
}
});Multi-Domain Deliverability Matrix
Billing emails with scary legalistic invoices often land straight into Spam. Reviaid uses an isolated, pre-warmed sending matrix with pristine IP reputations and humanized plain-text layouts.
// Deliverability Dispatch
const emailDispatch = await emailMatrix.send({
template: "gentle_rescue_v1",
to: customer.email,
variables: {
customerName: customer.name,
productName: "Your SaaS",
rescueLink: "https://pay.reviaid.com/update?token=tok_8f93a",
discountCode: "RESCUE15OFF",
},
strategy: "warmed_high_reputation_pool"
});1-Click Frictionless Card Updater
Forcing a customer to remember their login password to fix a payment failure causes massive drop-off. Reviaid’s updater page uses secure, single-use signed tokens.
// Secure Tokenized URL Structure
https://pay.reviaid.com/update
?session=cs_test_a1b2c3d4e5
&token=jwt_signed_hmac_256
&expires=86400Outbound Webhooks & Event Hooks
When a payment is rescued, or when a subscription finally lapses after the 7-day grace period, Reviaid fires clean outbound webhooks to your servers so your app can grant or pause features automatically.
// Outbound Webhook Payload Example
{
"event": "reviaid.recovery.succeeded",
"timestamp": "2026-10-17T14:22:00Z",
"data": {
"customerId": "cus_N9f2K8x",
"recoveredAmount": 4900,
"currency": "usd",
"attemptSequence": "hour_48_retry",
"savedMrr": 49.00
}
}Ready to stop losing MRR to expired credit cards?
Join hundreds of indie developers and SaaS teams reclaiming their hard-earned recurring revenue on autopilot.