ClawRouter icon indicating copy to clipboard operation
ClawRouter copied to clipboard

I have a few questions about the x402 payment flow and would appreciate some clarification

Open vseae opened this issue 8 months ago • 1 comments

Hi team,

I have a few questions about the x402 payment flow and would appreciate some clarification:

  1. Does your implementation currently support only the exact payment scheme?

  2. How is the charge for a specific request calculated?

    • Is the amount determined fully in advance by the server?
    • Is there any way for the client to inspect the pricing breakdown before the payment is executed?
  3. What happens if the client sends more than the required amount by mistake?

    • Will the extra amount be refunded automatically?

I’m asking because clearer guidance on supported payment schemes, pricing logic, and refund handling would make integration much easier.

Thanks.

vseae avatar Mar 25 '26 07:03 vseae

Answers (and apologies for the delay):

1. Yes — exact scheme only. ClawRouter pays x402 v2 exact on Base (EVM, USDC via EIP-3009 transferWithAuthorization) and on Solana. No upto/streaming schemes.

2. The charge is fully server-dictated. The server computes the price from the model's published per-token pricing (plus a flat per-transaction fee on paid calls) and returns it in the 402 PaymentRequirements — the client sees the exact quoted amount before signing anything. ClawRouter also keeps a local estimate for logging/budget caps, but that local number never determines what you pay; only the 402 quote does. Pricing per model is public at blockrun.ai/models.

3. Overpayment can't happen under exact. The client signs an authorization for precisely the amount in the payment requirements. The facilitator settles that exact amount; an authorization for a different amount fails verification and nothing settles. So there's no refund path because there's no overpayment path.

Closing as answered — feel free to reopen if anything is still unclear.

VickyXAI avatar Aug 02 '26 20:08 VickyXAI