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
## Summary
`create_x402_server(facilitator="coinbase")` was passing a bare
`x402Facilitator()` (an empty in-process facilitator with no schemes) to
`x402ResourceServer`. Pre-existing bug — only surfaced after #8 fixed
the dict→`ResourceConfig` coerce in `process_x402_settle`, which then
unblocked the path through `build_payment_requirements` where the
missing facilitator wiring raised:
```
SchemeNotFoundError("No scheme 'exact' registered for network 'eip155:8453'")
```
The Coinbase x402 facilitator at `api.cdp.coinbase.com` requires a
**per-endpoint JWT** signed with the CDP API secret over `(method, host,
path)`. The TS sibling `@coinbase/x402` ships that JWT minter
(`createCdpAuthHeaders` → `generateJwt` from `@coinbase/cdp-sdk/auth`).
There is no Python `coinbase-x402` package on PyPI. The official
`docs.cdp.coinbase.com/x402/quickstart-for-sellers#python` snippet
implies `HTTPFacilitatorClient(FacilitatorConfig(url=...))` auto-picks
up `CDP_API_KEY_ID`/`SECRET` from env — empirically it does not (returns
401 Unauthorized).
## What this PR does
- New `coinbase` install extra → pulls in `cdp-sdk>=1.0,<2`.
- `create_x402_server(facilitator="coinbase")` now builds an
`HTTPFacilitatorClient` pointed at
`https://api.cdp.coinbase.com/platform/v2/x402` with a
`CreateHeadersAuthProvider` that mints per-endpoint Bearer JWTs via
`cdp.auth.utils.jwt.generate_jwt`. Mirrors the `@coinbase/x402` (TS)
shape.
- Reads `CDP_API_KEY_ID` / `CDP_API_KEY_SECRET` from env, or accepts
explicit `cdp_api_key_id` / `cdp_api_key_secret` args. Raises a clear
`ValueError` when missing; raises a guiding `ImportError` when `cdp-sdk`
isn't installed.
- Also fixes the `http` branch to use `HTTPFacilitatorClient` (was also
passing a bare `x402Facilitator()`), so the public `x402.org` testnet
facilitator actually populates `_supported_responses`.
- Updates doc strings to call out that `x402[evm]>=2.9` is the required
peer.
## Verification (live, against prod CDP)
```
$ CDP_API_KEY_ID=... CDP_API_KEY_SECRET=... uv run python -c "..."
init OK
_supported_responses: ['eip155:1', 'polygon', 'arbitrum', 'world', ..., 'eip155:8453', ...]
eip155:8453: ['exact', 'upto']
build OK, requirements len: 1
asset: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
amount: 100000 # $0.10 USDC at 6 decimals
```
## Tests
- New: `test_create_x402_server_coinbase_facilitator_wires_cdp_jwt`
(asserts HTTPFacilitatorClient at the CDP URL with auth_provider
attached)
- New: `test_create_x402_server_coinbase_without_creds_raises` (asserts
the missing-creds ValueError)
- Full suite: **719 passed, 3 skipped, 95.33% coverage** (above 95%
bar).
## Doc updates
- `README.md` + `CLAUDE.md`: add `[coinbase]` extra install snippet +
CDP env var note.
- `core/docs/integrations/python-commerce.mdx` (Mintlify): same.
- `examples/variable_cost_merchant.py`: corrects stale
`server.process_payment_request(request)` reference (replaced by
`process_x402_settle(...)` in 1.3.1) and adds `[coinbase]` to the
peer-dep install line.
## Test plan
- [ ] CI green.
- [ ] Tag `v1.3.2`, push tag → trigger PyPI publish via trusted
publisher.
- [ ] Bump `core/store/uv.lock` to 1.3.2 + add `[coinbase]` extra to
`core/store/pyproject.toml`.
- [ ] Deploy store prod.
- [ ] Re-run T4 base mainnet smoke against agents.agentscore.sh — expect
a **200 + order**, not a 503 SchemeNotFoundError.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
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