Skip to content

Commerce

Commerce is how a product earns: one Offer prices every Verb, a Meter counts each unit once, and people and agents pay inside the call. Every priced call gets a signed receipt, and the money lands in your Stripe account.

Capability families

FamilyWhat it does
The catalogThe Offer is the one price source: a price per call, plans and seats, trials, free calls, credit packs, coupons, add-ons, committed use, quotes and invoices on terms
Entitlements and limitsWhat a Key may call, decided before the call runs: the plan's Entitlement, what it includes, the spend ceiling, and a rate limit that paying never lifts
MeteringEach priced unit counted once, by any unit the Offer names: a call, an answer row, 1,000 tokens, a minute, a seat, a read or an outcome
Payment by peopleStripe Checkout for credit packs and plans, subscriptions billed ahead, invoices on terms, tax on each charge, payment methods and tax details in the portal
Payment by agentsThe 402 with a cure; Max-Cost on the call and ceilings on the Key; payment inside the call on the open agent-payment rails, drawn from a mandate
The agent-legible contractTerms as data an agent accepts in the call, a signed receipt for every priced call, refunds by the published rule, and disputes opened with the receipt
Multi-party moneySeveral payees on one line; a charge on proof; client funds held until acceptance; a Marketplace's split and your share; holds and clawbacks
Payments for your CustomersEach Customer takes payments from its own customers on its own connected Stripe account, with your fee on each charge
Payouts and the sales recordPayouts to your Stripe account and to each supplier's; one record of every sale, refund, dispute, tax line and fee, with margin per Verb

Commerce adds its own Nouns to every product, the way Watch is a Noun on every API: Subscription, Balance, Invoice, Receipt, Refund, Dispute and Payout. Each has a lifecycle, writes its Events and answers on every Interface, so the portal and any console read the same state.

The sales record is the product's record of what it sold. Your company's books are not part of it: they read it through Events and the export.

Lifecycles and states

ThingStatesWhat moves it
A priced callquoted, reserved, then captured or releasedThe gate reserves the price under the Limits before the run; a result captures it; a miss, a failure or a cancel releases it at 0
A Balancefunded, low, empty, then funded againEach call draws once at its served price; Watches fire at 50, 80 and 100 percent; empty answers 402 with the packs
A Subscriptiontrialing, active, past_due, cancelledCheckout starts it; renewal bills a month or a year ahead; a failed renewal retries on Stripe before it ends; a new plan price reaches it at renewal
An outcome chargeheld, charged, paid_out, or remediedThe order holds the price; the move the Outcome contract names charges it; a rejection takes its remedy: redo, refund or credit
A Refundrequested, granted or declined, paidThe published rule grants it with no person; outside the rule it waits as Pending on the approver you name
A Disputeopened, answered, won or lostA Customer or its agent opens it with the receipt, and the call record and terms answer it; a card dispute arrives from Stripe as an Event
A Payoutearned, pending, paid, or reversedStripe pays your account and each supplier's on its schedule; a refund or a lost dispute reverses that line's shares

Every move above is a Verb and writes its past form: Subscription.renewed, Invoice.paid, Refund.granted, Dispute.opened, Payout.paid.

What you declare, what the platform does

You declareThe platform does
A price per Verb, by call, by consumption, by the month or by outcomeMeters each unit once and draws it from credits at the served price, or bills it on the plan
Plans, seats, trials, free calls and credit packsSells each through Stripe Checkout, runs every subscription on your Stripe account, and refuses past a plan with the next plan as the cure
The terms: the refund rule, the licence a sale grants, an Outcome contractRenders them on the site and the offer card, records their acceptance in each call, and grants each refund the rule allows
The split, in a Marketplace or a Service APISplits each payment per line on Stripe, holds a client's funds until acceptance, and claws back on a refund
Your fee on your Customers' own salesOnboards each Customer's own connected account, and takes your fee on each charge
Your Stripe account, connected onceCalculates tax on each charge, signs every receipt, answers disputes with the evidence, pays out, and reconciles the sales record against Stripe

APIs.Dev's own share comes off each charge as a fee at your plan's published rate, and the sales record prints it line by line.

Example

The sample's Offer with terms: a price per answer, a Watch by the month, free calls, credit packs, and terms accepted in the call.

definition.ts · offer
15 lines
import { define } from 'apis.dev'

/** Any company by its domain, with its headcount and sector. */
export default define({
  name: 'companyfacts', domain: 'companyfacts.apis.dev',
  …
  // Company and its Source as before
  offer: {
    'Company.get': 0.002, 'Company.search': 0.005,      // per answer; a miss is free
    'Company.watch': { month: 0.1 },                    // per record, by the month
    free: { 'Company.get': 100 },                       // calls a month at 0
    credits: [10, 50, { pay: 200, get: 220 }],          // the packs Checkout sells
    terms: { refund: 'wrong-answer', license: 'internal-use' },  // accepted in the call
  },
})

Every priced reply carries X-Receipt-Id, and the receipt it names is signed by the seller.

companyfacts.apis.dev/receipts/rcpt_1
14 lines
{
  "id": "rcpt_1",
  "request": "req_3cd59a9a1ede10c5bf21",
  "seller": "companyfacts.apis.dev",
  "customer": "cus_Acme",
  "verb": "Company.get",
  "version": "v1",
  "price": 0.002,
  "currency": "USD",
  "paid": "credits",
  "terms": { "refund": "wrong-answer", "license": "internal-use" },
  "at": "2026-10-27T09:00:00Z",
  "signature": "ed25519:…"
}

The signature verifies against the keys at /.well-known/receipt-keys, so anyone checks a receipt with no account, and a dispute carries it as it stands.

Contracts with the other subsystems

SubsystemWhat Commerce takes from itWhat Commerce gives it
Definition and compileThe Offer, the terms and the split rulesA refusal at deploy for an unpriced Verb, a price below cost, or shares above the price; a higher price per call marked as breaking
Identity, access and policyThe mandate a caller presentsThe price and the Entitlement, as inputs to the one decision
Model and recordsThe views it rebuildsThe sales record: revenue by Verb and Customer, margin, tax collected, refunds
Data and SourcesEach Source's cost, and the licence a sale may grantMargin per Verb, and the licence terms printed on a per-read sale
RuntimeThe gate's price step and the commitA reservation before the run; the fact, its meter line and its receipt in one commit; every Stripe charge as a durable intent; Stripe's view reconciled as an observed Event
WorkAcceptance under an Outcome contract, a supplier's filled orderThe charge on acceptance, each supplier's share released, a remedy paid as a refund or a credit
Interfaces and distributionEvery call, from every InterfaceX-Cost on every reply, offers in a 402 or 403, Checkout on your Host, the offer card's price and terms, the receipt in MCP _meta
Trust and operationsFraud, card-testing and chargeback signals; the Test twinMoney Events for every brake; a Test Key that never bills

The seam. Anything outside the product reads money through Events, webhooks and the export, and acts through the same Verbs. An invoice is product; the books it lands in are not.

What Customers and their agents meet

  • A person buying. The price page and its machine twin, Stripe Checkout for a pack or a plan, then a Live key. The portal holds the balance, the plan, invoices and receipts, payment methods, tax details, spend ceilings and cancellation.
  • A person paying on terms. A quote accepted as a Verb becomes an invoice on terms, paid on Stripe. The Entitlement starts on acceptance or on payment, as the Offer says.
  • An agent buying. It reads the offer card, asks quote for the exact price at no charge, and calls with Max-Cost. A 402 carries a cure it can pay within its mandate, and the call after payment goes through.
  • Anyone checking. Every priced call has a receipt that names the Version, the price and the terms, verifiable without the seller's help.
  • Anyone disputing. Dispute.open with the receipt; a refund the rule allows is paid with no person, and every other one waits on a named approver.
  • A supplier, in a Marketplace or a Service. Payout onboarding on Stripe, its share of each line it filled, and its tax forms.

An agent's purchase, in order:

  1. It reads /.well-known/agents.json and the offer card: price per unit, terms, the refund rule and proof.
  2. It asks quote for the exact price of its call, at price 0.
  3. It calls with Max-Cost and its mandate.
  4. Unpaid, it meets 402 with offers: Checkout links for a person, and a payment on the open agent-payment rails for itself.
  5. It pays from its mandate and calls again with the same Idempotency-Key; the call runs once and is billed once.
  6. It verifies the receipt's signature, and disputes with the receipt when the answer misses the terms.

One Offer is the only price: the reply, the page, the receipt and the bill read the same number.