@genesis-tech/genesispay-seller 0.13.2 → 1.3.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/CHANGELOG.md +196 -0
- package/README.md +670 -91
- package/dist/checkout-documents.d.ts +99 -0
- package/dist/checkout-documents.d.ts.map +1 -0
- package/dist/checkout-documents.js +155 -0
- package/dist/checkout-documents.js.map +1 -0
- package/dist/checkout-return.d.ts +5 -5
- package/dist/checkout-return.d.ts.map +1 -1
- package/dist/checkout-return.js +3 -2
- package/dist/checkout-return.js.map +1 -1
- package/dist/client.d.ts +42 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +99 -10
- package/dist/client.js.map +1 -1
- package/dist/contract-mandates.d.ts +39 -0
- package/dist/contract-mandates.d.ts.map +1 -0
- package/dist/contract-mandates.js +98 -0
- package/dist/contract-mandates.js.map +1 -0
- package/dist/contract-usage.d.ts +29 -0
- package/dist/contract-usage.d.ts.map +1 -0
- package/dist/contract-usage.js +92 -0
- package/dist/contract-usage.js.map +1 -0
- package/dist/errors.d.ts +71 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +124 -13
- package/dist/errors.js.map +1 -1
- package/dist/fulfillment-attempts.d.ts +29 -0
- package/dist/fulfillment-attempts.d.ts.map +1 -0
- package/dist/fulfillment-attempts.js +71 -0
- package/dist/fulfillment-attempts.js.map +1 -0
- package/dist/fulfillment.d.ts +152 -0
- package/dist/fulfillment.d.ts.map +1 -0
- package/dist/fulfillment.js +810 -0
- package/dist/fulfillment.js.map +1 -0
- package/dist/genesispay-settlement.d.ts +4 -2
- package/dist/genesispay-settlement.d.ts.map +1 -1
- package/dist/genesispay-settlement.js +412 -15
- package/dist/genesispay-settlement.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/invoices.d.ts +31 -0
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +61 -2
- package/dist/invoices.js.map +1 -1
- package/dist/item-tax.d.ts +15 -0
- package/dist/item-tax.d.ts.map +1 -0
- package/dist/item-tax.js +19 -0
- package/dist/item-tax.js.map +1 -0
- package/dist/mandate-gate.d.ts +6 -1
- package/dist/mandate-gate.d.ts.map +1 -1
- package/dist/mandate-gate.js +81 -7
- package/dist/mandate-gate.js.map +1 -1
- package/dist/mandates.d.ts +21 -4
- package/dist/mandates.d.ts.map +1 -1
- package/dist/mandates.js +24 -3
- package/dist/mandates.js.map +1 -1
- package/dist/networks.d.ts.map +1 -1
- package/dist/networks.js +5 -4
- package/dist/networks.js.map +1 -1
- package/dist/payment-gate.d.ts +32 -1
- package/dist/payment-gate.d.ts.map +1 -1
- package/dist/payment-gate.js +275 -11
- package/dist/payment-gate.js.map +1 -1
- package/dist/products.d.ts +40 -16
- package/dist/products.d.ts.map +1 -1
- package/dist/products.js +1078 -56
- package/dist/products.js.map +1 -1
- package/dist/strict-response.d.ts +21 -0
- package/dist/strict-response.d.ts.map +1 -0
- package/dist/strict-response.js +68 -0
- package/dist/strict-response.js.map +1 -0
- package/dist/webhooks.d.ts +77 -2
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +20 -0
- package/dist/webhooks.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,201 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.0 — purchase-bound settlement preparation
|
|
4
|
+
|
|
5
|
+
Additive; requires protocol `^0.5.0`.
|
|
6
|
+
|
|
7
|
+
- Product gates (`products.gate(...).protect`) and the generic
|
|
8
|
+
`createPaymentGate(...).wrap` accept settlement-preparation parameters from
|
|
9
|
+
`GENESISPAY-Settlement-Prepare-Params` when `GENESISPAY-Settlement-Prepare: 1`
|
|
10
|
+
is present. The request body is then the purchase body, so a route may parse
|
|
11
|
+
and validate it before calling the gate (ADR-0083).
|
|
12
|
+
- In that mode a product gate recomputes the canonical method, resource URL and
|
|
13
|
+
request fingerprint and requires them to equal the expected gate intent. A
|
|
14
|
+
mismatch answers `422 { code: "contract_mismatch", mismatches }` and nothing
|
|
15
|
+
is forwarded to GenesisPay; a present but malformed params header answers
|
|
16
|
+
`422 { code: "invalid_request" }` and is never replaced by the body.
|
|
17
|
+
- The generic gate binds no request fingerprint; in header mode it treats the
|
|
18
|
+
body as opaque purchase content and never reads it.
|
|
19
|
+
- Without the params header both gates behave exactly as in 1.2.1: the body
|
|
20
|
+
carries the plan parameters (GET resources, hosted links, older engines).
|
|
21
|
+
- The `prepare` action sent to GenesisPay is unchanged.
|
|
22
|
+
- Document the beta lock on new mandate authority. A locked deployment answers
|
|
23
|
+
HTTP `409` `mandate_authority_locked_for_beta` (no `Retry-After`) for
|
|
24
|
+
`mandates.create`, the `contract_mandate_v1` proposal/activation helpers,
|
|
25
|
+
`mandates.proposeContractUsage` and `plans.create`.
|
|
26
|
+
`mandates.submitContractUsage`, revocation, reads and the x402 payment gate
|
|
27
|
+
are unaffected. Documentation only; no SDK source change and no publication.
|
|
28
|
+
|
|
29
|
+
## 1.2.1 — settlement ambiguity and terminal polling fixes
|
|
30
|
+
|
|
31
|
+
- Preserve a payer-supplied transaction hash when a custom settlement verifier
|
|
32
|
+
throws, returning a non-success reconciliation response instead of losing the
|
|
33
|
+
locator.
|
|
34
|
+
- Map asynchronously polled `failed` and `expired` product settlements to HTTP
|
|
35
|
+
409 and 410. Terminal status never looks like successful resource delivery,
|
|
36
|
+
never runs the protected handler, and never forwards `PAYMENT-RESPONSE`.
|
|
37
|
+
- Require synchronous facilitator success to carry a full transaction hash,
|
|
38
|
+
exact network, exact integer minor amount, exact known payer and both explicit
|
|
39
|
+
authorization/settlement verification flags before the paid handler runs.
|
|
40
|
+
- Document the already-exported experimental `contract_mandate_v1` helpers:
|
|
41
|
+
`mandates.createContractSubscription`, `createContractPerUse`,
|
|
42
|
+
`proposeContractUsage`, `submitContractUsage`, and `getContractUsage`, plus
|
|
43
|
+
their result/input types. They independently rebuild typed data and fail
|
|
44
|
+
closed on inconsistent authority. Their presence does not enable backend
|
|
45
|
+
admission or grant Mainnet clearance.
|
|
46
|
+
|
|
47
|
+
## 1.2.0 — hosted checkout documents and asynchronous settlement
|
|
48
|
+
|
|
49
|
+
Built on the strict 1.1.0 SDK and protocol 0.4 contract; no npm publication is
|
|
50
|
+
part of this change. Strict creation still requires an idempotency key and
|
|
51
|
+
versioned responses, and only `fulfillment.verify()` grants payment authority.
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
- The facilitator settlement adapter accepts versioned HTTP 202 queue
|
|
56
|
+
acceptance, polls the same-origin seller-key status URL, and reports success
|
|
57
|
+
only after GenesisPay verifies the seller transfer and returns its real hash.
|
|
58
|
+
- Strict product gates poll seller-scoped settlement status after 202 and retry
|
|
59
|
+
the gate request only after seller confirmation. `queued` and `submitted`
|
|
60
|
+
never authorize resource delivery; failed, expired, malformed and timed-out
|
|
61
|
+
status remains fail-closed.
|
|
62
|
+
- `settlementPollTimeoutMs` configures the facilitator adapter's bounded poll
|
|
63
|
+
window (120 seconds by default). Legacy synchronous 200 settlement remains
|
|
64
|
+
compatible.
|
|
65
|
+
|
|
66
|
+
- Plan-aware x402 gates advertise a preparation handshake, proxy exact
|
|
67
|
+
pre-sign authority through the GenesisPay facilitator, and submit the returned
|
|
68
|
+
plan id with settlement. Signed-first clients receive an upgrade refusal
|
|
69
|
+
before broadcast; current on-chain transfers are unchanged (MR-1011).
|
|
70
|
+
|
|
71
|
+
- **`genesispay.checkoutDocuments.list()`** lists the seller's immutable formal
|
|
72
|
+
invoices and enhanced receipts created after confirmed, non-simulated hosted
|
|
73
|
+
human checkout payments.
|
|
74
|
+
- **`genesispay.checkoutDocuments.get(publicId)`** retrieves one document; the
|
|
75
|
+
authenticated API also exposes `GET /api/v1/checkout-documents/:publicId/pdf`.
|
|
76
|
+
- Products and checkout requests expose explicit inclusive `taxConfig`; product
|
|
77
|
+
updates and `checkout.updateTax()` use `expectedTaxConfig` conflict detection.
|
|
78
|
+
- New manual invoices use inclusive per-line tax and produce an invoice/receipt
|
|
79
|
+
pair after real payment. Existing finalized documents stay immutable.
|
|
80
|
+
|
|
81
|
+
### Safety
|
|
82
|
+
|
|
83
|
+
- Checkout documents are read-only snapshots, not the manual
|
|
84
|
+
`genesispay.invoices.*` lifecycle. A missing `invoiceNumber` means an honest
|
|
85
|
+
enhanced receipt rather than a guessed or incomplete formal invoice.
|
|
86
|
+
- New standalone checkout requests are single-use; repeat purchases use products.
|
|
87
|
+
Legacy generic reusable links close after payment, preserving their history.
|
|
88
|
+
|
|
89
|
+
## 1.1.0 — durable fulfillment notifications (release candidate)
|
|
90
|
+
|
|
91
|
+
- Add typed `payment.fulfilled` notifications with strict envelope/evidence shape
|
|
92
|
+
checks after raw-body HMAC verification. Wire amounts remain strings;
|
|
93
|
+
authenticated `fulfillment.verify` is still required for economic authority.
|
|
94
|
+
- Add `fulfillment.listAttempts` with scoped, versioned keyset discovery for
|
|
95
|
+
missing-notification recovery. Historical candidates never authorize fulfillment.
|
|
96
|
+
- Document stable source event IDs, nine-send retry cycles, explicit replay and
|
|
97
|
+
attempt/intent-keyed atomic credit handling across webhook and reconciliation.
|
|
98
|
+
|
|
99
|
+
## 1.0.0 — strict fulfilment authority
|
|
100
|
+
|
|
101
|
+
Breaking authority contract. Existing tolerant checkout, product, entitlement,
|
|
102
|
+
and webhook views remain available for display, correlation, and migration, but
|
|
103
|
+
they are not proof that a seller may fulfil an order.
|
|
104
|
+
|
|
105
|
+
### Added
|
|
106
|
+
|
|
107
|
+
- `genesispay.fulfillment.verify({ locator, expected })`, the only public SDK
|
|
108
|
+
path that returns strict payment authority. It always retrieves evidence from
|
|
109
|
+
the seller-authenticated GenesisPay API; no public method accepts a
|
|
110
|
+
caller-created evidence object.
|
|
111
|
+
- Exact `ExpectedProductContract`, `ExpectedPaymentLinkContract`,
|
|
112
|
+
`FulfillmentLocator`, `FulfillmentVerification`, and `VerifiedPayment` types.
|
|
113
|
+
Money is `bigint` minor units in application code and bounded canonical
|
|
114
|
+
decimal strings on the wire.
|
|
115
|
+
- Explicit `GENESISPAY-Version: 2026-08-26` negotiation plus matching
|
|
116
|
+
`GENESISPAY-Request-Id` and version metadata on successful and negative
|
|
117
|
+
results.
|
|
118
|
+
- Typed `GenesisPayContractMismatchError`,
|
|
119
|
+
`GenesisPayAmbiguousLocatorError`, `GenesisPayEvidenceError`, and
|
|
120
|
+
`GenesisPayVersionError`. Every SDK error now exposes nullable `requestId` and
|
|
121
|
+
`apiVersion` properties; they are null only when no versioned response exists.
|
|
122
|
+
- `products.assertContract(expected)` and idempotent
|
|
123
|
+
`products.createCheckout({ expected, ... }, { idempotencyKey })`. The latter
|
|
124
|
+
returns an explicit `product_checkout_link` with `linkId`, never an ambiguous
|
|
125
|
+
checkout `id`.
|
|
126
|
+
- `createGateRequestFingerprint(request)` and the breaking
|
|
127
|
+
`products.gate(id).protect(request, expected, handler)` signature. A product
|
|
128
|
+
handler now receives only strictly verified payment/product fields.
|
|
129
|
+
|
|
130
|
+
### Safety
|
|
131
|
+
|
|
132
|
+
- Strict fee validation distinguishes a supported 100%-of-gross record-only
|
|
133
|
+
quote from an authorized deduction: the former preserves the full seller
|
|
134
|
+
payment; the latter must leave a positive seller amount. Quotes above gross
|
|
135
|
+
fail closed in both backend and SDK.
|
|
136
|
+
- The configured `expectedPayTo` pin also guards strict product contract checks,
|
|
137
|
+
checkout creation and gate protection, authenticated checkout retrieval, and
|
|
138
|
+
strict fulfillment verification. Missing/conflicting retrieved destinations
|
|
139
|
+
fail closed; a caller's expected contract cannot override the pin. Historical
|
|
140
|
+
reconciliation after wallet rotation uses a client pinned to the original
|
|
141
|
+
order destination. Clients without a pin retain their existing behavior.
|
|
142
|
+
- Strict `checkout.create` errors preserve request/version correlation from
|
|
143
|
+
response headers or body while retaining validation, rate-limit and other
|
|
144
|
+
typed HTTP errors, including interrupted or non-JSON error responses.
|
|
145
|
+
- MR-102/MR-103: mode, Base network, chain, asset, token address, and six-decimal
|
|
146
|
+
scale are cross-validated against the SDK's audited USDC/EURC deployment
|
|
147
|
+
registry before a result can be verified.
|
|
148
|
+
- MR-202: locator identity, exact gross amount, frozen destination, product/SKU,
|
|
149
|
+
and complete delivery or gate intent must match the expected immutable
|
|
150
|
+
contract. Contract mismatches throw and include the mismatched field paths.
|
|
151
|
+
- MR-804: verified evidence requires the literal `simulated: false` and the
|
|
152
|
+
supported authority provenance version. Historical evidence without that
|
|
153
|
+
provenance fails closed instead of inheriting a default.
|
|
154
|
+
- Known missing/null/wrong-typed fields, noncanonical or oversized money,
|
|
155
|
+
settlement arithmetic contradictions, unsafe/noncanonical URLs, unknown
|
|
156
|
+
payment channels, and unsupported versions fail closed. Unknown additive
|
|
157
|
+
fields remain forward compatible.
|
|
158
|
+
- Direct `checkout.create` now requires `{ idempotencyKey }` and sends both
|
|
159
|
+
`Idempotency-Key` and the strict API version. There is no idempotency-free
|
|
160
|
+
money-creation overload in 1.0.
|
|
161
|
+
- A product gate never defaults asset/chain or fabricates `simulated: false`.
|
|
162
|
+
Its initial challenge sends the complete validated expected contract for an
|
|
163
|
+
atomic pre-attempt comparison against the exact frozen payable link. Evidence
|
|
164
|
+
failure after settlement returns a `503` recovery response that preserves
|
|
165
|
+
a matching `PAYMENT-RESPONSE` and carries the attempt ID when one is known; permanent
|
|
166
|
+
inconsistencies are explicitly `retryable: false`.
|
|
167
|
+
- Signed gate recovery cross-checks attempt IDs in the request URL, payment
|
|
168
|
+
payload, settlement body, and settlement header. A post-commit transport loss
|
|
169
|
+
returns a retryable recovery response using that locator; a settlement that
|
|
170
|
+
names a different attempt than the signed one never reaches verification or
|
|
171
|
+
the paid handler and drops that other attempt's receipt. Both this case and
|
|
172
|
+
body/header contradictions report an unknown, retryable outcome.
|
|
173
|
+
- Interrupted verification response streams remain transient, while completed
|
|
174
|
+
malformed evidence stays permanent. Missing strict settlement metadata or a
|
|
175
|
+
negative `not_found`/`not_confirmed` verification never claims confirmation.
|
|
176
|
+
- Strict backend creation and gate calls reject a seller key whose mode does
|
|
177
|
+
not match the payment chain before exposing or settling that payment,
|
|
178
|
+
including product checkout idempotent replay.
|
|
179
|
+
- Confirmed gate retries can recover after their original authorization expires,
|
|
180
|
+
with signature and on-chain replay verification and no repeat broadcast/fee.
|
|
181
|
+
Failed/expired attempts remain terminal, including on archived links.
|
|
182
|
+
- Verified network contracts no longer expose the mutable shared asset registry.
|
|
183
|
+
URL-delivery examples use entitlement verification to honor revocation/expiry.
|
|
184
|
+
- Successful entitlement lookups must report a valid entitlement; payer-authorized
|
|
185
|
+
fees must leave a positive seller amount. Contradictory evidence is rejected.
|
|
186
|
+
- Conflicting recovery identities discard unrelated receipts on 503, other 5xx
|
|
187
|
+
and contradictory 2xx responses, while retaining the signed attempt locator.
|
|
188
|
+
- Frozen fee terms and the amount actually collected are deliberately separate:
|
|
189
|
+
a non-collecting payment may have nonzero configured fee terms with a zero
|
|
190
|
+
settled fee.
|
|
191
|
+
|
|
192
|
+
### Migration
|
|
193
|
+
|
|
194
|
+
Use webhook, browser-return, link, or entitlement identifiers only as locators.
|
|
195
|
+
Pass an immutable expected contract to `fulfillment.verify`, fulfil only on
|
|
196
|
+
`verified: true`, and alert on typed mismatch/evidence/version errors using their
|
|
197
|
+
request ID. Pin this major exactly until the matching strict backend is deployed.
|
|
198
|
+
|
|
3
199
|
## 0.13.2 — clean recovery package
|
|
4
200
|
|
|
5
201
|
No API or runtime behaviour change from `0.13.0`. This immutable patch release
|