Repository navigation
Description
Context & Rationale
PaymentProvider assumes verification moves no funds and settlement follows. Core adjusts that sequence through two conventions: metadata.settleAfterBackend on a requirement controls whether settlement follows the backend call, and details.settlementNotSubmitted on a thrown error marks a failed settle as never submitted. Providers cannot declare atomic verification and charging, asynchronous settlement or external finality.
The 2.x checkboxes add the new interface alongside the old one. The final checkbox removes the old forms in 3.0.0.
Proposed Changes
- Add a second provider interface that declares capabilities and outcomes
- A provider states: separate verification, atomic verify and charge, asynchronous settlement, external finality, when a payment counts as committed and as final, which uncertain states it can produce, and whether a retry is safe. The addition goes through
docs/contracts.mdanddocs/contract-surface.txt.
- A provider states: separate verification, atomic verify and charge, asynchronous settlement, external finality, when a payment counts as committed and as final, which uncertain states it can produce, and whether a retry is safe. The addition goes through
- Wrap providers written against the verify-then-settle interface
- Core adapts them, and they keep working unchanged through 2.x.
- Move x402 and MPP to the new interface
- Deprecate the old forms
@deprecatedon the verify-then-settle interface,metadata.settleAfterBackendand thesettlementNotSubmittedconvention, with an entry indocs/migration-3.0.md.
- 3.0.0: remove the three deprecated forms
Non-goals / Invariants Preserved
- No payment behaves differently in 2.x: the same settlement order per
paymentFlow, the same replay reservations, and the same handling of uncertain outcomes. - Fail closed, and an unknown outcome stays unknown until there is evidence.
- No new rail, scheme or transaction state ships with this.
Impact & Value
Done when the public contract supports rails beyond verify then settle without core changes, and existing third-party 2.x providers run unmodified until 3.0.0.
Test plan
A provider on the old interface passes the existing pipeline suite through the wrapper. x402 and MPP end-to-end tests still assert balances and the transaction hash in the receipt. A test provider with atomic verify and charge, and one with asynchronous settlement, reach exactly the states they declare. A settle failure before submission still releases the reservation, and any other settle failure still keeps it uncertain.
Activity