-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
Is your feature request related to a problem? Please describe.
When payment is provided, the x402ServerExecutor is:
- Verifying:
self.verify_payment(...) - Setting task metadata
- Executing:
await self._delegate.execute(context, event_queue) - Settling:
await self.settle_payment(...)
I'd argue that's too much. In particular, users might want to settle before executing.
Describe the solution you'd like
I suggest the x402ServerExecutor delegates some of these tasks. In particular I think x402ExtensionConfig should be expanded to accommodate before_execute and after_execute hooks that would take in a PaymentPayload and a PaymentRequirements and do the required verification and settling as the user sees fit. before_execute could also use it's return value to set task metadata.
If required this library could provide additional defaults to keep the current behavior as a convenience.
Code of Conduct
- I agree to follow this project's Code of Conduct