Cap usage on a plan
Say "give the starter plan 10 exports a day" and get a Limit on the plan, a usage meter in the Portal, and an upgrade offer at the cap.
A Limit bounds an Entitlement, and the Offer's atBound says what happens past it: stop, bill the overage, or offer the next plan.
Needs Charge monthly · Open a bank account
What you get
- 1Limit of 10 exports per rolling dayLimit
- 1Entitlement on the Starter Offer, bounded by that LimitEntitlement
- 1usage meter in each customer’s Portal, with the reset timePortal
- 1upgrade offer at the cap, to the next plan upOffer
Your agent does
You, to your agent
Give Starter 10 exports a day, then ask them to upgrade.
Cap the free plan at 100 calls a month.
Limit how much each plan can use.
# 1. Limit.create
LIMIT= $(curl -X POST https: //api.sb/ leaseline.app/ limits \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"amount": {"amount": 29, "currency": "USD"}, "count": 10, "period": "day", "resets": "rolling"}' | jq -r '.limit["$id"] | split("/ ") | last')
# 2. Offer.grant
curl -X POST https: //api.sb/ leaseline.app/ offers/ offer_starter_monthly/ grant \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"verb": "Collection.export", "limit": "'"$LIMIT"'"}'
# 3. Offer.update
curl -X PATCH https: //api.sb/ leaseline.app/ offers/ offer_starter_monthly \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"price": {"amount": 29, "currency": "USD"}, "atBound": "upgrade"}'
import { $ } from 'startup-builder'
const limit = await $.Limit.create({ amount: { amount: 29, currency: 'USD' }, count: 10, period: 'day', resets: 'rolling' })
await $.Offer.grant({ offer: 'offer_starter_monthly', verb: 'Collection.export', limit: limit.$id })
await $.Offer.update({ id: 'offer_starter_monthly', price: { amount: 29, currency: 'USD' }, atBound: 'upgrade' })
LIMIT= $(npx startup-builder do Limit.create --json '{"amount": {"amount": 29, "currency": "USD"}, "count": 10, "period": "day", "resets": "rolling"}' | jq -r '.limit["$id"] | split("/ ") | last')
npx startup-builder do Offer.grant --json '{"offer": "offer_starter_monthly", "verb": "Collection.export", "limit": "'"$LIMIT"'"}'
npx startup-builder do Offer.update --json '{"id": "offer_starter_monthly", "price": {"amount": 29, "currency": "USD"}, "atBound": "upgrade"}'
{
"name": "do",
"arguments": {
"code": "const limit = await $.Limit.create({ amount: { amount: 29, currency: 'USD' }, count: 10, period: 'day', resets: 'rolling' })\nawait $.Offer.grant({ offer: 'offer_starter_monthly', verb: 'Collection.export', limit: limit.$id })\nreturn await $.Offer.update({ id: 'offer_starter_monthly', price: { amount: 29, currency: 'USD' }, atBound: 'upgrade' })"
}
}
Change it
- Bill a cent per export past the cap instead.
- Reset the cap on the first of the month.
- Raise the cap for Riverside Property only.
Under the hood
- Systems
- Billing, Work queue, Matchmaking
- Nouns
- Limit, Entitlement, Offer
- Events
Limit.created,Offer.granted,Offer.updated