@0to1pay/fulfillment-sdk 2.0.0 → 2.1.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 ./0to1pay-server-sdk-2.0.0.tgz ./0to1pay-fulfillment-sdk-2.0.0.tgz
6
+ npm install @0to1pay/server-sdk@2.1.0 @0to1pay/fulfillment-sdk@2.1.0
7
7
  ```
8
8
 
9
- Once the packages are published to npm, use their scoped names.
10
-
11
9
  ```sh
12
- npm install @0to1pay/server-sdk@2.0.0 @0to1pay/fulfillment-sdk@2.0.0
10
+ npm install ./0to1pay-server-sdk-2.1.0.tgz ./0to1pay-fulfillment-sdk-2.1.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,236 @@ 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'
25
247
  /chain/assets:
26
248
  get:
27
249
  operationId: listChainAssets
28
250
  summary: List supported USDC and USDT deployments on configured networks
251
+ description: >
252
+ Live checkout supports Ethereum native USDC and USDT, TRON USDT, and Base native USDC.
253
+ Only configured networks in the caller's environment are returned.
29
254
  tags: [Connections]
30
255
  x-required-scope: payments:read
31
256
  responses:
@@ -39,10 +264,13 @@ paths:
39
264
  $ref: '#/components/responses/Unauthorized'
40
265
  '403':
41
266
  $ref: '#/components/responses/Forbidden'
267
+ '429':
268
+ $ref: '#/components/responses/RequestBudgetExhausted'
42
269
  /chain/connections:
43
270
  post:
44
271
  operationId: createChainConnection
45
272
  summary: Create a watch-only chain connection for the scoped merchant
273
+ description: Select a network returned by listChainAssets for this environment.
46
274
  tags: [Connections]
47
275
  x-required-scope: connections:manage
48
276
  parameters:
@@ -112,6 +340,7 @@ paths:
112
340
  x-required-scope: payments:write
113
341
  description: Same scoped order_ref/order_revision and identical specification returns the existing resource.
114
342
  Changed snapshot requires explicit revision but retains the same business grant identity.
343
+ For new payments, every allowed connection must support the price denomination in listChainAssets.
115
344
  parameters:
116
345
  - $ref: '#/components/parameters/IdempotencyKey'
117
346
  responses:
@@ -137,7 +366,7 @@ paths:
137
366
  '409':
138
367
  $ref: '#/components/responses/Conflict'
139
368
  '429':
140
- $ref: '#/components/responses/RateLimited'
369
+ $ref: '#/components/responses/RequestBudgetExhausted'
141
370
  '503':
142
371
  $ref: '#/components/responses/Unavailable'
143
372
  requestBody:
@@ -179,7 +408,7 @@ paths:
179
408
  '409':
180
409
  $ref: '#/components/responses/Conflict'
181
410
  '429':
182
- $ref: '#/components/responses/RateLimited'
411
+ $ref: '#/components/responses/RequestBudgetExhausted'
183
412
  '503':
184
413
  $ref: '#/components/responses/Unavailable'
185
414
  /payments/{payment_id}:
@@ -229,7 +458,7 @@ paths:
229
458
  - Quotes
230
459
  x-required-scope: payments:write
231
460
  description: Reserve a unique recipient for the selected network and freeze the amount and token.
232
- Quote expiry cannot exceed the payment expiry.
461
+ Quote expiry cannot exceed the payment expiry. New quotes use the selected network's matching asset from listChainAssets.
233
462
  parameters:
234
463
  - $ref: '#/components/parameters/IdempotencyKey'
235
464
  responses:
@@ -255,7 +484,7 @@ paths:
255
484
  '409':
256
485
  $ref: '#/components/responses/Conflict'
257
486
  '429':
258
- $ref: '#/components/responses/RateLimited'
487
+ $ref: '#/components/responses/RequestBudgetExhausted'
259
488
  '503':
260
489
  $ref: '#/components/responses/Unavailable'
261
490
  requestBody:
@@ -453,8 +682,6 @@ paths:
453
682
  $ref: '#/components/responses/NotFound'
454
683
  '409':
455
684
  $ref: '#/components/responses/Conflict'
456
- '429':
457
- $ref: '#/components/responses/RateLimited'
458
685
  '503':
459
686
  $ref: '#/components/responses/Unavailable'
460
687
  requestBody:
@@ -496,7 +723,7 @@ paths:
496
723
  '409':
497
724
  $ref: '#/components/responses/Conflict'
498
725
  '429':
499
- $ref: '#/components/responses/RateLimited'
726
+ $ref: '#/components/responses/RequestBudgetExhausted'
500
727
  '503':
501
728
  $ref: '#/components/responses/Unavailable'
502
729
  /attempts/{attempt_id}:
@@ -759,7 +986,7 @@ paths:
759
986
  '409':
760
987
  $ref: '#/components/responses/Conflict'
761
988
  '429':
762
- $ref: '#/components/responses/RateLimited'
989
+ $ref: '#/components/responses/RequestBudgetExhausted'
763
990
  '503':
764
991
  $ref: '#/components/responses/Unavailable'
765
992
  /connections/{connection_id}:
@@ -796,7 +1023,7 @@ paths:
796
1023
  '409':
797
1024
  $ref: '#/components/responses/Conflict'
798
1025
  '429':
799
- $ref: '#/components/responses/RateLimited'
1026
+ $ref: '#/components/responses/RequestBudgetExhausted'
800
1027
  '503':
801
1028
  $ref: '#/components/responses/Unavailable'
802
1029
  /connections/{connection_id}/disable:
@@ -833,8 +1060,6 @@ paths:
833
1060
  $ref: '#/components/responses/NotFound'
834
1061
  '409':
835
1062
  $ref: '#/components/responses/Conflict'
836
- '429':
837
- $ref: '#/components/responses/RateLimited'
838
1063
  '503':
839
1064
  $ref: '#/components/responses/Unavailable'
840
1065
  requestBody:
@@ -877,8 +1102,6 @@ paths:
877
1102
  $ref: '#/components/responses/NotFound'
878
1103
  '409':
879
1104
  $ref: '#/components/responses/Conflict'
880
- '429':
881
- $ref: '#/components/responses/RateLimited'
882
1105
  '503':
883
1106
  $ref: '#/components/responses/Unavailable'
884
1107
  requestBody:
@@ -921,7 +1144,7 @@ paths:
921
1144
  '409':
922
1145
  $ref: '#/components/responses/Conflict'
923
1146
  '429':
924
- $ref: '#/components/responses/RateLimited'
1147
+ $ref: '#/components/responses/RequestBudgetExhausted'
925
1148
  '503':
926
1149
  $ref: '#/components/responses/Unavailable'
927
1150
  /webhook-endpoints/{endpoint_id}/rotate-secret:
@@ -959,8 +1182,6 @@ paths:
959
1182
  $ref: '#/components/responses/NotFound'
960
1183
  '409':
961
1184
  $ref: '#/components/responses/Conflict'
962
- '429':
963
- $ref: '#/components/responses/RateLimited'
964
1185
  '503':
965
1186
  $ref: '#/components/responses/Unavailable'
966
1187
  requestBody:
@@ -1004,7 +1225,7 @@ paths:
1004
1225
  '409':
1005
1226
  $ref: '#/components/responses/Conflict'
1006
1227
  '429':
1007
- $ref: '#/components/responses/RateLimited'
1228
+ $ref: '#/components/responses/RequestBudgetExhausted'
1008
1229
  '503':
1009
1230
  $ref: '#/components/responses/Unavailable'
1010
1231
  /fulfillments/{command_id}:
@@ -1295,6 +1516,13 @@ components:
1295
1516
  schema:
1296
1517
  type: string
1297
1518
  format: uuid
1519
+ invoice_id:
1520
+ name: invoice_id
1521
+ in: path
1522
+ required: true
1523
+ schema:
1524
+ type: string
1525
+ format: uuid
1298
1526
  intent_id:
1299
1527
  name: intent_id
1300
1528
  in: path
@@ -1344,7 +1572,7 @@ components:
1344
1572
  schema:
1345
1573
  $ref: '#/components/schemas/Error'
1346
1574
  Forbidden:
1347
- description: Scope, environment, account or resource ownership denied.
1575
+ description: Scope, environment, account or resource ownership denied, or an active subscription is required.
1348
1576
  content:
1349
1577
  application/json:
1350
1578
  schema:
@@ -1372,6 +1600,24 @@ components:
1372
1600
  application/json:
1373
1601
  schema:
1374
1602
  $ref: '#/components/schemas/Error'
1603
+ BillingForbidden:
1604
+ description: BILLING_KEY_REQUIRED for a non-billing credential or SUBSCRIPTION_REQUIRED when key issuance requires an active paid period.
1605
+ content:
1606
+ application/json:
1607
+ schema:
1608
+ $ref: '#/components/schemas/Error'
1609
+ BillingInvoiceConflict:
1610
+ description: Idempotency payload mismatch, another pending or reconciling invoice (BILLING_INVOICE_IN_PROGRESS), an already scheduled renewal (BILLING_RENEWAL_SCHEDULED), or unavailable recipient capacity.
1611
+ content:
1612
+ application/json:
1613
+ schema:
1614
+ $ref: '#/components/schemas/Error'
1615
+ RequestBudgetExhausted:
1616
+ description: API_REQUEST_LIMIT_REACHED. The current request budget is exhausted.
1617
+ content:
1618
+ application/json:
1619
+ schema:
1620
+ $ref: '#/components/schemas/Error'
1375
1621
  Unavailable:
1376
1622
  description: Required service unavailable. An external mutation may still have executed; retain/poll operation
1377
1623
  ID instead of creating a new payment.
@@ -1413,7 +1659,7 @@ components:
1413
1659
  ChainAssetRepresentation:
1414
1660
  type: string
1415
1661
  enum: [native, usdt0, standard_bridge, fixture]
1416
- description: Token deployment type. USDT0 and the registered Standard Bridge token settle stable:USDT quotes on their respective networks.
1662
+ description: Token deployment type. Historical quotes can include USDT0 or a Standard Bridge token. New live quotes use native tokens.
1417
1663
  ChainAddress:
1418
1664
  oneOf:
1419
1665
  - $ref: '#/components/schemas/EvmAddress'
@@ -2378,6 +2624,162 @@ components:
2378
2624
  - attempt
2379
2625
  - operation
2380
2626
  additionalProperties: false
2627
+ BillingPlanId:
2628
+ type: string
2629
+ enum: [sandbox, starter, growth, scale]
2630
+ PaidBillingPlanId:
2631
+ type: string
2632
+ enum: [starter, growth, scale]
2633
+ BillingPrice:
2634
+ type: object
2635
+ properties:
2636
+ asset:
2637
+ const: stable:USDC
2638
+ amount_atomic:
2639
+ type: string
2640
+ pattern: '^(0|[1-9][0-9]{0,19})$'
2641
+ scale:
2642
+ const: 6
2643
+ required: [asset, amount_atomic, scale]
2644
+ additionalProperties: false
2645
+ BillingPlan:
2646
+ type: object
2647
+ properties:
2648
+ plan_id:
2649
+ $ref: '#/components/schemas/BillingPlanId'
2650
+ environment:
2651
+ $ref: '#/components/schemas/Environment'
2652
+ price:
2653
+ $ref: '#/components/schemas/BillingPrice'
2654
+ request_limit:
2655
+ type: integer
2656
+ minimum: 1
2657
+ period_days:
2658
+ type: [integer, 'null']
2659
+ enum: [30, null]
2660
+ description: The free test plan uses UTC calendar months.
2661
+ required: [plan_id, environment, price, request_limit, period_days]
2662
+ additionalProperties: false
2663
+ BillingPlans:
2664
+ type: object
2665
+ properties:
2666
+ plans:
2667
+ type: array
2668
+ items:
2669
+ $ref: '#/components/schemas/BillingPlan'
2670
+ collection_options:
2671
+ type: array
2672
+ description: Currently offered USDC networks. Existing servers may omit this field.
2673
+ items:
2674
+ $ref: '#/components/schemas/BillingCollectionOption'
2675
+ required: [plans]
2676
+ additionalProperties: false
2677
+ BillingCollectionOption:
2678
+ type: object
2679
+ properties:
2680
+ network_id:
2681
+ $ref: '#/components/schemas/ChainNetworkId'
2682
+ network_name:
2683
+ type: string
2684
+ family:
2685
+ type: string
2686
+ enum: [evm, solana]
2687
+ is_default:
2688
+ type: boolean
2689
+ required: [network_id, network_name, family, is_default]
2690
+ additionalProperties: false
2691
+ BillingSubscription:
2692
+ type: object
2693
+ properties:
2694
+ environment:
2695
+ $ref: '#/components/schemas/Environment'
2696
+ status:
2697
+ type: string
2698
+ enum: [active, inactive]
2699
+ plan_id:
2700
+ anyOf:
2701
+ - $ref: '#/components/schemas/BillingPlanId'
2702
+ - type: 'null'
2703
+ period_start:
2704
+ type: [string, 'null']
2705
+ format: date-time
2706
+ period_end:
2707
+ type: [string, 'null']
2708
+ format: date-time
2709
+ request_limit:
2710
+ type: integer
2711
+ minimum: 0
2712
+ requests_used:
2713
+ type: integer
2714
+ minimum: 0
2715
+ required: [environment, status, plan_id, period_start, period_end, request_limit, requests_used]
2716
+ additionalProperties: false
2717
+ CreateBillingInvoice:
2718
+ type: object
2719
+ properties:
2720
+ plan_id:
2721
+ $ref: '#/components/schemas/PaidBillingPlanId'
2722
+ payer_address:
2723
+ $ref: '#/components/schemas/ChainAddress'
2724
+ checkout_session_ref:
2725
+ $ref: '#/components/schemas/ChainCheckoutSessionRef'
2726
+ network_id:
2727
+ $ref: '#/components/schemas/ChainNetworkId'
2728
+ description: USDC collection network offered in BillingPlans. The deployment's default connection is used when omitted.
2729
+ required: [plan_id, payer_address, checkout_session_ref]
2730
+ additionalProperties: false
2731
+ BillingInvoice:
2732
+ type: object
2733
+ properties:
2734
+ invoice_id:
2735
+ type: string
2736
+ format: uuid
2737
+ plan_id:
2738
+ $ref: '#/components/schemas/PaidBillingPlanId'
2739
+ environment:
2740
+ $ref: '#/components/schemas/Environment'
2741
+ status:
2742
+ type: string
2743
+ enum: [pending, reconciling, active, scheduled, expired, revoked]
2744
+ 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.
2745
+ quote:
2746
+ $ref: '#/components/schemas/Quote'
2747
+ intent:
2748
+ $ref: '#/components/schemas/ChainIntent'
2749
+ period_start:
2750
+ type: [string, 'null']
2751
+ format: date-time
2752
+ period_end:
2753
+ type: [string, 'null']
2754
+ format: date-time
2755
+ required: [invoice_id, plan_id, environment, status, quote, intent, period_start, period_end]
2756
+ additionalProperties: false
2757
+ BillingInvoiceList:
2758
+ type: object
2759
+ properties:
2760
+ invoices:
2761
+ type: array
2762
+ maxItems: 20
2763
+ items:
2764
+ $ref: '#/components/schemas/BillingInvoice'
2765
+ required: [invoices]
2766
+ additionalProperties: false
2767
+ BillingKeyRequest:
2768
+ type: object
2769
+ additionalProperties: false
2770
+ BillingKey:
2771
+ type: object
2772
+ properties:
2773
+ key_id:
2774
+ type: string
2775
+ format: uuid
2776
+ token:
2777
+ type: string
2778
+ pattern: '^sp_(test|live)_[0-9a-f]{16}\.[A-Za-z0-9_-]{43}$'
2779
+ environment:
2780
+ $ref: '#/components/schemas/Environment'
2781
+ required: [key_id, token, environment]
2782
+ additionalProperties: false
2381
2783
  ChainCheckoutSessionRef:
2382
2784
  type: string
2383
2785
  pattern: '^[A-Za-z0-9_-]{16,128}$'
@@ -24,4 +24,3 @@ export declare const openapi: {
24
24
  };
25
25
  };
26
26
  export declare function validateSchema(name: string, data: unknown): string | undefined;
27
- export declare function check(ref: Ref | undefined, data: unknown): string | undefined;
@@ -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
- }
@@ -1,8 +1,4 @@
1
- import { createHash, randomUUID } from 'node:crypto';
2
1
  import canonicalizeModule from 'canonicalize';
3
- export const id = randomUUID;
4
- export const iso = (value) => new Date(value).toISOString();
5
- export const now = () => new Date().toISOString();
6
2
  export const canonical = (value) => {
7
3
  const stringify = canonicalizeModule;
8
4
  const result = stringify(value);
@@ -10,35 +6,3 @@ export const canonical = (value) => {
10
6
  throw new Error('Unable to canonicalize JSON');
11
7
  return result;
12
8
  };
13
- export const sha = (bytes) => createHash('sha256').update(bytes).digest();
14
- export const digest = (value) => sha(canonical(value));
15
- export const scope = (value) => ({
16
- merchant_id: value.merchant_id, project_id: value.project_id, environment: value.environment,
17
- });
18
- export const params = (value) => [value.merchant_id, value.project_id, value.environment];
19
- export const SCOPE = 'merchant_id=$1 AND project_id=$2 AND environment=$3';
20
- export const money = (asset, amount, scale) => ({ asset, amount_atomic: amount, scale });
21
- export class ApiError extends Error {
22
- status;
23
- code;
24
- constructor(status, code, message = code) {
25
- super(message);
26
- this.status = status;
27
- this.code = code;
28
- }
29
- }
30
- export function requireValue(value, code = 'NOT_FOUND') {
31
- if (value === undefined || value === null)
32
- throw new ApiError(404, code, 'Resource not found');
33
- return value;
34
- }
35
- export function requireCondition(condition, status, code, message) {
36
- if (!condition)
37
- throw new ApiError(status, code, message);
38
- }
39
- export const conflict = (condition, code = 'RESOURCE_CONFLICT') => requireCondition(condition, 409, code);
40
- export const invalid = (condition, code = 'INVALID_REQUEST') => requireCondition(condition, 400, code);
41
- export const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
42
- export function isChainProvider(provider) {
43
- return provider === 'evm' || provider === 'solana' || provider === 'tron';
44
- }
@@ -3,6 +3,156 @@
3
3
  * Do not make direct changes to the file.
4
4
  */
5
5
  export interface paths {
6
+ "/billing/plans": {
7
+ parameters: {
8
+ query?: never;
9
+ header?: never;
10
+ path?: never;
11
+ cookie?: never;
12
+ };
13
+ /**
14
+ * List request plans and subscription prices
15
+ * @description Plan prices, included API requests, and configured USDC collection options with available recipients. Live collection options use Ethereum or Base connections. Paid periods last 30 days.
16
+ */
17
+ get: operations["listBillingPlans"];
18
+ put?: never;
19
+ post?: never;
20
+ delete?: never;
21
+ options?: never;
22
+ head?: never;
23
+ patch?: never;
24
+ trace?: never;
25
+ };
26
+ "/billing/subscription": {
27
+ parameters: {
28
+ query?: never;
29
+ header?: never;
30
+ path?: never;
31
+ cookie?: never;
32
+ };
33
+ /**
34
+ * Read the scoped subscription and request usage
35
+ * @description Current prepaid period and admitted API requests. The test allowance follows UTC calendar months.
36
+ */
37
+ get: operations["getBillingSubscription"];
38
+ put?: never;
39
+ post?: never;
40
+ delete?: never;
41
+ options?: never;
42
+ head?: never;
43
+ patch?: never;
44
+ trace?: never;
45
+ };
46
+ "/billing/invoices": {
47
+ parameters: {
48
+ query?: never;
49
+ header?: never;
50
+ path?: never;
51
+ cookie?: never;
52
+ };
53
+ /**
54
+ * List recent subscription invoices to resume checkout or reconciliation
55
+ * @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.
56
+ */
57
+ get: operations["listBillingInvoices"];
58
+ put?: never;
59
+ /**
60
+ * Create a USDC subscription invoice and payer challenge
61
+ * @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.
62
+ */
63
+ post: operations["createBillingInvoice"];
64
+ delete?: never;
65
+ options?: never;
66
+ head?: never;
67
+ patch?: never;
68
+ trace?: never;
69
+ };
70
+ "/billing/invoices/{invoice_id}": {
71
+ parameters: {
72
+ query?: never;
73
+ header?: never;
74
+ path: {
75
+ invoice_id: components["parameters"]["invoice_id"];
76
+ };
77
+ cookie?: never;
78
+ };
79
+ /**
80
+ * Read the scoped subscription invoice
81
+ * @description Returns the invoice, frozen quote, wallet authorization message and entitlement state.
82
+ */
83
+ get: operations["getBillingInvoice"];
84
+ put?: never;
85
+ post?: never;
86
+ delete?: never;
87
+ options?: never;
88
+ head?: never;
89
+ patch?: never;
90
+ trace?: never;
91
+ };
92
+ "/billing/invoices/{invoice_id}/authorize": {
93
+ parameters: {
94
+ query?: never;
95
+ header?: never;
96
+ path: {
97
+ invoice_id: components["parameters"]["invoice_id"];
98
+ };
99
+ cookie?: never;
100
+ };
101
+ get?: never;
102
+ put?: never;
103
+ /**
104
+ * Authorize the subscription invoice with the payer wallet
105
+ * @description Sign the exact invoice intent signing_message with the wallet that will pay.
106
+ */
107
+ post: operations["authorizeBillingInvoice"];
108
+ delete?: never;
109
+ options?: never;
110
+ head?: never;
111
+ patch?: never;
112
+ trace?: never;
113
+ };
114
+ "/billing/invoices/{invoice_id}/submit": {
115
+ parameters: {
116
+ query?: never;
117
+ header?: never;
118
+ path: {
119
+ invoice_id: components["parameters"]["invoice_id"];
120
+ };
121
+ cookie?: never;
122
+ };
123
+ get?: never;
124
+ put?: never;
125
+ /**
126
+ * Submit the signed subscription transaction claim
127
+ * @description Submit a second signature binding the claimed transaction ID to the authorization. The worker independently verifies the payment.
128
+ */
129
+ post: operations["submitBillingInvoice"];
130
+ delete?: never;
131
+ options?: never;
132
+ head?: never;
133
+ patch?: never;
134
+ trace?: never;
135
+ };
136
+ "/billing/keys": {
137
+ parameters: {
138
+ query?: never;
139
+ header?: never;
140
+ path?: never;
141
+ cookie?: never;
142
+ };
143
+ get?: never;
144
+ put?: never;
145
+ /**
146
+ * Issue a scoped server key for the active subscription
147
+ * @description Requires an active subscription. Keep the returned secret server-side and reuse the same idempotency key if the response is lost.
148
+ */
149
+ post: operations["issueBillingKey"];
150
+ delete?: never;
151
+ options?: never;
152
+ head?: never;
153
+ patch?: never;
154
+ trace?: never;
155
+ };
6
156
  "/chain/assets": {
7
157
  parameters: {
8
158
  query?: never;
@@ -10,7 +160,10 @@ export interface paths {
10
160
  path?: never;
11
161
  cookie?: never;
12
162
  };
13
- /** List supported USDC and USDT deployments on configured networks */
163
+ /**
164
+ * 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.
166
+ */
14
167
  get: operations["listChainAssets"];
15
168
  put?: never;
16
169
  post?: never;
@@ -29,7 +182,10 @@ export interface paths {
29
182
  };
30
183
  get?: never;
31
184
  put?: never;
32
- /** Create a watch-only chain connection for the scoped merchant */
185
+ /**
186
+ * Create a watch-only chain connection for the scoped merchant
187
+ * @description Select a network returned by listChainAssets for this environment.
188
+ */
33
189
  post: operations["createChainConnection"];
34
190
  delete?: never;
35
191
  options?: never;
@@ -68,7 +224,7 @@ export interface paths {
68
224
  put?: never;
69
225
  /**
70
226
  * Create immutable order payment obligation
71
- * @description Same scoped order_ref/order_revision and identical specification returns the existing resource. Changed snapshot requires explicit revision but retains the same business grant identity.
227
+ * @description Same scoped order_ref/order_revision and identical specification returns the existing resource. Changed snapshot requires explicit revision but retains the same business grant identity. For new payments, every allowed connection must support the price denomination in listChainAssets.
72
228
  */
73
229
  post: operations["createPayment"];
74
230
  delete?: never;
@@ -109,7 +265,7 @@ export interface paths {
109
265
  put?: never;
110
266
  /**
111
267
  * Freeze stablecoin payable terms
112
- * @description Reserve a unique recipient for the selected network and freeze the amount and token. Quote expiry cannot exceed the payment expiry.
268
+ * @description Reserve a unique recipient for the selected network and freeze the amount and token. Quote expiry cannot exceed the payment expiry. New quotes use the selected network's matching asset from listChainAssets.
113
269
  */
114
270
  post: operations["createQuote"];
115
271
  delete?: never;
@@ -605,7 +761,7 @@ export interface components {
605
761
  */
606
762
  ChainTokenSymbol: "USDC" | "USDT" | "USDT0";
607
763
  /**
608
- * @description Token deployment type. USDT0 and the registered Standard Bridge token settle stable:USDT quotes on their respective networks.
764
+ * @description Token deployment type. Historical quotes can include USDT0 or a Standard Bridge token. New live quotes use native tokens.
609
765
  * @enum {string}
610
766
  */
611
767
  ChainAssetRepresentation: "native" | "usdt0" | "standard_bridge" | "fixture";
@@ -948,6 +1104,86 @@ export interface components {
948
1104
  attempt: components["schemas"]["Attempt"];
949
1105
  operation: components["schemas"]["Operation"] | null;
950
1106
  };
1107
+ /** @enum {string} */
1108
+ BillingPlanId: "sandbox" | "starter" | "growth" | "scale";
1109
+ /** @enum {string} */
1110
+ PaidBillingPlanId: "starter" | "growth" | "scale";
1111
+ BillingPrice: {
1112
+ /** @constant */
1113
+ asset: "stable:USDC";
1114
+ amount_atomic: string;
1115
+ /** @constant */
1116
+ scale: 6;
1117
+ };
1118
+ BillingPlan: {
1119
+ plan_id: components["schemas"]["BillingPlanId"];
1120
+ environment: components["schemas"]["Environment"];
1121
+ price: components["schemas"]["BillingPrice"];
1122
+ request_limit: number;
1123
+ /**
1124
+ * @description The free test plan uses UTC calendar months.
1125
+ * @enum {integer|null}
1126
+ */
1127
+ period_days: 30 | null;
1128
+ };
1129
+ BillingPlans: {
1130
+ plans: components["schemas"]["BillingPlan"][];
1131
+ /** @description Currently offered USDC networks. Existing servers may omit this field. */
1132
+ collection_options?: components["schemas"]["BillingCollectionOption"][];
1133
+ };
1134
+ BillingCollectionOption: {
1135
+ network_id: components["schemas"]["ChainNetworkId"];
1136
+ network_name: string;
1137
+ /** @enum {string} */
1138
+ family: "evm" | "solana";
1139
+ is_default: boolean;
1140
+ };
1141
+ BillingSubscription: {
1142
+ environment: components["schemas"]["Environment"];
1143
+ /** @enum {string} */
1144
+ status: "active" | "inactive";
1145
+ plan_id: components["schemas"]["BillingPlanId"] | null;
1146
+ /** Format: date-time */
1147
+ period_start: string | null;
1148
+ /** Format: date-time */
1149
+ period_end: string | null;
1150
+ request_limit: number;
1151
+ requests_used: number;
1152
+ };
1153
+ CreateBillingInvoice: {
1154
+ plan_id: components["schemas"]["PaidBillingPlanId"];
1155
+ payer_address: components["schemas"]["ChainAddress"];
1156
+ checkout_session_ref: components["schemas"]["ChainCheckoutSessionRef"];
1157
+ /** @description USDC collection network offered in BillingPlans. The deployment's default connection is used when omitted. */
1158
+ network_id?: components["schemas"]["ChainNetworkId"];
1159
+ };
1160
+ BillingInvoice: {
1161
+ /** Format: uuid */
1162
+ invoice_id: string;
1163
+ plan_id: components["schemas"]["PaidBillingPlanId"];
1164
+ environment: components["schemas"]["Environment"];
1165
+ /**
1166
+ * @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.
1167
+ * @enum {string}
1168
+ */
1169
+ status: "pending" | "reconciling" | "active" | "scheduled" | "expired" | "revoked";
1170
+ quote: components["schemas"]["Quote"];
1171
+ intent: components["schemas"]["ChainIntent"];
1172
+ /** Format: date-time */
1173
+ period_start: string | null;
1174
+ /** Format: date-time */
1175
+ period_end: string | null;
1176
+ };
1177
+ BillingInvoiceList: {
1178
+ invoices: components["schemas"]["BillingInvoice"][];
1179
+ };
1180
+ BillingKeyRequest: Record<string, never>;
1181
+ BillingKey: {
1182
+ /** Format: uuid */
1183
+ key_id: string;
1184
+ token: string;
1185
+ environment: components["schemas"]["Environment"];
1186
+ };
951
1187
  /** @description Stable opaque reference assigned by the merchant server to the authenticated buyer checkout. */
952
1188
  ChainCheckoutSessionRef: string;
953
1189
  /** @description Use a 0x-prefixed wallet signature. Encode raw Solana Ed25519 signature bytes as hex. */
@@ -1307,7 +1543,7 @@ export interface components {
1307
1543
  "application/json": components["schemas"]["Error"];
1308
1544
  };
1309
1545
  };
1310
- /** @description Scope, environment, account or resource ownership denied. */
1546
+ /** @description Scope, environment, account or resource ownership denied, or an active subscription is required. */
1311
1547
  Forbidden: {
1312
1548
  headers: {
1313
1549
  [name: string]: unknown;
@@ -1344,6 +1580,33 @@ export interface components {
1344
1580
  "application/json": components["schemas"]["Error"];
1345
1581
  };
1346
1582
  };
1583
+ /** @description BILLING_KEY_REQUIRED for a non-billing credential or SUBSCRIPTION_REQUIRED when key issuance requires an active paid period. */
1584
+ BillingForbidden: {
1585
+ headers: {
1586
+ [name: string]: unknown;
1587
+ };
1588
+ content: {
1589
+ "application/json": components["schemas"]["Error"];
1590
+ };
1591
+ };
1592
+ /** @description Idempotency payload mismatch, another pending or reconciling invoice (BILLING_INVOICE_IN_PROGRESS), an already scheduled renewal (BILLING_RENEWAL_SCHEDULED), or unavailable recipient capacity. */
1593
+ BillingInvoiceConflict: {
1594
+ headers: {
1595
+ [name: string]: unknown;
1596
+ };
1597
+ content: {
1598
+ "application/json": components["schemas"]["Error"];
1599
+ };
1600
+ };
1601
+ /** @description API_REQUEST_LIMIT_REACHED. The current request budget is exhausted. */
1602
+ RequestBudgetExhausted: {
1603
+ headers: {
1604
+ [name: string]: unknown;
1605
+ };
1606
+ content: {
1607
+ "application/json": components["schemas"]["Error"];
1608
+ };
1609
+ };
1347
1610
  /** @description Required service unavailable. An external mutation may still have executed; retain/poll operation ID instead of creating a new payment. */
1348
1611
  Unavailable: {
1349
1612
  headers: {
@@ -1362,6 +1625,7 @@ export interface components {
1362
1625
  payment_id: string;
1363
1626
  attempt_id: string;
1364
1627
  quote_id: string;
1628
+ invoice_id: string;
1365
1629
  intent_id: string;
1366
1630
  connection_id: string;
1367
1631
  operation_id: string;
@@ -1374,6 +1638,235 @@ export interface components {
1374
1638
  }
1375
1639
  export type $defs = Record<string, never>;
1376
1640
  export interface operations {
1641
+ listBillingPlans: {
1642
+ parameters: {
1643
+ query?: never;
1644
+ header?: never;
1645
+ path?: never;
1646
+ cookie?: never;
1647
+ };
1648
+ requestBody?: never;
1649
+ responses: {
1650
+ /** @description Successful scoped billing response. */
1651
+ 200: {
1652
+ headers: {
1653
+ [name: string]: unknown;
1654
+ };
1655
+ content: {
1656
+ "application/json": components["schemas"]["BillingPlans"];
1657
+ };
1658
+ };
1659
+ 401: components["responses"]["Unauthorized"];
1660
+ 403: components["responses"]["BillingForbidden"];
1661
+ 503: components["responses"]["Unavailable"];
1662
+ };
1663
+ };
1664
+ getBillingSubscription: {
1665
+ parameters: {
1666
+ query?: never;
1667
+ header?: never;
1668
+ path?: never;
1669
+ cookie?: never;
1670
+ };
1671
+ requestBody?: never;
1672
+ responses: {
1673
+ /** @description Successful scoped billing response. */
1674
+ 200: {
1675
+ headers: {
1676
+ [name: string]: unknown;
1677
+ };
1678
+ content: {
1679
+ "application/json": components["schemas"]["BillingSubscription"];
1680
+ };
1681
+ };
1682
+ 401: components["responses"]["Unauthorized"];
1683
+ 403: components["responses"]["BillingForbidden"];
1684
+ 503: components["responses"]["Unavailable"];
1685
+ };
1686
+ };
1687
+ listBillingInvoices: {
1688
+ parameters: {
1689
+ query?: never;
1690
+ header?: never;
1691
+ path?: never;
1692
+ cookie?: never;
1693
+ };
1694
+ requestBody?: never;
1695
+ responses: {
1696
+ /** @description Successful scoped billing response. */
1697
+ 200: {
1698
+ headers: {
1699
+ [name: string]: unknown;
1700
+ };
1701
+ content: {
1702
+ "application/json": components["schemas"]["BillingInvoiceList"];
1703
+ };
1704
+ };
1705
+ 401: components["responses"]["Unauthorized"];
1706
+ 403: components["responses"]["BillingForbidden"];
1707
+ 503: components["responses"]["Unavailable"];
1708
+ };
1709
+ };
1710
+ createBillingInvoice: {
1711
+ parameters: {
1712
+ query?: never;
1713
+ header: {
1714
+ /** @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. */
1715
+ "Idempotency-Key": components["parameters"]["IdempotencyKey"];
1716
+ };
1717
+ path?: never;
1718
+ cookie?: never;
1719
+ };
1720
+ requestBody: {
1721
+ content: {
1722
+ "application/json": components["schemas"]["CreateBillingInvoice"];
1723
+ };
1724
+ };
1725
+ responses: {
1726
+ /** @description Successful scoped billing response. */
1727
+ 201: {
1728
+ headers: {
1729
+ [name: string]: unknown;
1730
+ };
1731
+ content: {
1732
+ "application/json": components["schemas"]["BillingInvoice"];
1733
+ };
1734
+ };
1735
+ 400: components["responses"]["BadRequest"];
1736
+ 401: components["responses"]["Unauthorized"];
1737
+ 403: components["responses"]["BillingForbidden"];
1738
+ 409: components["responses"]["BillingInvoiceConflict"];
1739
+ 503: components["responses"]["Unavailable"];
1740
+ };
1741
+ };
1742
+ getBillingInvoice: {
1743
+ parameters: {
1744
+ query?: never;
1745
+ header?: never;
1746
+ path: {
1747
+ invoice_id: components["parameters"]["invoice_id"];
1748
+ };
1749
+ cookie?: never;
1750
+ };
1751
+ requestBody?: never;
1752
+ responses: {
1753
+ /** @description Successful scoped billing response. */
1754
+ 200: {
1755
+ headers: {
1756
+ [name: string]: unknown;
1757
+ };
1758
+ content: {
1759
+ "application/json": components["schemas"]["BillingInvoice"];
1760
+ };
1761
+ };
1762
+ 401: components["responses"]["Unauthorized"];
1763
+ 403: components["responses"]["BillingForbidden"];
1764
+ 404: components["responses"]["NotFound"];
1765
+ 503: components["responses"]["Unavailable"];
1766
+ };
1767
+ };
1768
+ authorizeBillingInvoice: {
1769
+ parameters: {
1770
+ query?: never;
1771
+ header: {
1772
+ /** @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. */
1773
+ "Idempotency-Key": components["parameters"]["IdempotencyKey"];
1774
+ };
1775
+ path: {
1776
+ invoice_id: components["parameters"]["invoice_id"];
1777
+ };
1778
+ cookie?: never;
1779
+ };
1780
+ requestBody: {
1781
+ content: {
1782
+ "application/json": components["schemas"]["AuthorizeChainIntent"];
1783
+ };
1784
+ };
1785
+ responses: {
1786
+ /** @description Successful scoped billing response. */
1787
+ 200: {
1788
+ headers: {
1789
+ [name: string]: unknown;
1790
+ };
1791
+ content: {
1792
+ "application/json": components["schemas"]["BillingInvoice"];
1793
+ };
1794
+ };
1795
+ 400: components["responses"]["BadRequest"];
1796
+ 401: components["responses"]["Unauthorized"];
1797
+ 403: components["responses"]["BillingForbidden"];
1798
+ 404: components["responses"]["NotFound"];
1799
+ 409: components["responses"]["Conflict"];
1800
+ 503: components["responses"]["Unavailable"];
1801
+ };
1802
+ };
1803
+ submitBillingInvoice: {
1804
+ parameters: {
1805
+ query?: never;
1806
+ header: {
1807
+ /** @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. */
1808
+ "Idempotency-Key": components["parameters"]["IdempotencyKey"];
1809
+ };
1810
+ path: {
1811
+ invoice_id: components["parameters"]["invoice_id"];
1812
+ };
1813
+ cookie?: never;
1814
+ };
1815
+ requestBody: {
1816
+ content: {
1817
+ "application/json": components["schemas"]["SubmitChainIntent"];
1818
+ };
1819
+ };
1820
+ responses: {
1821
+ /** @description Successful scoped billing response. */
1822
+ 200: {
1823
+ headers: {
1824
+ [name: string]: unknown;
1825
+ };
1826
+ content: {
1827
+ "application/json": components["schemas"]["BillingInvoice"];
1828
+ };
1829
+ };
1830
+ 400: components["responses"]["BadRequest"];
1831
+ 401: components["responses"]["Unauthorized"];
1832
+ 403: components["responses"]["BillingForbidden"];
1833
+ 404: components["responses"]["NotFound"];
1834
+ 409: components["responses"]["Conflict"];
1835
+ 503: components["responses"]["Unavailable"];
1836
+ };
1837
+ };
1838
+ issueBillingKey: {
1839
+ parameters: {
1840
+ query?: never;
1841
+ header: {
1842
+ /** @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. */
1843
+ "Idempotency-Key": components["parameters"]["IdempotencyKey"];
1844
+ };
1845
+ path?: never;
1846
+ cookie?: never;
1847
+ };
1848
+ requestBody: {
1849
+ content: {
1850
+ "application/json": components["schemas"]["BillingKeyRequest"];
1851
+ };
1852
+ };
1853
+ responses: {
1854
+ /** @description Successful scoped billing response. */
1855
+ 201: {
1856
+ headers: {
1857
+ [name: string]: unknown;
1858
+ };
1859
+ content: {
1860
+ "application/json": components["schemas"]["BillingKey"];
1861
+ };
1862
+ };
1863
+ 400: components["responses"]["BadRequest"];
1864
+ 401: components["responses"]["Unauthorized"];
1865
+ 403: components["responses"]["BillingForbidden"];
1866
+ 409: components["responses"]["Conflict"];
1867
+ 503: components["responses"]["Unavailable"];
1868
+ };
1869
+ };
1377
1870
  listChainAssets: {
1378
1871
  parameters: {
1379
1872
  query?: never;
@@ -1394,6 +1887,7 @@ export interface operations {
1394
1887
  };
1395
1888
  401: components["responses"]["Unauthorized"];
1396
1889
  403: components["responses"]["Forbidden"];
1890
+ 429: components["responses"]["RequestBudgetExhausted"];
1397
1891
  };
1398
1892
  };
1399
1893
  createChainConnection: {
@@ -1489,7 +1983,7 @@ export interface operations {
1489
1983
  403: components["responses"]["Forbidden"];
1490
1984
  404: components["responses"]["NotFound"];
1491
1985
  409: components["responses"]["Conflict"];
1492
- 429: components["responses"]["RateLimited"];
1986
+ 429: components["responses"]["RequestBudgetExhausted"];
1493
1987
  503: components["responses"]["Unavailable"];
1494
1988
  };
1495
1989
  };
@@ -1524,7 +2018,7 @@ export interface operations {
1524
2018
  403: components["responses"]["Forbidden"];
1525
2019
  404: components["responses"]["NotFound"];
1526
2020
  409: components["responses"]["Conflict"];
1527
- 429: components["responses"]["RateLimited"];
2021
+ 429: components["responses"]["RequestBudgetExhausted"];
1528
2022
  503: components["responses"]["Unavailable"];
1529
2023
  };
1530
2024
  };
@@ -1591,7 +2085,7 @@ export interface operations {
1591
2085
  403: components["responses"]["Forbidden"];
1592
2086
  404: components["responses"]["NotFound"];
1593
2087
  409: components["responses"]["Conflict"];
1594
- 429: components["responses"]["RateLimited"];
2088
+ 429: components["responses"]["RequestBudgetExhausted"];
1595
2089
  503: components["responses"]["Unavailable"];
1596
2090
  };
1597
2091
  };
@@ -1764,7 +2258,7 @@ export interface operations {
1764
2258
  403: components["responses"]["Forbidden"];
1765
2259
  404: components["responses"]["NotFound"];
1766
2260
  409: components["responses"]["Conflict"];
1767
- 429: components["responses"]["RateLimited"];
2261
+ 429: components["responses"]["RequestBudgetExhausted"];
1768
2262
  503: components["responses"]["Unavailable"];
1769
2263
  };
1770
2264
  };
@@ -1801,7 +2295,6 @@ export interface operations {
1801
2295
  403: components["responses"]["Forbidden"];
1802
2296
  404: components["responses"]["NotFound"];
1803
2297
  409: components["responses"]["Conflict"];
1804
- 429: components["responses"]["RateLimited"];
1805
2298
  503: components["responses"]["Unavailable"];
1806
2299
  };
1807
2300
  };
@@ -2013,7 +2506,7 @@ export interface operations {
2013
2506
  403: components["responses"]["Forbidden"];
2014
2507
  404: components["responses"]["NotFound"];
2015
2508
  409: components["responses"]["Conflict"];
2016
- 429: components["responses"]["RateLimited"];
2509
+ 429: components["responses"]["RequestBudgetExhausted"];
2017
2510
  503: components["responses"]["Unavailable"];
2018
2511
  };
2019
2512
  };
@@ -2043,7 +2536,7 @@ export interface operations {
2043
2536
  403: components["responses"]["Forbidden"];
2044
2537
  404: components["responses"]["NotFound"];
2045
2538
  409: components["responses"]["Conflict"];
2046
- 429: components["responses"]["RateLimited"];
2539
+ 429: components["responses"]["RequestBudgetExhausted"];
2047
2540
  503: components["responses"]["Unavailable"];
2048
2541
  };
2049
2542
  };
@@ -2080,7 +2573,6 @@ export interface operations {
2080
2573
  403: components["responses"]["Forbidden"];
2081
2574
  404: components["responses"]["NotFound"];
2082
2575
  409: components["responses"]["Conflict"];
2083
- 429: components["responses"]["RateLimited"];
2084
2576
  503: components["responses"]["Unavailable"];
2085
2577
  };
2086
2578
  };
@@ -2115,7 +2607,6 @@ export interface operations {
2115
2607
  403: components["responses"]["Forbidden"];
2116
2608
  404: components["responses"]["NotFound"];
2117
2609
  409: components["responses"]["Conflict"];
2118
- 429: components["responses"]["RateLimited"];
2119
2610
  503: components["responses"]["Unavailable"];
2120
2611
  };
2121
2612
  };
@@ -2145,7 +2636,7 @@ export interface operations {
2145
2636
  403: components["responses"]["Forbidden"];
2146
2637
  404: components["responses"]["NotFound"];
2147
2638
  409: components["responses"]["Conflict"];
2148
- 429: components["responses"]["RateLimited"];
2639
+ 429: components["responses"]["RequestBudgetExhausted"];
2149
2640
  503: components["responses"]["Unavailable"];
2150
2641
  };
2151
2642
  };
@@ -2182,7 +2673,6 @@ export interface operations {
2182
2673
  403: components["responses"]["Forbidden"];
2183
2674
  404: components["responses"]["NotFound"];
2184
2675
  409: components["responses"]["Conflict"];
2185
- 429: components["responses"]["RateLimited"];
2186
2676
  503: components["responses"]["Unavailable"];
2187
2677
  };
2188
2678
  };
@@ -2213,7 +2703,7 @@ export interface operations {
2213
2703
  403: components["responses"]["Forbidden"];
2214
2704
  404: components["responses"]["NotFound"];
2215
2705
  409: components["responses"]["Conflict"];
2216
- 429: components["responses"]["RateLimited"];
2706
+ 429: components["responses"]["RequestBudgetExhausted"];
2217
2707
  503: components["responses"]["Unavailable"];
2218
2708
  };
2219
2709
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0to1pay/fulfillment-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "0to1Pay signed webhook receiver and PostgreSQL fulfillment worker",