Skip to content

Handle 402 responses

AllowKit is designed to handle the 402 flow automatically once @allowkit/x402 ships (see the roadmap). Understanding both sides clarifies what it takes off your plate.

The developer must:

  • parse the 402 response
  • decide whether to pay
  • sign/send the payment
  • retry the request
  • prevent duplicate payments
  • log the transaction

AllowKit is designed to handle:

  • 402 detection
  • payment requirement parsing
  • policy evaluation
  • payment execution
  • retry with proof
  • receipt generation
  • duplicate payment protection (see Idempotency)
Agent
│ GET paid resource
Resource
│ 402 Payment Required
AllowKit
│ check policy + allowance
│ pay if approved
Resource
│ retry with payment proof
Agent receives response