@0to1pay/fulfillment-sdk 2.2.0 → 2.3.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.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # 0to1Pay Fulfillment SDK
2
2
 
3
- Node.js 22.20.0 or newer and a merchant PostgreSQL database. Install the SDKs from npm after publication or use the verified tarballs in your merchant backend.
3
+ Node.js 22.20.0 or newer and a merchant PostgreSQL database. Install the SDKs from npm or use the verified tarballs in your merchant backend.
4
4
 
5
5
  ```sh
6
- npm install @0to1pay/server-sdk@2.2.0 @0to1pay/fulfillment-sdk@2.2.0
6
+ npm install @0to1pay/server-sdk@2.3.1 @0to1pay/fulfillment-sdk@2.3.1
7
7
  ```
8
8
 
9
9
  ```sh
10
- npm install ./0to1pay-server-sdk-2.2.0.tgz ./0to1pay-fulfillment-sdk-2.2.0.tgz
10
+ npm install ./0to1pay-server-sdk-2.3.1.tgz ./0to1pay-fulfillment-sdk-2.3.1.tgz
11
11
  ```
12
12
 
13
13
  1. Register an HTTPS webhook endpoint for `fulfillment.requested`. Save the returned signing key ID and base64url secret in your backend's secret store. Configure `FulfillmentInbox` with the merchant ID, project ID and environment of the same project, and decode the signing secret with `Buffer.from(secret, 'base64url')`.
@@ -16,6 +16,6 @@ npm install ./0to1pay-server-sdk-2.2.0.tgz ./0to1pay-fulfillment-sdk-2.2.0.tgz
16
16
 
17
17
  Apply each command at most once and keep entitlements for distinct orders independent. Return `unknown` when an external product update has an uncertain outcome, then reconcile that update before repeating it.
18
18
 
19
- For direct USDC and USDT orders, the platform emits fulfillment commands after it verifies the buyer-approved transfer or records an authorized review. Integrate the [server SDK checkout steps](../server-sdk/README.md#buyer-approval-for-on-chain-checkout) before offering checkout. The signed event format, command semantics, and merchant inbox migration stay compatible with earlier fulfillment SDKs.
19
+ For direct USDC and USDT orders, the platform emits fulfillment commands after it verifies the buyer-approved transfer or records an authorized review. Integrate the [buyer approval steps in the public server SDK guide](https://www.npmjs.com/package/@0to1pay/server-sdk#buyer-approval-for-on-chain-checkout) before offering checkout. The signed event format, command semantics, and merchant inbox migration stay compatible with earlier fulfillment SDKs.
20
20
 
21
21
  The SDK is available under the MIT license. See the `LICENSE` file included in the package.
@@ -491,6 +491,32 @@ paths:
491
491
  $ref: '#/components/responses/RateLimited'
492
492
  '503':
493
493
  $ref: '#/components/responses/Unavailable'
494
+ /payments/{payment_id}/receipt:
495
+ parameters:
496
+ - $ref: '#/components/parameters/payment_id'
497
+ get:
498
+ operationId: getPaymentReceipt
499
+ summary: Read the confirmed funds received for a payment
500
+ tags: [Payments]
501
+ x-required-scope: payments:read
502
+ description: Returns current finalized on-chain funds linked to this payment's bound quote recipients, grouped by exact token and network. Confirmed reversals, refunds, and dispute adjustments are deducted. These are deposits to the order's recipients and do not establish payer identity or eligibility for fulfillment. Historical payments without canonical receipt data are reported as unavailable.
503
+ responses:
504
+ '200':
505
+ description: Successful scoped receipt response.
506
+ content:
507
+ application/json:
508
+ schema:
509
+ $ref: '#/components/schemas/PaymentReceipt'
510
+ '400':
511
+ $ref: '#/components/responses/BadRequest'
512
+ '401':
513
+ $ref: '#/components/responses/Unauthorized'
514
+ '403':
515
+ $ref: '#/components/responses/Forbidden'
516
+ '404':
517
+ $ref: '#/components/responses/NotFound'
518
+ '503':
519
+ $ref: '#/components/responses/Unavailable'
494
520
  /payments/{payment_id}/quotes:
495
521
  parameters:
496
522
  - $ref: '#/components/parameters/payment_id'
@@ -1861,6 +1887,46 @@ components:
1861
1887
  - scale
1862
1888
  additionalProperties: false
1863
1889
  description: The asset registry confirms scale. USDC 10.00 is amount_atomic="10000000", scale=6.
1890
+ PaymentReceipt:
1891
+ type: object
1892
+ required: [payment_id, availability, confirmed_received]
1893
+ additionalProperties: false
1894
+ properties:
1895
+ payment_id: { type: string, format: uuid }
1896
+ availability:
1897
+ type: string
1898
+ enum: [available, unavailable]
1899
+ description: Available allows an empty array when no current finalized deposit remains.
1900
+ confirmed_received:
1901
+ type: array
1902
+ items:
1903
+ $ref: '#/components/schemas/ConfirmedReceiptTotal'
1904
+ ConfirmedReceiptTotal:
1905
+ type: object
1906
+ required: [asset, amount_atomic, scale, symbol, network_id, network_name, last_confirmed_at]
1907
+ additionalProperties: false
1908
+ properties:
1909
+ asset:
1910
+ type: string
1911
+ minLength: 1
1912
+ maxLength: 160
1913
+ amount_atomic:
1914
+ type: string
1915
+ description: Positive sum of finalized deposits, in the asset minor unit.
1916
+ pattern: ^[1-9][0-9]*$
1917
+ scale: { type: integer, minimum: 0, maximum: 36 }
1918
+ symbol:
1919
+ type: [string, 'null']
1920
+ network_id:
1921
+ anyOf:
1922
+ - $ref: '#/components/schemas/ChainNetworkId'
1923
+ - type: 'null'
1924
+ network_name:
1925
+ type: [string, 'null']
1926
+ last_confirmed_at:
1927
+ type: [string, 'null']
1928
+ format: date-time
1929
+ description: Canonical chain timestamp of the latest included deposit.
1864
1930
  NonNegativeMoney:
1865
1931
  type: object
1866
1932
  properties:
@@ -108,6 +108,11 @@ export declare class ZeroToOnePayClient {
108
108
  updated_at: string;
109
109
  resource_version: number;
110
110
  }>;
111
+ getPaymentReceipt(payment_id: string): Promise<{
112
+ payment_id: string;
113
+ availability: "available" | "unavailable";
114
+ confirmed_received: components["schemas"]["ConfirmedReceiptTotal"][];
115
+ }>;
111
116
  createQuote(payment_id: string, body: Schema<'CreateQuote'>, idempotencyKey: string): Promise<{
112
117
  merchant_id: string;
113
118
  project_id: string;
@@ -272,6 +272,28 @@ export interface paths {
272
272
  patch?: never;
273
273
  trace?: never;
274
274
  };
275
+ "/payments/{payment_id}/receipt": {
276
+ parameters: {
277
+ query?: never;
278
+ header?: never;
279
+ path: {
280
+ payment_id: components["parameters"]["payment_id"];
281
+ };
282
+ cookie?: never;
283
+ };
284
+ /**
285
+ * Read the confirmed funds received for a payment
286
+ * @description Returns current finalized on-chain funds linked to this payment's bound quote recipients, grouped by exact token and network. Confirmed reversals, refunds, and dispute adjustments are deducted. These are deposits to the order's recipients and do not establish payer identity or eligibility for fulfillment. Historical payments without canonical receipt data are reported as unavailable.
287
+ */
288
+ get: operations["getPaymentReceipt"];
289
+ put?: never;
290
+ post?: never;
291
+ delete?: never;
292
+ options?: never;
293
+ head?: never;
294
+ patch?: never;
295
+ trace?: never;
296
+ };
275
297
  "/payments/{payment_id}/quotes": {
276
298
  parameters: {
277
299
  query?: never;
@@ -852,6 +874,30 @@ export interface components {
852
874
  amount_atomic: string;
853
875
  scale: number;
854
876
  };
877
+ PaymentReceipt: {
878
+ /** Format: uuid */
879
+ payment_id: string;
880
+ /**
881
+ * @description Available allows an empty array when no current finalized deposit remains.
882
+ * @enum {string}
883
+ */
884
+ availability: "available" | "unavailable";
885
+ confirmed_received: components["schemas"]["ConfirmedReceiptTotal"][];
886
+ };
887
+ ConfirmedReceiptTotal: {
888
+ asset: string;
889
+ /** @description Positive sum of finalized deposits, in the asset minor unit. */
890
+ amount_atomic: string;
891
+ scale: number;
892
+ symbol: string | null;
893
+ network_id: components["schemas"]["ChainNetworkId"] | null;
894
+ network_name: string | null;
895
+ /**
896
+ * Format: date-time
897
+ * @description Canonical chain timestamp of the latest included deposit.
898
+ */
899
+ last_confirmed_at: string | null;
900
+ };
855
901
  NonNegativeMoney: {
856
902
  asset: string;
857
903
  amount_atomic: string;
@@ -2118,6 +2164,33 @@ export interface operations {
2118
2164
  503: components["responses"]["Unavailable"];
2119
2165
  };
2120
2166
  };
2167
+ getPaymentReceipt: {
2168
+ parameters: {
2169
+ query?: never;
2170
+ header?: never;
2171
+ path: {
2172
+ payment_id: components["parameters"]["payment_id"];
2173
+ };
2174
+ cookie?: never;
2175
+ };
2176
+ requestBody?: never;
2177
+ responses: {
2178
+ /** @description Successful scoped receipt response. */
2179
+ 200: {
2180
+ headers: {
2181
+ [name: string]: unknown;
2182
+ };
2183
+ content: {
2184
+ "application/json": components["schemas"]["PaymentReceipt"];
2185
+ };
2186
+ };
2187
+ 400: components["responses"]["BadRequest"];
2188
+ 401: components["responses"]["Unauthorized"];
2189
+ 403: components["responses"]["Forbidden"];
2190
+ 404: components["responses"]["NotFound"];
2191
+ 503: components["responses"]["Unavailable"];
2192
+ };
2193
+ };
2121
2194
  createQuote: {
2122
2195
  parameters: {
2123
2196
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0to1pay/fulfillment-sdk",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "0to1Pay signed webhook receiver and PostgreSQL fulfillment worker",