Skip to content

Commit 0d53e73

Browse files
committed
fix(cli): show whether payment was attempted on server errors
When a server returns a non-402 error (500, 503, etc.), display a message indicating whether the payment was actually attempted. Helps users distinguish "server down before payment" from "payment processed but server failed".
1 parent f00aba0 commit 0d53e73

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

packages/x402-proxy/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.7.1] - 2026-03-20
11+
12+
### Fixed
13+
- Non-402 server errors (500, 503, etc.) now indicate whether payment was attempted, helping users distinguish "server down" from "payment failed"
14+
1015
## [0.7.0] - 2026-03-20
1116

1217
### Added
@@ -186,7 +191,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
186191
- `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
187192
- Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
188193

189-
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.7.0...HEAD
194+
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.7.1...HEAD
195+
[0.7.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.7.0...v0.7.1
190196
[0.7.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.6.0...v0.7.0
191197
[0.6.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.2...v0.6.0
192198
[0.5.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.1...v0.5.2

packages/x402-proxy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "x402-proxy",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"description": "curl for x402 paid APIs. Auto-pays any endpoint on Base, Solana, and Tempo. Also works as an OpenClaw plugin.",
55
"type": "module",
66
"sideEffects": false,

packages/x402-proxy/src/commands/fetch.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,15 @@ Examples:
391391
if (/payment|auth|www|x-pay/i.test(k)) verbose(`header ${k}: ${v.slice(0, 200)}`);
392392
}
393393

394+
// Non-402 error: tell user whether payment was attempted
395+
if (!response.ok && response.status !== 402 && isTTY()) {
396+
if (!payment) {
397+
dim(" Server returned error before payment was attempted.");
398+
} else {
399+
dim(" Payment was processed but server returned an error.");
400+
}
401+
}
402+
394403
// Payment failed - check balances and show appropriate message
395404
if (response.status === 402 && isTTY()) {
396405
const detected = detectProtocols(response);

0 commit comments

Comments
 (0)