@0to1pay/fulfillment-sdk 3.0.0 → 3.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
@@ -3,11 +3,11 @@
3
3
  Node.js 22.20.0 or newer and a merchant PostgreSQL database. Install the SDKs from npm or use the verified tarballs in your merchant backend.
4
4
 
5
5
  ```sh
6
- npm install @0to1pay/server-sdk@3.0.0 @0to1pay/fulfillment-sdk@3.0.0
6
+ npm install @0to1pay/server-sdk@3.1.0 @0to1pay/fulfillment-sdk@3.1.0
7
7
  ```
8
8
 
9
9
  ```sh
10
- npm install ./0to1pay-server-sdk-3.0.0.tgz ./0to1pay-fulfillment-sdk-3.0.0.tgz
10
+ npm install ./0to1pay-server-sdk-3.1.0.tgz ./0to1pay-fulfillment-sdk-3.1.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')`.
@@ -30,8 +30,8 @@ paths:
30
30
  tags: [Billing]
31
31
  x-required-scope: billing:read
32
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.
33
+ Plan prices, included API requests, and available subscription collection options for USDC on Ethereum or Base and USDT on TRON.
34
+ Paid periods last 30 days.
35
35
  responses:
36
36
  '200':
37
37
  description: Successful scoped billing response.
@@ -87,10 +87,10 @@ paths:
87
87
  $ref: '#/components/responses/Unavailable'
88
88
  post:
89
89
  operationId: createBillingInvoice
90
- summary: Create a USDC subscription invoice and payer challenge
90
+ summary: Create a stablecoin subscription invoice and payer challenge
91
91
  tags: [Billing]
92
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.
93
+ description: Select an offered collection network with network_id, or omit it for the configured default. The selected network determines the six-decimal settlement asset. The invoice records the asset, amount and plan terms.
94
94
  parameters:
95
95
  - $ref: '#/components/parameters/IdempotencyKey'
96
96
  requestBody:
@@ -293,7 +293,7 @@ paths:
293
293
  description: >
294
294
  Live checkout supports Ethereum native USDC and USDT, TRON USDT, and Base native USDC.
295
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.
296
+ Sandbox keys can discover test USDC on Ethereum Sepolia and Base Sepolia and test USDT on TRON Nile when enabled.
297
297
  tags: [Connections]
298
298
  x-required-scope: payments:read
299
299
  responses:
@@ -1708,11 +1708,11 @@ components:
1708
1708
  pattern: '^0x[0-9a-fA-F]{64}$'
1709
1709
  ChainSelectorId:
1710
1710
  type: integer
1711
- enum: [1, 8453, 84532, 31337, 31339, 728126428, 900003]
1711
+ enum: [1, 8453, 84532, 11155111, 31337, 31339, 728126428, 3448148188, 900003]
1712
1712
  description: Supported EVM or TRON chain selector. Use network_id for the network reference.
1713
1713
  ChainNetworkId:
1714
1714
  type: string
1715
- pattern: '^(eip155:(1|8453|84532|31337|31339)|tron:(728126428|900003|0x2b6653dc))$'
1715
+ pattern: '^(eip155:(1|8453|84532|11155111|31337|31339)|tron:(728126428|3448148188|900003|0x2b6653dc))$'
1716
1716
  description: Decimal TRON identifiers are emitted. The hexadecimal TRON mainnet alias is accepted on connection creation.
1717
1717
  ChainFamily:
1718
1718
  type: string
@@ -2733,7 +2733,7 @@ components:
2733
2733
  type: object
2734
2734
  properties:
2735
2735
  asset:
2736
- const: stable:USDC
2736
+ $ref: '#/components/schemas/StableDenomination'
2737
2737
  amount_atomic:
2738
2738
  type: string
2739
2739
  pattern: '^(0|[1-9][0-9]{0,19})$'
@@ -2750,6 +2750,12 @@ components:
2750
2750
  $ref: '#/components/schemas/Environment'
2751
2751
  price:
2752
2752
  $ref: '#/components/schemas/BillingPrice'
2753
+ description: The plan's reference price in USDC.
2754
+ prices:
2755
+ type: array
2756
+ description: Fixed nominal prices in each supported subscription asset. Availability depends on collection_options.
2757
+ items:
2758
+ $ref: '#/components/schemas/BillingPrice'
2753
2759
  request_limit:
2754
2760
  type: integer
2755
2761
  minimum: 1
@@ -2757,7 +2763,7 @@ components:
2757
2763
  type: [integer, 'null']
2758
2764
  enum: [30, null]
2759
2765
  description: The free test plan uses UTC calendar months.
2760
- required: [plan_id, environment, price, request_limit, period_days]
2766
+ required: [plan_id, environment, price, prices, request_limit, period_days]
2761
2767
  additionalProperties: false
2762
2768
  BillingPlans:
2763
2769
  type: object
@@ -2768,7 +2774,7 @@ components:
2768
2774
  $ref: '#/components/schemas/BillingPlan'
2769
2775
  collection_options:
2770
2776
  type: array
2771
- description: Currently offered USDC networks. Existing servers may omit this field.
2777
+ description: Currently offered collection networks and settlement assets with available recipients.
2772
2778
  items:
2773
2779
  $ref: '#/components/schemas/BillingCollectionOption'
2774
2780
  required: [plans]
@@ -2781,11 +2787,14 @@ components:
2781
2787
  network_name:
2782
2788
  type: string
2783
2789
  family:
2784
- type: string
2785
- enum: [evm]
2790
+ $ref: '#/components/schemas/ChainFamily'
2791
+ asset:
2792
+ $ref: '#/components/schemas/StableDenomination'
2793
+ scale:
2794
+ const: 6
2786
2795
  is_default:
2787
2796
  type: boolean
2788
- required: [network_id, network_name, family, is_default]
2797
+ required: [network_id, network_name, family, asset, scale, is_default]
2789
2798
  additionalProperties: false
2790
2799
  BillingSubscription:
2791
2800
  type: object
@@ -2824,7 +2833,7 @@ components:
2824
2833
  $ref: '#/components/schemas/ChainCheckoutSessionRef'
2825
2834
  network_id:
2826
2835
  $ref: '#/components/schemas/ChainNetworkId'
2827
- description: USDC collection network offered in BillingPlans. The deployment's default connection is used when omitted.
2836
+ description: Collection network offered in BillingPlans. Ethereum and Base settle in USDC, TRON settles in USDT. The default connection is used when omitted.
2828
2837
  required: [plan_id, payer_address, checkout_session_ref]
2829
2838
  additionalProperties: false
2830
2839
  BillingInvoice:
@@ -2841,6 +2850,8 @@ components:
2841
2850
  type: string
2842
2851
  enum: [pending, reconciling, active, scheduled, expired, revoked]
2843
2852
  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.
2853
+ price:
2854
+ $ref: '#/components/schemas/BillingPrice'
2844
2855
  quote:
2845
2856
  $ref: '#/components/schemas/Quote'
2846
2857
  intent:
@@ -2851,7 +2862,7 @@ components:
2851
2862
  period_end:
2852
2863
  type: [string, 'null']
2853
2864
  format: date-time
2854
- required: [invoice_id, plan_id, environment, status, quote, intent, period_start, period_end]
2865
+ required: [invoice_id, plan_id, environment, status, price, quote, intent, period_start, period_end]
2855
2866
  additionalProperties: false
2856
2867
  BillingInvoiceList:
2857
2868
  type: object
@@ -12,7 +12,7 @@ export interface paths {
12
12
  };
13
13
  /**
14
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.
15
+ * @description Plan prices, included API requests, and available subscription collection options for USDC on Ethereum or Base and USDT on TRON. Paid periods last 30 days.
16
16
  */
17
17
  get: operations["listBillingPlans"];
18
18
  put?: never;
@@ -57,8 +57,8 @@ export interface paths {
57
57
  get: operations["listBillingInvoices"];
58
58
  put?: never;
59
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.
60
+ * Create a stablecoin subscription invoice and payer challenge
61
+ * @description Select an offered collection network with network_id, or omit it for the configured default. The selected network determines the six-decimal settlement asset. The invoice records the asset, amount and plan terms.
62
62
  */
63
63
  post: operations["createBillingInvoice"];
64
64
  delete?: never;
@@ -182,7 +182,7 @@ export interface paths {
182
182
  };
183
183
  /**
184
184
  * List supported USDC and USDT deployments on configured networks
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.
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. Sandbox keys can discover test USDC on Ethereum Sepolia and Base Sepolia and test USDT on TRON Nile when enabled.
186
186
  */
187
187
  get: operations["listChainAssets"];
188
188
  put?: never;
@@ -787,7 +787,7 @@ export interface components {
787
787
  * @description Supported EVM or TRON chain selector. Use network_id for the network reference.
788
788
  * @enum {integer}
789
789
  */
790
- ChainSelectorId: 1 | 8453 | 84532 | 31337 | 31339 | 728126428 | 900003;
790
+ ChainSelectorId: 1 | 8453 | 84532 | 11155111 | 31337 | 31339 | 728126428 | 3448148188 | 900003;
791
791
  /** @description Decimal TRON identifiers are emitted. The hexadecimal TRON mainnet alias is accepted on connection creation. */
792
792
  ChainNetworkId: string;
793
793
  /** @enum {string} */
@@ -1169,8 +1169,7 @@ export interface components {
1169
1169
  /** @enum {string} */
1170
1170
  PaidBillingPlanId: "starter" | "growth" | "scale";
1171
1171
  BillingPrice: {
1172
- /** @constant */
1173
- asset: "stable:USDC";
1172
+ asset: components["schemas"]["StableDenomination"];
1174
1173
  amount_atomic: string;
1175
1174
  /** @constant */
1176
1175
  scale: 6;
@@ -1178,7 +1177,10 @@ export interface components {
1178
1177
  BillingPlan: {
1179
1178
  plan_id: components["schemas"]["BillingPlanId"];
1180
1179
  environment: components["schemas"]["Environment"];
1180
+ /** @description The plan's reference price in USDC. */
1181
1181
  price: components["schemas"]["BillingPrice"];
1182
+ /** @description Fixed nominal prices in each supported subscription asset. Availability depends on collection_options. */
1183
+ prices: components["schemas"]["BillingPrice"][];
1182
1184
  request_limit: number;
1183
1185
  /**
1184
1186
  * @description The free test plan uses UTC calendar months.
@@ -1188,14 +1190,16 @@ export interface components {
1188
1190
  };
1189
1191
  BillingPlans: {
1190
1192
  plans: components["schemas"]["BillingPlan"][];
1191
- /** @description Currently offered USDC networks. Existing servers may omit this field. */
1193
+ /** @description Currently offered collection networks and settlement assets with available recipients. */
1192
1194
  collection_options?: components["schemas"]["BillingCollectionOption"][];
1193
1195
  };
1194
1196
  BillingCollectionOption: {
1195
1197
  network_id: components["schemas"]["ChainNetworkId"];
1196
1198
  network_name: string;
1197
- /** @enum {string} */
1198
- family: "evm";
1199
+ family: components["schemas"]["ChainFamily"];
1200
+ asset: components["schemas"]["StableDenomination"];
1201
+ /** @constant */
1202
+ scale: 6;
1199
1203
  is_default: boolean;
1200
1204
  };
1201
1205
  BillingSubscription: {
@@ -1214,7 +1218,7 @@ export interface components {
1214
1218
  plan_id: components["schemas"]["PaidBillingPlanId"];
1215
1219
  payer_address: components["schemas"]["ChainAddress"];
1216
1220
  checkout_session_ref: components["schemas"]["ChainCheckoutSessionRef"];
1217
- /** @description USDC collection network offered in BillingPlans. The deployment's default connection is used when omitted. */
1221
+ /** @description Collection network offered in BillingPlans. Ethereum and Base settle in USDC, TRON settles in USDT. The default connection is used when omitted. */
1218
1222
  network_id?: components["schemas"]["ChainNetworkId"];
1219
1223
  };
1220
1224
  BillingInvoice: {
@@ -1227,6 +1231,7 @@ export interface components {
1227
1231
  * @enum {string}
1228
1232
  */
1229
1233
  status: "pending" | "reconciling" | "active" | "scheduled" | "expired" | "revoked";
1234
+ price: components["schemas"]["BillingPrice"];
1230
1235
  quote: components["schemas"]["Quote"];
1231
1236
  intent: components["schemas"]["ChainIntent"];
1232
1237
  /** Format: date-time */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0to1pay/fulfillment-sdk",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "0to1Pay signed webhook receiver and PostgreSQL fulfillment worker",