Skip to content

Type Alias: RequirementsSpec<TSpec> ​

ts
type RequirementsSpec<TSpec> = SharedTerms & Partial<Omit<TSpec, keyof SharedTerms>> & object;

Defined in: packages/x402-express/src/options.ts:53

The merchant's terms: what is being sold, and the ways to pay for it.

The mirror of AcceptSpec: an entry must carry the scheme's own fields and may override the shared ones, so the terms carry the shared ones and may name any of the scheme's once for the whole sale.

That last part is what memo needs. Entries are issued ONE reference between them when they carry the same generator, and naming it here hands every entry that one function without repeating it — written out in two entries it is two functions, so two references, and a generator that books an order books two. (Hoisting it into a variable and naming that in each entry works too; this spares the repetition.) A field named here that every entry restates anyway, amount, is simply overridden.

Fields may be a fixed value or a (req) => value resolver.

Type Parameters ​

TSpec ​

TSpec extends BaseRequirementsSpec = CantonRequirementsSpec

Type Declaration ​

accepts ​

ts
accepts: AcceptSpec<TSpec>[];

The ways to pay, each advertised as one accepts[] entry. A payer picks one and echoes it back as the payment's accepted; the middleware holds that against every entry this request would advertise, and lets it through if any of them takes it. Nothing on the wire says which one it was for.

Each carries its own price, because they are prices in different units — 0.05 of one token is not 0.05 of another, and nothing here checks that two entries are worth the same.