@0to1pay/fulfillment-sdk 2.1.0 → 2.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/README.md
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
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.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npm install @0to1pay/server-sdk@2.
|
|
6
|
+
npm install @0to1pay/server-sdk@2.3.0 @0to1pay/fulfillment-sdk@2.3.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install ./0to1pay-server-sdk-2.
|
|
10
|
+
npm install ./0to1pay-server-sdk-2.3.0.tgz ./0to1pay-fulfillment-sdk-2.3.0.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')`.
|
|
@@ -244,6 +244,48 @@ paths:
|
|
|
244
244
|
$ref: '#/components/responses/Conflict'
|
|
245
245
|
'503':
|
|
246
246
|
$ref: '#/components/responses/Unavailable'
|
|
247
|
+
/billing/test-keys:
|
|
248
|
+
post:
|
|
249
|
+
operationId: issueTestBillingKey
|
|
250
|
+
summary: Issue a scoped Sandbox server key
|
|
251
|
+
tags: [Billing]
|
|
252
|
+
x-required-scope: billing:write
|
|
253
|
+
description: >-
|
|
254
|
+
Issue a test-only integration key without a paid subscription. A project may issue up to five
|
|
255
|
+
Sandbox keys per rolling 24 hours and hold up to five active Sandbox keys.
|
|
256
|
+
Keep the returned secret server-side. If the response is lost, retry with the same billing
|
|
257
|
+
credential and Idempotency-Key. Regular reads never expose the secret.
|
|
258
|
+
parameters:
|
|
259
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
260
|
+
requestBody:
|
|
261
|
+
required: true
|
|
262
|
+
content:
|
|
263
|
+
application/json:
|
|
264
|
+
schema:
|
|
265
|
+
$ref: '#/components/schemas/BillingKeyRequest'
|
|
266
|
+
responses:
|
|
267
|
+
'201':
|
|
268
|
+
description: Test-only server key.
|
|
269
|
+
content:
|
|
270
|
+
application/json:
|
|
271
|
+
schema:
|
|
272
|
+
$ref: '#/components/schemas/TestBillingKey'
|
|
273
|
+
'400':
|
|
274
|
+
$ref: '#/components/responses/BadRequest'
|
|
275
|
+
'401':
|
|
276
|
+
$ref: '#/components/responses/Unauthorized'
|
|
277
|
+
'403':
|
|
278
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
279
|
+
'409':
|
|
280
|
+
$ref: '#/components/responses/Conflict'
|
|
281
|
+
'429':
|
|
282
|
+
description: Sandbox key limit reached.
|
|
283
|
+
content:
|
|
284
|
+
application/json:
|
|
285
|
+
schema:
|
|
286
|
+
$ref: '#/components/schemas/Error'
|
|
287
|
+
'503':
|
|
288
|
+
$ref: '#/components/responses/Unavailable'
|
|
247
289
|
/chain/assets:
|
|
248
290
|
get:
|
|
249
291
|
operationId: listChainAssets
|
|
@@ -251,6 +293,7 @@ paths:
|
|
|
251
293
|
description: >
|
|
252
294
|
Live checkout supports Ethereum native USDC and USDT, TRON USDT, and Base native USDC.
|
|
253
295
|
Only configured networks in the caller's environment are returned.
|
|
296
|
+
Base Sepolia's test USDC can appear for Sandbox keys when the deployment enables it.
|
|
254
297
|
tags: [Connections]
|
|
255
298
|
x-required-scope: payments:read
|
|
256
299
|
responses:
|
|
@@ -448,6 +491,32 @@ paths:
|
|
|
448
491
|
$ref: '#/components/responses/RateLimited'
|
|
449
492
|
'503':
|
|
450
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'
|
|
451
520
|
/payments/{payment_id}/quotes:
|
|
452
521
|
parameters:
|
|
453
522
|
- $ref: '#/components/parameters/payment_id'
|
|
@@ -1639,7 +1708,7 @@ components:
|
|
|
1639
1708
|
pattern: '^0x[0-9a-fA-F]{64}$'
|
|
1640
1709
|
ChainSelectorId:
|
|
1641
1710
|
type: integer
|
|
1642
|
-
enum: [1, 999, 8453, 42161, 31337, 31338, 31339, 31340, 900001, 900002, 728126428, 900003]
|
|
1711
|
+
enum: [1, 999, 8453, 84532, 42161, 31337, 31338, 31339, 31340, 900001, 900002, 728126428, 900003]
|
|
1643
1712
|
description: EVM or TRON chain ID, or a local or Solana selector. Use network_id for the network reference.
|
|
1644
1713
|
ChainNetworkId:
|
|
1645
1714
|
type: string
|
|
@@ -1818,6 +1887,46 @@ components:
|
|
|
1818
1887
|
- scale
|
|
1819
1888
|
additionalProperties: false
|
|
1820
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.
|
|
1821
1930
|
NonNegativeMoney:
|
|
1822
1931
|
type: object
|
|
1823
1932
|
properties:
|
|
@@ -2780,6 +2889,16 @@ components:
|
|
|
2780
2889
|
$ref: '#/components/schemas/Environment'
|
|
2781
2890
|
required: [key_id, token, environment]
|
|
2782
2891
|
additionalProperties: false
|
|
2892
|
+
TestBillingKey:
|
|
2893
|
+
allOf:
|
|
2894
|
+
- $ref: '#/components/schemas/BillingKey'
|
|
2895
|
+
- type: object
|
|
2896
|
+
properties:
|
|
2897
|
+
environment:
|
|
2898
|
+
const: test
|
|
2899
|
+
token:
|
|
2900
|
+
type: string
|
|
2901
|
+
pattern: '^sp_test_[0-9a-f]{16}\.[A-Za-z0-9_-]{43}$'
|
|
2783
2902
|
ChainCheckoutSessionRef:
|
|
2784
2903
|
type: string
|
|
2785
2904
|
pattern: '^[A-Za-z0-9_-]{16,128}$'
|
|
@@ -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;
|
|
@@ -153,6 +153,26 @@ export interface paths {
|
|
|
153
153
|
patch?: never;
|
|
154
154
|
trace?: never;
|
|
155
155
|
};
|
|
156
|
+
"/billing/test-keys": {
|
|
157
|
+
parameters: {
|
|
158
|
+
query?: never;
|
|
159
|
+
header?: never;
|
|
160
|
+
path?: never;
|
|
161
|
+
cookie?: never;
|
|
162
|
+
};
|
|
163
|
+
get?: never;
|
|
164
|
+
put?: never;
|
|
165
|
+
/**
|
|
166
|
+
* Issue a scoped Sandbox server key
|
|
167
|
+
* @description Issue a test-only integration key without a paid subscription. A project may issue up to five Sandbox keys per rolling 24 hours and hold up to five active Sandbox keys. Keep the returned secret server-side. If the response is lost, retry with the same billing credential and Idempotency-Key. Regular reads never expose the secret.
|
|
168
|
+
*/
|
|
169
|
+
post: operations["issueTestBillingKey"];
|
|
170
|
+
delete?: never;
|
|
171
|
+
options?: never;
|
|
172
|
+
head?: never;
|
|
173
|
+
patch?: never;
|
|
174
|
+
trace?: never;
|
|
175
|
+
};
|
|
156
176
|
"/chain/assets": {
|
|
157
177
|
parameters: {
|
|
158
178
|
query?: never;
|
|
@@ -162,7 +182,7 @@ export interface paths {
|
|
|
162
182
|
};
|
|
163
183
|
/**
|
|
164
184
|
* List supported USDC and USDT deployments on configured networks
|
|
165
|
-
* @description Live checkout supports Ethereum native USDC and USDT, TRON USDT, and Base native USDC. Only configured networks in the caller's environment are returned.
|
|
185
|
+
* @description Live checkout supports Ethereum native USDC and USDT, TRON USDT, and Base native USDC. Only configured networks in the caller's environment are returned. Base Sepolia's test USDC can appear for Sandbox keys when the deployment enables it.
|
|
166
186
|
*/
|
|
167
187
|
get: operations["listChainAssets"];
|
|
168
188
|
put?: never;
|
|
@@ -252,6 +272,28 @@ export interface paths {
|
|
|
252
272
|
patch?: never;
|
|
253
273
|
trace?: never;
|
|
254
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
|
+
};
|
|
255
297
|
"/payments/{payment_id}/quotes": {
|
|
256
298
|
parameters: {
|
|
257
299
|
query?: never;
|
|
@@ -745,7 +787,7 @@ export interface components {
|
|
|
745
787
|
* @description EVM or TRON chain ID, or a local or Solana selector. Use network_id for the network reference.
|
|
746
788
|
* @enum {integer}
|
|
747
789
|
*/
|
|
748
|
-
ChainSelectorId: 1 | 999 | 8453 | 42161 | 31337 | 31338 | 31339 | 31340 | 900001 | 900002 | 728126428 | 900003;
|
|
790
|
+
ChainSelectorId: 1 | 999 | 8453 | 84532 | 42161 | 31337 | 31338 | 31339 | 31340 | 900001 | 900002 | 728126428 | 900003;
|
|
749
791
|
/** @description Decimal TRON identifiers are emitted. The hexadecimal TRON mainnet alias is accepted on connection creation. */
|
|
750
792
|
ChainNetworkId: string;
|
|
751
793
|
/** @enum {string} */
|
|
@@ -832,6 +874,30 @@ export interface components {
|
|
|
832
874
|
amount_atomic: string;
|
|
833
875
|
scale: number;
|
|
834
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
|
+
};
|
|
835
901
|
NonNegativeMoney: {
|
|
836
902
|
asset: string;
|
|
837
903
|
amount_atomic: string;
|
|
@@ -1184,6 +1250,11 @@ export interface components {
|
|
|
1184
1250
|
token: string;
|
|
1185
1251
|
environment: components["schemas"]["Environment"];
|
|
1186
1252
|
};
|
|
1253
|
+
TestBillingKey: components["schemas"]["BillingKey"] & {
|
|
1254
|
+
/** @constant */
|
|
1255
|
+
environment?: "test";
|
|
1256
|
+
token?: string;
|
|
1257
|
+
};
|
|
1187
1258
|
/** @description Stable opaque reference assigned by the merchant server to the authenticated buyer checkout. */
|
|
1188
1259
|
ChainCheckoutSessionRef: string;
|
|
1189
1260
|
/** @description Use a 0x-prefixed wallet signature. Encode raw Solana Ed25519 signature bytes as hex. */
|
|
@@ -1867,6 +1938,47 @@ export interface operations {
|
|
|
1867
1938
|
503: components["responses"]["Unavailable"];
|
|
1868
1939
|
};
|
|
1869
1940
|
};
|
|
1941
|
+
issueTestBillingKey: {
|
|
1942
|
+
parameters: {
|
|
1943
|
+
query?: never;
|
|
1944
|
+
header: {
|
|
1945
|
+
/** @description Stable per logical caller mutation, scoped to bound merchant/project/environment + operation. Same key with different canonical request -> 409. Claim responses dynamically revalidate validity. */
|
|
1946
|
+
"Idempotency-Key": components["parameters"]["IdempotencyKey"];
|
|
1947
|
+
};
|
|
1948
|
+
path?: never;
|
|
1949
|
+
cookie?: never;
|
|
1950
|
+
};
|
|
1951
|
+
requestBody: {
|
|
1952
|
+
content: {
|
|
1953
|
+
"application/json": components["schemas"]["BillingKeyRequest"];
|
|
1954
|
+
};
|
|
1955
|
+
};
|
|
1956
|
+
responses: {
|
|
1957
|
+
/** @description Test-only server key. */
|
|
1958
|
+
201: {
|
|
1959
|
+
headers: {
|
|
1960
|
+
[name: string]: unknown;
|
|
1961
|
+
};
|
|
1962
|
+
content: {
|
|
1963
|
+
"application/json": components["schemas"]["TestBillingKey"];
|
|
1964
|
+
};
|
|
1965
|
+
};
|
|
1966
|
+
400: components["responses"]["BadRequest"];
|
|
1967
|
+
401: components["responses"]["Unauthorized"];
|
|
1968
|
+
403: components["responses"]["BillingForbidden"];
|
|
1969
|
+
409: components["responses"]["Conflict"];
|
|
1970
|
+
/** @description Sandbox key limit reached. */
|
|
1971
|
+
429: {
|
|
1972
|
+
headers: {
|
|
1973
|
+
[name: string]: unknown;
|
|
1974
|
+
};
|
|
1975
|
+
content: {
|
|
1976
|
+
"application/json": components["schemas"]["Error"];
|
|
1977
|
+
};
|
|
1978
|
+
};
|
|
1979
|
+
503: components["responses"]["Unavailable"];
|
|
1980
|
+
};
|
|
1981
|
+
};
|
|
1870
1982
|
listChainAssets: {
|
|
1871
1983
|
parameters: {
|
|
1872
1984
|
query?: never;
|
|
@@ -2052,6 +2164,33 @@ export interface operations {
|
|
|
2052
2164
|
503: components["responses"]["Unavailable"];
|
|
2053
2165
|
};
|
|
2054
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
|
+
};
|
|
2055
2194
|
createQuote: {
|
|
2056
2195
|
parameters: {
|
|
2057
2196
|
query?: never;
|