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.
ProxyOptions.onPaymentis declared and documented, but nothing ever calls it, so acaller that supplies it silently never hears about a settlement.
Declared at src/proxy.ts:1497:
Documented as a working example at docs/configuration.md:353:
But
git grep -n onPayment -- srcreturns only that declaration. The one other hit insrc/isx402.onPaymentCreationFailureat src/spend-control.ts:966, a differentsymbol. There is no call site anywhere in
src/, so the callback cannot fire on anypath -- 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.