uvd-x402-sdk 2.43.0 → 2.43.1

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.
@@ -93,6 +93,15 @@ interface PaymentAcceptance {
93
93
  network: string;
94
94
  asset: string;
95
95
  amount: string;
96
+ /**
97
+ * Payment scheme. REQUIRED by the facilitator's v2 `PaymentRequirementsV2`.
98
+ *
99
+ * Optional here only so existing callers keep compiling — when it is absent,
100
+ * `buildRequirementFromAcceptance` defaults it to `'exact'`. Do not treat its
101
+ * optionality as "the facilitator does not need it": an accepts[] entry that
102
+ * reaches a v2 client without a scheme is unpayable.
103
+ */
104
+ scheme?: string;
96
105
  payTo?: string;
97
106
  facilitator?: string;
98
107
  resource?: string;
@@ -93,6 +93,15 @@ interface PaymentAcceptance {
93
93
  network: string;
94
94
  asset: string;
95
95
  amount: string;
96
+ /**
97
+ * Payment scheme. REQUIRED by the facilitator's v2 `PaymentRequirementsV2`.
98
+ *
99
+ * Optional here only so existing callers keep compiling — when it is absent,
100
+ * `buildRequirementFromAcceptance` defaults it to `'exact'`. Do not treat its
101
+ * optionality as "the facilitator does not need it": an accepts[] entry that
102
+ * reaches a v2 client without a scheme is unpayable.
103
+ */
104
+ scheme?: string;
96
105
  payTo?: string;
97
106
  facilitator?: string;
98
107
  resource?: string;
@@ -1425,7 +1425,9 @@ function buildRequirementFromAcceptance(accept, resource, version, defaults) {
1425
1425
  throw new Error("Payment accepts entries must include payTo");
1426
1426
  }
1427
1427
  return normalizeRequirementForVersion({
1428
- scheme: "exact",
1428
+ // Honour a caller-supplied scheme; 'exact' is the default, not an override.
1429
+ // Hardcoding it silently discarded 'escrow' / 'commerce' accepts.
1430
+ scheme: accept.scheme ?? "exact",
1429
1431
  network: accept.network,
1430
1432
  maxAmountRequired: accept.amount,
1431
1433
  resource: accept.resource ?? defaults?.resource ?? resource,
@@ -1443,6 +1445,11 @@ function toPaymentAcceptance(requirements, facilitator) {
1443
1445
  network: requirements.network,
1444
1446
  asset: requirements.asset,
1445
1447
  amount: requirements.maxAmountRequired,
1448
+ // scheme is REQUIRED by the facilitator's v2 PaymentRequirementsV2. Dropping it
1449
+ // here produced an accepts[] entry that no v2 client could pay: the spec makes
1450
+ // the client echo the accept verbatim, so the omission travelled downstream and
1451
+ // died in deserialization with an error naming no field.
1452
+ scheme: requirements.scheme,
1446
1453
  payTo: requirements.payTo,
1447
1454
  resource: requirements.resource,
1448
1455
  description: requirements.description,