Skip to content

ProxyOptions.onPayment is declared and documented but never invoked #321

Description

@twzrd-sol

ProxyOptions.onPayment is declared and documented, but nothing ever calls it, so a
caller that supplies it silently never hears about a settlement.

Declared at src/proxy.ts:1497:

onPayment?: (info: { model: string; amount: string; network: string }) => void;

Documented as a working example at docs/configuration.md:353:

onPayment: (info) => console.log(`Paid ${info.amount} for ${info.model}`),

But git grep -n onPayment -- src returns only that declaration. The one other hit in
src/ is x402.onPaymentCreationFailure at src/spend-control.ts:966, a different
symbol. There is no call site anywhere in src/, so the callback cannot fire on any
path -- it is passed in test/test-e2e.ts:840 and never invoked there either.

Matches observation: it did not fire on real settlements (three paid completions plus an
MCP call) while other spend accounting updated normally.

Either wiring it where a payment is confirmed, or dropping it from the type and the docs,
would be an improvement over a documented option that cannot work. Happy to send whichever
you prefer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions