You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(x402): wire Coinbase facilitator JWT auth in create_x402_server (1.3.2)
Pre-existing bug unmasked by 1.3.1: facilitator='coinbase' was passing a
bare x402Facilitator() — an empty in-process facilitator with no schemes —
to x402ResourceServer. Worked through dict→ResourceConfig coercion in 1.3.1
but build_payment_requirements then raised SchemeNotFoundError("No scheme
'exact' registered for network 'eip155:8453'") because _supported_responses
was never populated.
The Coinbase x402 facilitator at api.cdp.coinbase.com requires a per-endpoint
JWT bearer signed with the CDP API secret over (method, host, path). The TS
sibling @coinbase/x402 ships that JWT minter; there is no Python equivalent
package. The docs.cdp.coinbase.com Python snippet implies HTTPFacilitatorClient
auto-picks up CDP_API_KEY_ID/SECRET — it does not (returns 401 Unauthorized).
Fix: use cdp-sdk's generate_jwt to mint per-endpoint Bearer tokens via the
existing CreateHeadersAuthProvider hook on HTTPFacilitatorClient. New
`coinbase` extra pulls in cdp-sdk; create_x402_server reads CDP creds from
env (or new cdp_api_key_id/secret args) and raises a guiding ValueError if
absent. Verified live against prod CDP — eip155:8453 listed under supported
with [exact, upto], $0.10 requirement built correctly.
Also fixes the http branch to use HTTPFacilitatorClient (not bare
x402Facilitator) so the public x402.org testnet facilitator actually
populates _supported_responses for testnet rails.
Tests:
- 6 new x402 server tests (3 already passing + 2 for coinbase wiring + 1 for missing-creds error path)
- Full suite: 719 passed, 95.33% coverage (above the 95% bar)
Doc updates: python-commerce README + CLAUDE.md + Mintlify python-commerce.mdx
+ variable_cost_merchant.py example. Removes stale process_payment_request
reference (replaced by process_x402_settle in 1.3.1).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|`agentscore_commerce.payment`| Networks/USDC/rails registries, paymentauth.org directive builders, `create_x402_server` (wraps official `x402[evm]>=2.8` peer dep with v1+v2 dual-register + bazaar extension), `process_x402_settle` (single-call verify+settle wrapper around `x402ResourceServer`'s real 2.9 API: `build_payment_requirements` → `verify_payment` → `settle_payment`; auto-coerces dict `resource_config` with camelCase keys → typed `ResourceConfig`), `create_mppx_server` (wraps `pympp[server,tempo,stripe]>=0.6` peer dep with Tempo charge/session + Stripe SPT helpers), dispatch-by-network, signer extraction, WWW-Authenticate header, Settlement-Overrides header |
12
+
|`agentscore_commerce.payment`| Networks/USDC/rails registries, paymentauth.org directive builders, `create_x402_server` (wraps official `x402[evm]>=2.9` peer dep with v1+v2 dual-register + bazaar extension; for `facilitator="coinbase"` mints per-endpoint CDP JWTs via `cdp-sdk` (install with `coinbase` extra) and points HTTPFacilitatorClient at `api.cdp.coinbase.com/platform/v2/x402` — bare `x402Facilitator()` is empty and the CDP docs' env-var-only snippet does NOT auto-auth), `process_x402_settle` (single-call verify+settle wrapper around `x402ResourceServer`'s real 2.9 API: `build_payment_requirements` → `verify_payment` → `settle_payment`; auto-coerces dict `resource_config` with camelCase keys → typed `ResourceConfig`), `create_mppx_server` (wraps `pympp[server,tempo,stripe]>=0.6` peer dep with Tempo charge/session + Stripe SPT helpers), dispatch-by-network, signer extraction, WWW-Authenticate header, Settlement-Overrides header |
@@ -30,7 +30,7 @@ Single Python package, hatchling-built, published to PyPI as `agentscore-commerc
30
30
|`examples/`| Runnable single-file FastAPI apps for each common scenario |
31
31
|`tests/`| pytest, one file per surface |
32
32
33
-
Peer-dep pattern: payment/x402/mppx/stripe modules import lazily at runtime — vendors install only what they use via extras (`pip install agentscore-commerce[fastapi,stripe]` etc.). Underlying packages: `x402[evm]`, `pympp[server,tempo,stripe]`, `stripe`. Missing peer dep raises a guiding `ImportError` with the install command.
33
+
Peer-dep pattern: payment/x402/mppx/stripe modules import lazily at runtime — vendors install only what they use via extras (`pip install agentscore-commerce[fastapi,stripe]` etc.). Underlying packages: `x402[evm]`, `pympp[server,tempo,stripe]`, `stripe`, `cdp-sdk` (the `coinbase` extra — only needed when `facilitator="coinbase"`). Missing peer dep raises a guiding `ImportError` with the install command.
0 commit comments