Hook points
Example
Rules
- Hooks must be idempotent.
onSettlemay be called more than once for the same tx if a retry occurs; keys writes withtxHash. onVerifyis the only hook that can reject. ThrowingPaymentRejection(code)returns a402with the given code to the client.- Do not mutate
requirementsfromonPaymentRequired. Amounts and destinations must be stable across the verify cycle. - Hooks have a 500ms soft budget. Blocking the request path for longer degrades verify latency.
Rejection codes for custom rejections
Use codes prefixed withcustom_ to avoid colliding with the standard rejection set. Buyers treat unknown custom_* codes as terminal.