@billmyagent/x402-express 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -68,6 +68,15 @@ Coinbase's alike. For a cheap endpoint it is noise. For an expensive one, do the
68
68
  cheap part in the handler and the expensive part after you have seen the
69
69
  `X-PAYMENT-RESPONSE` header.
70
70
 
71
+ ## Sandbox keys
72
+
73
+ A `sk_test_` key settles on **`base-sepolia` only**. The gateway does not offer
74
+ it a live network at all, so a sandbox key configured for `base` fails at
75
+ startup here — when you deploy — rather than when a buyer tries to pay.
76
+
77
+ Testnet USDC is free from [faucet.circle.com](https://faucet.circle.com). Use a
78
+ `sk_live_` key to take real payments.
79
+
71
80
  ## Networks
72
81
 
73
82
  `base` and `base-sepolia`, settled in USDC. There is no Ethereum L1
@@ -107,6 +116,7 @@ there is no safe fallback for "where should this money go".
107
116
 
108
117
  | Message | Cause |
109
118
  | --- | --- |
119
+ | `this is a sandbox API key (sk_test_), so it cannot settle on <network>` | A `sk_test_` key is offered testnet only. Use `network: 'base-sepolia'`, or a `sk_live_` key for real funds |
110
120
  | `your account has no payout address registered for <network>` | Set one in the dashboard, then restart |
111
121
  | `could not reach the facilitator (401 …)` | The API key is wrong, revoked, or its owner's email is unverified |
112
122
  | A buyer sees `invalid_exact_evm_payload_recipient_mismatch` | The `payTo` in the request is not your registered address. If you passed `payTo` yourself, that is the mismatch |
package/dist/index.js CHANGED
@@ -95,6 +95,15 @@ async function resolvePayTo(options) {
95
95
  const body = (await res.json());
96
96
  const kind = (body.kinds ?? []).find((k) => k.network === network && k.extra?.payTo);
97
97
  if (!kind?.extra?.payTo) {
98
+ // A sandbox key is never OFFERED a live network, so "no payout address"
99
+ // would be true-shaped and wrong -- the address is registered, the key
100
+ // just cannot take real money. Read the environment the facilitator
101
+ // reports rather than guessing from an absence.
102
+ if (body.environment === 'sandbox') {
103
+ throw new Error(`@billmyagent/x402-express: this is a sandbox API key (sk_test_), so it cannot settle on ` +
104
+ `${network}. Use network 'base-sepolia' for testing, or a production key ` +
105
+ `(sk_live_) to take real payments.`);
106
+ }
98
107
  throw new Error(`@billmyagent/x402-express: your account has no payout address registered for ${network}. ` +
99
108
  `Set one in the dashboard under Settings → Payouts, then restart.`);
100
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@billmyagent/x402-express",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Charge for an Express API with x402, settled and reconciled through BillMyAgent",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",