Skip to content
Finance tasks

Ask me before big refunds

Refunds up to your line go out without you; anything larger waits for your yes, with the Order and the reason attached.

The billing agent sends refunds up to your line and tells the Customer in the same conversation. Anything larger becomes an Approval with the Order, the amount and the reason.

Needs Take a payment

What you get

  • 1refund line at $250: smaller refunds go out without asking youSetting
  • 1refund within the line, sent through Stripe, with the Customer told in the Conversation that askedOrder
  • 1Approval for each refund over the line, with the Order, the amount and the reasonApproval
  • 1Billing Process switched on, if it was offProcess

Your agent does

Process.enable → Setting.update
You, to your agent

Ask me before big refunds.

Refund up to $250 without asking me.

Hold any refund over $250 for my yes.

# 1. Process.enable
curl -X POST https://api.sb/leaseline.app/processes/process_billing/enable \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"

# 2. Setting.update
curl -X PATCH https://api.sb/leaseline.app/settings/setting_1 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":250,"key":"refunds.limit"}'
import { $ } from 'startup-builder'

await $.Process.enable({ process: 'process_billing' })
await $.Setting.update({ id: 'setting_1', value: 250, key: 'refunds.limit' })
npx startup-builder do Process.enable --json '{"process":"process_billing"}'
npx startup-builder do Setting.update --json '{"id":"setting_1","value":250,"key":"refunds.limit"}'
{
  "name": "do",
  "arguments": {
    "code": "await $.Process.enable({ process: 'process_billing' })\nreturn await $.Setting.update({ id: 'setting_1', value: 250, key: 'refunds.limit' })"
  }
}

Change it

  • Raise the line to $500.
  • Ask me before every refund this month.
  • Show me every refund from last month.

Under the hood

Systems
Billing, Ledger, Work queue
Nouns
Order, Approval, Limit, Setting, Process
Events
Order.refunded, Process.enabled
Stripe objects
Refund

Every refund runs Issue a refund, the body of Order.refund, whoever asks for it. It checks the amount against refunds.limit on the Billing Process, which starts at $100. Refund small amounts fast: $40 back today costs less than a chargeback next month.

This line covers every refund. To give only the support agent its own smaller line, let the support agent refund up to $50.