@agentspend/sdk 0.3.5 → 0.3.6

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/dist/index.js CHANGED
@@ -141,8 +141,9 @@ function createAgentSpend(options) {
141
141
  return c.json({ error: "Could not determine payment amount from request" }, 400);
142
142
  }
143
143
  const currency = opts.currency ?? "usd";
144
- // Step 3: Check for x-payment header → crypto payment
145
- const paymentHeader = c.req.header("x-payment");
144
+ // Step 3: Check for payment header → crypto payment
145
+ // x402 v2 uses "Payment-Signature", v1 uses "X-Payment"
146
+ const paymentHeader = c.req.header("payment-signature") ?? c.req.header("x-payment");
146
147
  if (paymentHeader) {
147
148
  return handleCryptoPayment(c, next, paymentHeader, effectiveAmount, currency, body, opts);
148
149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentspend/sdk",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "publishConfig": {
package/src/index.ts CHANGED
@@ -293,8 +293,9 @@ export function createAgentSpend(options: AgentSpendOptions): AgentSpend {
293
293
 
294
294
  const currency = opts.currency ?? "usd";
295
295
 
296
- // Step 3: Check for x-payment header → crypto payment
297
- const paymentHeader = c.req.header("x-payment");
296
+ // Step 3: Check for payment header → crypto payment
297
+ // x402 v2 uses "Payment-Signature", v1 uses "X-Payment"
298
+ const paymentHeader = c.req.header("payment-signature") ?? c.req.header("x-payment");
298
299
  if (paymentHeader) {
299
300
  return handleCryptoPayment(c, next, paymentHeader, effectiveAmount, currency, body, opts);
300
301
  }