Type Alias: RequirementsBuilder<TRequirements>
ts
type RequirementsBuilder<TRequirements> = (req) =>
| BuiltRequirements<TRequirements>
| Promise<BuiltRequirements<TRequirements>>;Defined in: packages/x402-express/src/options.ts:80
Full control: build the whole accepts[] per request.
Called on EVERY request, paid ones included — a payment has to be held against the merchant's terms, and a builder is the only thing that knows them. So it must be side-effect-free: recording an order from in here books one per request rather than one per challenge. Use the scheme spec's per-challenge reference hook (canton-exact: memo) for anything that should happen once per challenge; the middleware calls that only when it issues one.
Type Parameters
TRequirements
TRequirements extends X402PaymentRequirements<unknown> = CantonPaymentRequirements
Parameters
req
Request
Returns
| BuiltRequirements<TRequirements> | Promise<BuiltRequirements<TRequirements>>