Kobana

Workers that take care of your billing 24/7.

Dunning with 5 retries, daily invoice generation, automatic NFe, expiring card alert, proposal expiration. Everything running without you having to remember.

Feature
Dunning configuration and delinquent accounts
35
active workers
18
scheduled jobs
5
default retries
24/7
no manual intervention

What is automated

Dunning (Payment Recovery)
DunningConfig per organization: maxRetries (default 5), retryIntervalDays ([1,2,3,5,7]), suspendAfterRetries, gracePeriodDays (30).
  • Payment-retry worker every 6h
  • Multiple methods in retry (card → boleto → PIX)
  • DelinquentAccount + RecoveryRecord for audit
  • Webhook on each attempt
Multi-Channel Communication Schedule
NotificationChannel: email, in_app, webhook. EmailTemplate per event + organization. Customer can opt-out granularly.
  • 11 NotificationTypes (invoice_created, payment_failed, trial_ending)
  • Editable HTML + text templates
  • NotificationPreference per billing account
Automatic Invoice Generation
Invoice-generation worker daily at 01:00 UTC. Scans subscriptions, generates idempotent invoice, applies coupons/credits, issues NFe (if policy).
  • Idempotency by (subscription, period_start)
  • Skip of trial without card
  • Webhook invoice.created + email
Subscription Renewal
Subscription-renewal worker daily at 00:00 UTC. Advances current_period_* in cycle. Commitment respected (12 months, etc.).
  • Supports auto-renew and prompt
  • Scheduled cancel processed before
  • Webhook subscription.renewed
Expiring Card Alert
Card-expiring worker weekly (Monday 10:00 UTC). Detects cards with expirationYear/Month in ≤ 30 days. Notifies via schedule.
  • Reduces churn from expiration
  • Email + in-app with direct link
  • Configurable reminder
Automatic Suspension
Suspension-check worker daily at 02:00 UTC. Suspends BillingAccount after grace period exhausted.
  • suspendedAt + reason recorded
  • Webhook billing_account.suspended
  • Automatic reactivation on payment
Proposal Expiration
Proposal-expiration worker daily at 00:30 UTC. Marks proposals as expired after expires_at. Proposal-reminder worker (09:00) sends reminder before.
  • Increases close rate
  • Email with proposal link
  • Average time metrics
Usage Snapshots (Analytics)
UsageDailySnapshot + UsageMonthlySnapshot calculated via worker. Base for analytics, MRR and cohorts.
  • Daily snapshot in background
  • Consolidated monthly snapshot
  • Reduces query cost in dashboard
Gateway Callbacks
Callback worker processes payloads received from gateways. Dedicated handlers per provider (Pagar.me, Kobana, NFe.io).
  • Idempotency by idempotencyKey
  • Automatic retry on failure
  • Complete logs in Callback model
Custom Domain Worker (DNS + SSL)
Custom-domain-dns + custom-domain-ssl workers validate DNS, issue Let's Encrypt cert, renew automatically.
  • ACME protocol (acme-client)
  • Renewal 30 days before expiry
  • Status: pending → verified → active

Configure dunning via API

bash
curl -X PATCH https://api.billing.kobana.com.br/v1/organizations/settings/dunning \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "max_retries": 5,
    "retry_interval_days": [1, 3, 5, 7, 14],
    "suspend_after_retries": true,
    "grace_period_days": 30,
    "auto_retry_enabled": true,
    "retry_payment_methods": ["pix", "bank_slip", "card"]
  }'
response
{
  "id": "dc_xyz",
  "max_retries": 5,
  "retry_interval_days": [1, 3, 5, 7, 14],
  "grace_period_days": 30
}

Perguntas frequentes

Stop operating billing manually