@0to1pay/fulfillment-sdk 2.0.0 → 2.2.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
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# 0to1Pay Fulfillment SDK
|
|
2
2
|
|
|
3
|
-
Node.js 22.20.0 or newer and a merchant PostgreSQL database. Install 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 after publication or use the verified tarballs in your merchant backend.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npm install
|
|
6
|
+
npm install @0to1pay/server-sdk@2.2.0 @0to1pay/fulfillment-sdk@2.2.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Once the packages are published to npm, use their scoped names.
|
|
10
|
-
|
|
11
9
|
```sh
|
|
12
|
-
npm install
|
|
10
|
+
npm install ./0to1pay-server-sdk-2.2.0.tgz ./0to1pay-fulfillment-sdk-2.2.0.tgz
|
|
13
11
|
```
|
|
14
12
|
|
|
15
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')`.
|
|
@@ -21,11 +21,279 @@ tags:
|
|
|
21
21
|
- name: Webhooks
|
|
22
22
|
- name: Events
|
|
23
23
|
- name: Fulfillment
|
|
24
|
+
- name: Billing
|
|
24
25
|
paths:
|
|
26
|
+
/billing/plans:
|
|
27
|
+
get:
|
|
28
|
+
operationId: listBillingPlans
|
|
29
|
+
summary: List request plans and subscription prices
|
|
30
|
+
tags: [Billing]
|
|
31
|
+
x-required-scope: billing:read
|
|
32
|
+
description: >
|
|
33
|
+
Plan prices, included API requests, and configured USDC collection options with available recipients.
|
|
34
|
+
Live collection options use Ethereum or Base connections. Paid periods last 30 days.
|
|
35
|
+
responses:
|
|
36
|
+
'200':
|
|
37
|
+
description: Successful scoped billing response.
|
|
38
|
+
content:
|
|
39
|
+
application/json:
|
|
40
|
+
schema:
|
|
41
|
+
$ref: '#/components/schemas/BillingPlans'
|
|
42
|
+
'401':
|
|
43
|
+
$ref: '#/components/responses/Unauthorized'
|
|
44
|
+
'403':
|
|
45
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
46
|
+
'503':
|
|
47
|
+
$ref: '#/components/responses/Unavailable'
|
|
48
|
+
/billing/subscription:
|
|
49
|
+
get:
|
|
50
|
+
operationId: getBillingSubscription
|
|
51
|
+
summary: Read the scoped subscription and request usage
|
|
52
|
+
tags: [Billing]
|
|
53
|
+
x-required-scope: billing:read
|
|
54
|
+
description: Current prepaid period and admitted API requests. The test allowance follows UTC calendar months.
|
|
55
|
+
responses:
|
|
56
|
+
'200':
|
|
57
|
+
description: Successful scoped billing response.
|
|
58
|
+
content:
|
|
59
|
+
application/json:
|
|
60
|
+
schema:
|
|
61
|
+
$ref: '#/components/schemas/BillingSubscription'
|
|
62
|
+
'401':
|
|
63
|
+
$ref: '#/components/responses/Unauthorized'
|
|
64
|
+
'403':
|
|
65
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
66
|
+
'503':
|
|
67
|
+
$ref: '#/components/responses/Unavailable'
|
|
68
|
+
/billing/invoices:
|
|
69
|
+
get:
|
|
70
|
+
operationId: listBillingInvoices
|
|
71
|
+
summary: List recent subscription invoices to resume checkout or reconciliation
|
|
72
|
+
tags: [Billing]
|
|
73
|
+
x-required-scope: billing:read
|
|
74
|
+
description: Returns up to 20 invoices for the caller's project and current collection environment, newest first. Open, reconciling and scheduled invoices are retained ahead of older history.
|
|
75
|
+
responses:
|
|
76
|
+
'200':
|
|
77
|
+
description: Successful scoped billing response.
|
|
78
|
+
content:
|
|
79
|
+
application/json:
|
|
80
|
+
schema:
|
|
81
|
+
$ref: '#/components/schemas/BillingInvoiceList'
|
|
82
|
+
'401':
|
|
83
|
+
$ref: '#/components/responses/Unauthorized'
|
|
84
|
+
'403':
|
|
85
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
86
|
+
'503':
|
|
87
|
+
$ref: '#/components/responses/Unavailable'
|
|
88
|
+
post:
|
|
89
|
+
operationId: createBillingInvoice
|
|
90
|
+
summary: Create a USDC subscription invoice and payer challenge
|
|
91
|
+
tags: [Billing]
|
|
92
|
+
x-required-scope: billing:write
|
|
93
|
+
description: Select an offered USDC network with network_id, or omit it for the configured default. The server snapshots the selected plan terms and network.
|
|
94
|
+
parameters:
|
|
95
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
96
|
+
requestBody:
|
|
97
|
+
required: true
|
|
98
|
+
content:
|
|
99
|
+
application/json:
|
|
100
|
+
schema:
|
|
101
|
+
$ref: '#/components/schemas/CreateBillingInvoice'
|
|
102
|
+
responses:
|
|
103
|
+
'201':
|
|
104
|
+
description: Successful scoped billing response.
|
|
105
|
+
content:
|
|
106
|
+
application/json:
|
|
107
|
+
schema:
|
|
108
|
+
$ref: '#/components/schemas/BillingInvoice'
|
|
109
|
+
'400':
|
|
110
|
+
$ref: '#/components/responses/BadRequest'
|
|
111
|
+
'401':
|
|
112
|
+
$ref: '#/components/responses/Unauthorized'
|
|
113
|
+
'403':
|
|
114
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
115
|
+
'409':
|
|
116
|
+
$ref: '#/components/responses/BillingInvoiceConflict'
|
|
117
|
+
'503':
|
|
118
|
+
$ref: '#/components/responses/Unavailable'
|
|
119
|
+
/billing/invoices/{invoice_id}:
|
|
120
|
+
parameters:
|
|
121
|
+
- $ref: '#/components/parameters/invoice_id'
|
|
122
|
+
get:
|
|
123
|
+
operationId: getBillingInvoice
|
|
124
|
+
summary: Read the scoped subscription invoice
|
|
125
|
+
tags: [Billing]
|
|
126
|
+
x-required-scope: billing:read
|
|
127
|
+
description: Returns the invoice, frozen quote, wallet authorization message and entitlement state.
|
|
128
|
+
responses:
|
|
129
|
+
'200':
|
|
130
|
+
description: Successful scoped billing response.
|
|
131
|
+
content:
|
|
132
|
+
application/json:
|
|
133
|
+
schema:
|
|
134
|
+
$ref: '#/components/schemas/BillingInvoice'
|
|
135
|
+
'401':
|
|
136
|
+
$ref: '#/components/responses/Unauthorized'
|
|
137
|
+
'403':
|
|
138
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
139
|
+
'404':
|
|
140
|
+
$ref: '#/components/responses/NotFound'
|
|
141
|
+
'503':
|
|
142
|
+
$ref: '#/components/responses/Unavailable'
|
|
143
|
+
/billing/invoices/{invoice_id}/authorize:
|
|
144
|
+
parameters:
|
|
145
|
+
- $ref: '#/components/parameters/invoice_id'
|
|
146
|
+
post:
|
|
147
|
+
operationId: authorizeBillingInvoice
|
|
148
|
+
summary: Authorize the subscription invoice with the payer wallet
|
|
149
|
+
tags: [Billing]
|
|
150
|
+
x-required-scope: billing:write
|
|
151
|
+
description: Sign the exact invoice intent signing_message with the wallet that will pay.
|
|
152
|
+
parameters:
|
|
153
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
154
|
+
requestBody:
|
|
155
|
+
required: true
|
|
156
|
+
content:
|
|
157
|
+
application/json:
|
|
158
|
+
schema:
|
|
159
|
+
$ref: '#/components/schemas/AuthorizeChainIntent'
|
|
160
|
+
responses:
|
|
161
|
+
'200':
|
|
162
|
+
description: Successful scoped billing response.
|
|
163
|
+
content:
|
|
164
|
+
application/json:
|
|
165
|
+
schema:
|
|
166
|
+
$ref: '#/components/schemas/BillingInvoice'
|
|
167
|
+
'400':
|
|
168
|
+
$ref: '#/components/responses/BadRequest'
|
|
169
|
+
'401':
|
|
170
|
+
$ref: '#/components/responses/Unauthorized'
|
|
171
|
+
'403':
|
|
172
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
173
|
+
'404':
|
|
174
|
+
$ref: '#/components/responses/NotFound'
|
|
175
|
+
'409':
|
|
176
|
+
$ref: '#/components/responses/Conflict'
|
|
177
|
+
'503':
|
|
178
|
+
$ref: '#/components/responses/Unavailable'
|
|
179
|
+
/billing/invoices/{invoice_id}/submit:
|
|
180
|
+
parameters:
|
|
181
|
+
- $ref: '#/components/parameters/invoice_id'
|
|
182
|
+
post:
|
|
183
|
+
operationId: submitBillingInvoice
|
|
184
|
+
summary: Submit the signed subscription transaction claim
|
|
185
|
+
tags: [Billing]
|
|
186
|
+
x-required-scope: billing:write
|
|
187
|
+
description: Submit a second signature binding the claimed transaction ID to the authorization. The worker independently verifies the payment.
|
|
188
|
+
parameters:
|
|
189
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
190
|
+
requestBody:
|
|
191
|
+
required: true
|
|
192
|
+
content:
|
|
193
|
+
application/json:
|
|
194
|
+
schema:
|
|
195
|
+
$ref: '#/components/schemas/SubmitChainIntent'
|
|
196
|
+
responses:
|
|
197
|
+
'200':
|
|
198
|
+
description: Successful scoped billing response.
|
|
199
|
+
content:
|
|
200
|
+
application/json:
|
|
201
|
+
schema:
|
|
202
|
+
$ref: '#/components/schemas/BillingInvoice'
|
|
203
|
+
'400':
|
|
204
|
+
$ref: '#/components/responses/BadRequest'
|
|
205
|
+
'401':
|
|
206
|
+
$ref: '#/components/responses/Unauthorized'
|
|
207
|
+
'403':
|
|
208
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
209
|
+
'404':
|
|
210
|
+
$ref: '#/components/responses/NotFound'
|
|
211
|
+
'409':
|
|
212
|
+
$ref: '#/components/responses/Conflict'
|
|
213
|
+
'503':
|
|
214
|
+
$ref: '#/components/responses/Unavailable'
|
|
215
|
+
/billing/keys:
|
|
216
|
+
post:
|
|
217
|
+
operationId: issueBillingKey
|
|
218
|
+
summary: Issue a scoped server key for the active subscription
|
|
219
|
+
tags: [Billing]
|
|
220
|
+
x-required-scope: billing:write
|
|
221
|
+
description: Requires an active subscription. Keep the returned secret server-side and reuse the same idempotency key if the response is lost.
|
|
222
|
+
parameters:
|
|
223
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
224
|
+
requestBody:
|
|
225
|
+
required: true
|
|
226
|
+
content:
|
|
227
|
+
application/json:
|
|
228
|
+
schema:
|
|
229
|
+
$ref: '#/components/schemas/BillingKeyRequest'
|
|
230
|
+
responses:
|
|
231
|
+
'201':
|
|
232
|
+
description: Successful scoped billing response.
|
|
233
|
+
content:
|
|
234
|
+
application/json:
|
|
235
|
+
schema:
|
|
236
|
+
$ref: '#/components/schemas/BillingKey'
|
|
237
|
+
'400':
|
|
238
|
+
$ref: '#/components/responses/BadRequest'
|
|
239
|
+
'401':
|
|
240
|
+
$ref: '#/components/responses/Unauthorized'
|
|
241
|
+
'403':
|
|
242
|
+
$ref: '#/components/responses/BillingForbidden'
|
|
243
|
+
'409':
|
|
244
|
+
$ref: '#/components/responses/Conflict'
|
|
245
|
+
'503':
|
|
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'
|
|
25
289
|
/chain/assets:
|
|
26
290
|
get:
|
|
27
291
|
operationId: listChainAssets
|
|
28
292
|
summary: List supported USDC and USDT deployments on configured networks
|
|
293
|
+
description: >
|
|
294
|
+
Live checkout supports Ethereum native USDC and USDT, TRON USDT, and Base native USDC.
|
|
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.
|
|
29
297
|
tags: [Connections]
|
|
30
298
|
x-required-scope: payments:read
|
|
31
299
|
responses:
|
|
@@ -39,10 +307,13 @@ paths:
|
|
|
39
307
|
$ref: '#/components/responses/Unauthorized'
|
|
40
308
|
'403':
|
|
41
309
|
$ref: '#/components/responses/Forbidden'
|
|
310
|
+
'429':
|
|
311
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
42
312
|
/chain/connections:
|
|
43
313
|
post:
|
|
44
314
|
operationId: createChainConnection
|
|
45
315
|
summary: Create a watch-only chain connection for the scoped merchant
|
|
316
|
+
description: Select a network returned by listChainAssets for this environment.
|
|
46
317
|
tags: [Connections]
|
|
47
318
|
x-required-scope: connections:manage
|
|
48
319
|
parameters:
|
|
@@ -112,6 +383,7 @@ paths:
|
|
|
112
383
|
x-required-scope: payments:write
|
|
113
384
|
description: Same scoped order_ref/order_revision and identical specification returns the existing resource.
|
|
114
385
|
Changed snapshot requires explicit revision but retains the same business grant identity.
|
|
386
|
+
For new payments, every allowed connection must support the price denomination in listChainAssets.
|
|
115
387
|
parameters:
|
|
116
388
|
- $ref: '#/components/parameters/IdempotencyKey'
|
|
117
389
|
responses:
|
|
@@ -137,7 +409,7 @@ paths:
|
|
|
137
409
|
'409':
|
|
138
410
|
$ref: '#/components/responses/Conflict'
|
|
139
411
|
'429':
|
|
140
|
-
$ref: '#/components/responses/
|
|
412
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
141
413
|
'503':
|
|
142
414
|
$ref: '#/components/responses/Unavailable'
|
|
143
415
|
requestBody:
|
|
@@ -179,7 +451,7 @@ paths:
|
|
|
179
451
|
'409':
|
|
180
452
|
$ref: '#/components/responses/Conflict'
|
|
181
453
|
'429':
|
|
182
|
-
$ref: '#/components/responses/
|
|
454
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
183
455
|
'503':
|
|
184
456
|
$ref: '#/components/responses/Unavailable'
|
|
185
457
|
/payments/{payment_id}:
|
|
@@ -229,7 +501,7 @@ paths:
|
|
|
229
501
|
- Quotes
|
|
230
502
|
x-required-scope: payments:write
|
|
231
503
|
description: Reserve a unique recipient for the selected network and freeze the amount and token.
|
|
232
|
-
Quote expiry cannot exceed the payment expiry.
|
|
504
|
+
Quote expiry cannot exceed the payment expiry. New quotes use the selected network's matching asset from listChainAssets.
|
|
233
505
|
parameters:
|
|
234
506
|
- $ref: '#/components/parameters/IdempotencyKey'
|
|
235
507
|
responses:
|
|
@@ -255,7 +527,7 @@ paths:
|
|
|
255
527
|
'409':
|
|
256
528
|
$ref: '#/components/responses/Conflict'
|
|
257
529
|
'429':
|
|
258
|
-
$ref: '#/components/responses/
|
|
530
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
259
531
|
'503':
|
|
260
532
|
$ref: '#/components/responses/Unavailable'
|
|
261
533
|
requestBody:
|
|
@@ -453,8 +725,6 @@ paths:
|
|
|
453
725
|
$ref: '#/components/responses/NotFound'
|
|
454
726
|
'409':
|
|
455
727
|
$ref: '#/components/responses/Conflict'
|
|
456
|
-
'429':
|
|
457
|
-
$ref: '#/components/responses/RateLimited'
|
|
458
728
|
'503':
|
|
459
729
|
$ref: '#/components/responses/Unavailable'
|
|
460
730
|
requestBody:
|
|
@@ -496,7 +766,7 @@ paths:
|
|
|
496
766
|
'409':
|
|
497
767
|
$ref: '#/components/responses/Conflict'
|
|
498
768
|
'429':
|
|
499
|
-
$ref: '#/components/responses/
|
|
769
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
500
770
|
'503':
|
|
501
771
|
$ref: '#/components/responses/Unavailable'
|
|
502
772
|
/attempts/{attempt_id}:
|
|
@@ -759,7 +1029,7 @@ paths:
|
|
|
759
1029
|
'409':
|
|
760
1030
|
$ref: '#/components/responses/Conflict'
|
|
761
1031
|
'429':
|
|
762
|
-
$ref: '#/components/responses/
|
|
1032
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
763
1033
|
'503':
|
|
764
1034
|
$ref: '#/components/responses/Unavailable'
|
|
765
1035
|
/connections/{connection_id}:
|
|
@@ -796,7 +1066,7 @@ paths:
|
|
|
796
1066
|
'409':
|
|
797
1067
|
$ref: '#/components/responses/Conflict'
|
|
798
1068
|
'429':
|
|
799
|
-
$ref: '#/components/responses/
|
|
1069
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
800
1070
|
'503':
|
|
801
1071
|
$ref: '#/components/responses/Unavailable'
|
|
802
1072
|
/connections/{connection_id}/disable:
|
|
@@ -833,8 +1103,6 @@ paths:
|
|
|
833
1103
|
$ref: '#/components/responses/NotFound'
|
|
834
1104
|
'409':
|
|
835
1105
|
$ref: '#/components/responses/Conflict'
|
|
836
|
-
'429':
|
|
837
|
-
$ref: '#/components/responses/RateLimited'
|
|
838
1106
|
'503':
|
|
839
1107
|
$ref: '#/components/responses/Unavailable'
|
|
840
1108
|
requestBody:
|
|
@@ -877,8 +1145,6 @@ paths:
|
|
|
877
1145
|
$ref: '#/components/responses/NotFound'
|
|
878
1146
|
'409':
|
|
879
1147
|
$ref: '#/components/responses/Conflict'
|
|
880
|
-
'429':
|
|
881
|
-
$ref: '#/components/responses/RateLimited'
|
|
882
1148
|
'503':
|
|
883
1149
|
$ref: '#/components/responses/Unavailable'
|
|
884
1150
|
requestBody:
|
|
@@ -921,7 +1187,7 @@ paths:
|
|
|
921
1187
|
'409':
|
|
922
1188
|
$ref: '#/components/responses/Conflict'
|
|
923
1189
|
'429':
|
|
924
|
-
$ref: '#/components/responses/
|
|
1190
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
925
1191
|
'503':
|
|
926
1192
|
$ref: '#/components/responses/Unavailable'
|
|
927
1193
|
/webhook-endpoints/{endpoint_id}/rotate-secret:
|
|
@@ -959,8 +1225,6 @@ paths:
|
|
|
959
1225
|
$ref: '#/components/responses/NotFound'
|
|
960
1226
|
'409':
|
|
961
1227
|
$ref: '#/components/responses/Conflict'
|
|
962
|
-
'429':
|
|
963
|
-
$ref: '#/components/responses/RateLimited'
|
|
964
1228
|
'503':
|
|
965
1229
|
$ref: '#/components/responses/Unavailable'
|
|
966
1230
|
requestBody:
|
|
@@ -1004,7 +1268,7 @@ paths:
|
|
|
1004
1268
|
'409':
|
|
1005
1269
|
$ref: '#/components/responses/Conflict'
|
|
1006
1270
|
'429':
|
|
1007
|
-
$ref: '#/components/responses/
|
|
1271
|
+
$ref: '#/components/responses/RequestBudgetExhausted'
|
|
1008
1272
|
'503':
|
|
1009
1273
|
$ref: '#/components/responses/Unavailable'
|
|
1010
1274
|
/fulfillments/{command_id}:
|
|
@@ -1295,6 +1559,13 @@ components:
|
|
|
1295
1559
|
schema:
|
|
1296
1560
|
type: string
|
|
1297
1561
|
format: uuid
|
|
1562
|
+
invoice_id:
|
|
1563
|
+
name: invoice_id
|
|
1564
|
+
in: path
|
|
1565
|
+
required: true
|
|
1566
|
+
schema:
|
|
1567
|
+
type: string
|
|
1568
|
+
format: uuid
|
|
1298
1569
|
intent_id:
|
|
1299
1570
|
name: intent_id
|
|
1300
1571
|
in: path
|
|
@@ -1344,7 +1615,7 @@ components:
|
|
|
1344
1615
|
schema:
|
|
1345
1616
|
$ref: '#/components/schemas/Error'
|
|
1346
1617
|
Forbidden:
|
|
1347
|
-
description: Scope, environment, account or resource ownership denied.
|
|
1618
|
+
description: Scope, environment, account or resource ownership denied, or an active subscription is required.
|
|
1348
1619
|
content:
|
|
1349
1620
|
application/json:
|
|
1350
1621
|
schema:
|
|
@@ -1372,6 +1643,24 @@ components:
|
|
|
1372
1643
|
application/json:
|
|
1373
1644
|
schema:
|
|
1374
1645
|
$ref: '#/components/schemas/Error'
|
|
1646
|
+
BillingForbidden:
|
|
1647
|
+
description: BILLING_KEY_REQUIRED for a non-billing credential or SUBSCRIPTION_REQUIRED when key issuance requires an active paid period.
|
|
1648
|
+
content:
|
|
1649
|
+
application/json:
|
|
1650
|
+
schema:
|
|
1651
|
+
$ref: '#/components/schemas/Error'
|
|
1652
|
+
BillingInvoiceConflict:
|
|
1653
|
+
description: Idempotency payload mismatch, another pending or reconciling invoice (BILLING_INVOICE_IN_PROGRESS), an already scheduled renewal (BILLING_RENEWAL_SCHEDULED), or unavailable recipient capacity.
|
|
1654
|
+
content:
|
|
1655
|
+
application/json:
|
|
1656
|
+
schema:
|
|
1657
|
+
$ref: '#/components/schemas/Error'
|
|
1658
|
+
RequestBudgetExhausted:
|
|
1659
|
+
description: API_REQUEST_LIMIT_REACHED. The current request budget is exhausted.
|
|
1660
|
+
content:
|
|
1661
|
+
application/json:
|
|
1662
|
+
schema:
|
|
1663
|
+
$ref: '#/components/schemas/Error'
|
|
1375
1664
|
Unavailable:
|
|
1376
1665
|
description: Required service unavailable. An external mutation may still have executed; retain/poll operation
|
|
1377
1666
|
ID instead of creating a new payment.
|
|
@@ -1393,7 +1682,7 @@ components:
|
|
|
1393
1682
|
pattern: '^0x[0-9a-fA-F]{64}$'
|
|
1394
1683
|
ChainSelectorId:
|
|
1395
1684
|
type: integer
|
|
1396
|
-
enum: [1, 999, 8453, 42161, 31337, 31338, 31339, 31340, 900001, 900002, 728126428, 900003]
|
|
1685
|
+
enum: [1, 999, 8453, 84532, 42161, 31337, 31338, 31339, 31340, 900001, 900002, 728126428, 900003]
|
|
1397
1686
|
description: EVM or TRON chain ID, or a local or Solana selector. Use network_id for the network reference.
|
|
1398
1687
|
ChainNetworkId:
|
|
1399
1688
|
type: string
|
|
@@ -1413,7 +1702,7 @@ components:
|
|
|
1413
1702
|
ChainAssetRepresentation:
|
|
1414
1703
|
type: string
|
|
1415
1704
|
enum: [native, usdt0, standard_bridge, fixture]
|
|
1416
|
-
description: Token deployment type. USDT0
|
|
1705
|
+
description: Token deployment type. Historical quotes can include USDT0 or a Standard Bridge token. New live quotes use native tokens.
|
|
1417
1706
|
ChainAddress:
|
|
1418
1707
|
oneOf:
|
|
1419
1708
|
- $ref: '#/components/schemas/EvmAddress'
|
|
@@ -2378,6 +2667,172 @@ components:
|
|
|
2378
2667
|
- attempt
|
|
2379
2668
|
- operation
|
|
2380
2669
|
additionalProperties: false
|
|
2670
|
+
BillingPlanId:
|
|
2671
|
+
type: string
|
|
2672
|
+
enum: [sandbox, starter, growth, scale]
|
|
2673
|
+
PaidBillingPlanId:
|
|
2674
|
+
type: string
|
|
2675
|
+
enum: [starter, growth, scale]
|
|
2676
|
+
BillingPrice:
|
|
2677
|
+
type: object
|
|
2678
|
+
properties:
|
|
2679
|
+
asset:
|
|
2680
|
+
const: stable:USDC
|
|
2681
|
+
amount_atomic:
|
|
2682
|
+
type: string
|
|
2683
|
+
pattern: '^(0|[1-9][0-9]{0,19})$'
|
|
2684
|
+
scale:
|
|
2685
|
+
const: 6
|
|
2686
|
+
required: [asset, amount_atomic, scale]
|
|
2687
|
+
additionalProperties: false
|
|
2688
|
+
BillingPlan:
|
|
2689
|
+
type: object
|
|
2690
|
+
properties:
|
|
2691
|
+
plan_id:
|
|
2692
|
+
$ref: '#/components/schemas/BillingPlanId'
|
|
2693
|
+
environment:
|
|
2694
|
+
$ref: '#/components/schemas/Environment'
|
|
2695
|
+
price:
|
|
2696
|
+
$ref: '#/components/schemas/BillingPrice'
|
|
2697
|
+
request_limit:
|
|
2698
|
+
type: integer
|
|
2699
|
+
minimum: 1
|
|
2700
|
+
period_days:
|
|
2701
|
+
type: [integer, 'null']
|
|
2702
|
+
enum: [30, null]
|
|
2703
|
+
description: The free test plan uses UTC calendar months.
|
|
2704
|
+
required: [plan_id, environment, price, request_limit, period_days]
|
|
2705
|
+
additionalProperties: false
|
|
2706
|
+
BillingPlans:
|
|
2707
|
+
type: object
|
|
2708
|
+
properties:
|
|
2709
|
+
plans:
|
|
2710
|
+
type: array
|
|
2711
|
+
items:
|
|
2712
|
+
$ref: '#/components/schemas/BillingPlan'
|
|
2713
|
+
collection_options:
|
|
2714
|
+
type: array
|
|
2715
|
+
description: Currently offered USDC networks. Existing servers may omit this field.
|
|
2716
|
+
items:
|
|
2717
|
+
$ref: '#/components/schemas/BillingCollectionOption'
|
|
2718
|
+
required: [plans]
|
|
2719
|
+
additionalProperties: false
|
|
2720
|
+
BillingCollectionOption:
|
|
2721
|
+
type: object
|
|
2722
|
+
properties:
|
|
2723
|
+
network_id:
|
|
2724
|
+
$ref: '#/components/schemas/ChainNetworkId'
|
|
2725
|
+
network_name:
|
|
2726
|
+
type: string
|
|
2727
|
+
family:
|
|
2728
|
+
type: string
|
|
2729
|
+
enum: [evm, solana]
|
|
2730
|
+
is_default:
|
|
2731
|
+
type: boolean
|
|
2732
|
+
required: [network_id, network_name, family, is_default]
|
|
2733
|
+
additionalProperties: false
|
|
2734
|
+
BillingSubscription:
|
|
2735
|
+
type: object
|
|
2736
|
+
properties:
|
|
2737
|
+
environment:
|
|
2738
|
+
$ref: '#/components/schemas/Environment'
|
|
2739
|
+
status:
|
|
2740
|
+
type: string
|
|
2741
|
+
enum: [active, inactive]
|
|
2742
|
+
plan_id:
|
|
2743
|
+
anyOf:
|
|
2744
|
+
- $ref: '#/components/schemas/BillingPlanId'
|
|
2745
|
+
- type: 'null'
|
|
2746
|
+
period_start:
|
|
2747
|
+
type: [string, 'null']
|
|
2748
|
+
format: date-time
|
|
2749
|
+
period_end:
|
|
2750
|
+
type: [string, 'null']
|
|
2751
|
+
format: date-time
|
|
2752
|
+
request_limit:
|
|
2753
|
+
type: integer
|
|
2754
|
+
minimum: 0
|
|
2755
|
+
requests_used:
|
|
2756
|
+
type: integer
|
|
2757
|
+
minimum: 0
|
|
2758
|
+
required: [environment, status, plan_id, period_start, period_end, request_limit, requests_used]
|
|
2759
|
+
additionalProperties: false
|
|
2760
|
+
CreateBillingInvoice:
|
|
2761
|
+
type: object
|
|
2762
|
+
properties:
|
|
2763
|
+
plan_id:
|
|
2764
|
+
$ref: '#/components/schemas/PaidBillingPlanId'
|
|
2765
|
+
payer_address:
|
|
2766
|
+
$ref: '#/components/schemas/ChainAddress'
|
|
2767
|
+
checkout_session_ref:
|
|
2768
|
+
$ref: '#/components/schemas/ChainCheckoutSessionRef'
|
|
2769
|
+
network_id:
|
|
2770
|
+
$ref: '#/components/schemas/ChainNetworkId'
|
|
2771
|
+
description: USDC collection network offered in BillingPlans. The deployment's default connection is used when omitted.
|
|
2772
|
+
required: [plan_id, payer_address, checkout_session_ref]
|
|
2773
|
+
additionalProperties: false
|
|
2774
|
+
BillingInvoice:
|
|
2775
|
+
type: object
|
|
2776
|
+
properties:
|
|
2777
|
+
invoice_id:
|
|
2778
|
+
type: string
|
|
2779
|
+
format: uuid
|
|
2780
|
+
plan_id:
|
|
2781
|
+
$ref: '#/components/schemas/PaidBillingPlanId'
|
|
2782
|
+
environment:
|
|
2783
|
+
$ref: '#/components/schemas/Environment'
|
|
2784
|
+
status:
|
|
2785
|
+
type: string
|
|
2786
|
+
enum: [pending, reconciling, active, scheduled, expired, revoked]
|
|
2787
|
+
description: Reconciling means a wallet-authorized invoice still awaits final reconciliation after transaction submission or quote expiry. Resume that invoice and wait before paying another one.
|
|
2788
|
+
quote:
|
|
2789
|
+
$ref: '#/components/schemas/Quote'
|
|
2790
|
+
intent:
|
|
2791
|
+
$ref: '#/components/schemas/ChainIntent'
|
|
2792
|
+
period_start:
|
|
2793
|
+
type: [string, 'null']
|
|
2794
|
+
format: date-time
|
|
2795
|
+
period_end:
|
|
2796
|
+
type: [string, 'null']
|
|
2797
|
+
format: date-time
|
|
2798
|
+
required: [invoice_id, plan_id, environment, status, quote, intent, period_start, period_end]
|
|
2799
|
+
additionalProperties: false
|
|
2800
|
+
BillingInvoiceList:
|
|
2801
|
+
type: object
|
|
2802
|
+
properties:
|
|
2803
|
+
invoices:
|
|
2804
|
+
type: array
|
|
2805
|
+
maxItems: 20
|
|
2806
|
+
items:
|
|
2807
|
+
$ref: '#/components/schemas/BillingInvoice'
|
|
2808
|
+
required: [invoices]
|
|
2809
|
+
additionalProperties: false
|
|
2810
|
+
BillingKeyRequest:
|
|
2811
|
+
type: object
|
|
2812
|
+
additionalProperties: false
|
|
2813
|
+
BillingKey:
|
|
2814
|
+
type: object
|
|
2815
|
+
properties:
|
|
2816
|
+
key_id:
|
|
2817
|
+
type: string
|
|
2818
|
+
format: uuid
|
|
2819
|
+
token:
|
|
2820
|
+
type: string
|
|
2821
|
+
pattern: '^sp_(test|live)_[0-9a-f]{16}\.[A-Za-z0-9_-]{43}$'
|
|
2822
|
+
environment:
|
|
2823
|
+
$ref: '#/components/schemas/Environment'
|
|
2824
|
+
required: [key_id, token, environment]
|
|
2825
|
+
additionalProperties: false
|
|
2826
|
+
TestBillingKey:
|
|
2827
|
+
allOf:
|
|
2828
|
+
- $ref: '#/components/schemas/BillingKey'
|
|
2829
|
+
- type: object
|
|
2830
|
+
properties:
|
|
2831
|
+
environment:
|
|
2832
|
+
const: test
|
|
2833
|
+
token:
|
|
2834
|
+
type: string
|
|
2835
|
+
pattern: '^sp_test_[0-9a-f]{16}\.[A-Za-z0-9_-]{43}$'
|
|
2381
2836
|
ChainCheckoutSessionRef:
|
|
2382
2837
|
type: string
|
|
2383
2838
|
pattern: '^[A-Za-z0-9_-]{16,128}$'
|
|
@@ -14,6 +14,3 @@ export function validateSchema(name, data) {
|
|
|
14
14
|
throw new Error('Unknown OpenAPI schema ' + name);
|
|
15
15
|
return schema(data) ? undefined : ajv.errorsText(schema.errors);
|
|
16
16
|
}
|
|
17
|
-
export function check(ref, data) {
|
|
18
|
-
return ref?.$ref ? validateSchema(ref.$ref.split('/').at(-1), data) : undefined;
|
|
19
|
-
}
|