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

Retry a payment via API

bash
curl -X POST https://api.billing.kobana.com.br/v1/payments/4b5c6d7e-8f90-4a1b-b2c3-d4e5f6a7b8c9/retry \
  -H "Authorization: Bearer $KOBANA_TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: $(uuidgen)" \
  -d '{
    "payment_method_id": "6a7b8c9d-0e1f-4a2b-8c3d-4e5f6a7b8c9d"
  }'
response
{
  "data": {
    "id": "4b5c6d7e-8f90-4a1b-b2c3-d4e5f6a7b8c9",
    "invoice_id": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a",
    "payment_method_type": "card",
    "amount": 299.9,
    "currency": "BRL",
    "status": "processing"
  }
}

Perguntas frequentes

Stop operating billing manually