@siglume/direct-request-payment 0.4.12 → 0.4.13

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.
@@ -19,12 +19,13 @@ Siglume applies the settlement band from the amount.
19
19
 
20
20
  | Band | Cadence | Period close | First debit attempt | Revenue recognition |
21
21
  | --- | --- | --- | --- | --- |
22
- | Micro Payment | Weekly | Account-assigned fixed weekly slot in the buyer settlement timezone | After final debit notice delivery and the fixed close-plus-3-day window | Only after the aggregated settlement confirms on-chain |
23
- | Nano Payment | Monthly | Account-assigned fixed monthly slot in the buyer settlement timezone | After final debit notice delivery and the fixed close-plus-3-day window | Only after the aggregated settlement confirms on-chain |
22
+ | Micro Payment | Weekly, with early threshold settlement | Account-assigned fixed weekly slot in the buyer settlement timezone; can close early once the buyer/payee/token batch reaches JPY 10,000 or USD 100.00 | After final debit notice delivery and the fixed close-plus-3-day window | Only after the aggregated settlement confirms on-chain |
23
+ | Nano Payment | Monthly, with early threshold settlement | Account-assigned fixed monthly slot in the buyer settlement timezone; can close early once the buyer/payee/token batch reaches JPY 10,000 or USD 100.00 | After final debit notice delivery and the fixed close-plus-3-day window | Only after the aggregated settlement confirms on-chain |
24
24
 
25
- The schedule is platform-managed. Buyers and providers can see the assigned
26
- period and scheduled attempt times through the statement APIs, but cannot choose
27
- a custom close day.
25
+ The schedule is platform-managed. Buyers and providers can see the resulting
26
+ batch period and scheduled attempt times through the statement APIs, but cannot
27
+ choose a custom close day. Early threshold settlement can create a batch before
28
+ the account-assigned weekly or monthly close.
28
29
 
29
30
  The important timestamp is `not_before_attempt_at`. Siglume does not execute the
30
31
  debit before this timestamp. It is always after the final debit notice is
@@ -101,23 +102,25 @@ Rounding happens once when a settlement batch is created:
101
102
  ```text
102
103
  provider_usage_amount_minor = sum(provider price minor units for accepted metered rows)
103
104
  protocol_fee_minor = sum(Micro/Nano fixed protocol fee minor units for accepted metered rows)
104
- gross_buyer_debit_minor = provider_usage_amount_minor + protocol_fee_minor
105
+ provider_receivable_minor = max(provider_usage_amount_minor - protocol_fee_minor, 0)
106
+ gross_buyer_debit_minor = provider_usage_amount_minor
105
107
  buyer_debit_minor = ceil(gross_buyer_debit_minor)
106
108
  rounding_delta_minor = buyer_debit_minor - gross_buyer_debit_minor
107
109
  ```
108
110
 
109
- For low-count Nano batches, the ceiling can make the effective buyer burden per
110
- SDRP Tx higher than the headline "USD 0.001 / SDRP Tx" protocol fee. Here,
111
- `Tx` means one accepted SDRP payment, not an on-chain settlement transaction.
112
- The protocol fee remains the decimal statement amount; the extra integer-minor-unit
113
- adjustment is recorded as `rounding_delta_minor` on the settlement batch. Each
114
- settlement batch can add a positive rounding adjustment of less than 1 token
115
- minor unit; if a buyer uses many providers / payees in one period, that
116
- adjustment can occur once per settlement batch.
111
+ For low-count Nano batches, the ceiling can make the effective rounded debit per
112
+ SDRP Tx higher than the decimal provider usage amount. Here, `Tx` means one
113
+ accepted SDRP payment, not an on-chain settlement transaction. The protocol fee
114
+ remains the decimal statement amount and is deducted from provider receivable;
115
+ the extra integer-minor-unit adjustment is recorded as `rounding_delta_minor` on
116
+ the settlement batch. Each settlement batch can add a positive rounding
117
+ adjustment of less than 1 token minor unit; if a buyer uses many providers /
118
+ payees in one period, that adjustment can occur once per settlement batch.
117
119
 
118
120
  `rounding_delta_minor` belongs to the buyer debit and Siglume's rounding
119
- adjustment accounting for that batch. It is not provider revenue. Provider
120
- reports should use `provider_receivable_minor`,
121
+ adjustment accounting for that batch. It is not provider revenue.
122
+ `protocol_fee_minor` is provider-borne and is not added to the buyer debit.
123
+ Provider reports should use `provider_receivable_minor`,
121
124
  `settled_provider_receivable_minor`, `unsettled_provider_receivable_minor`, and
122
125
  `past_due_provider_receivable_minor`.
123
126
 
@@ -145,8 +148,8 @@ They return `{items, next_cursor}`.
145
148
  Buyer usage event amount fields:
146
149
 
147
150
  - `provider_usage_amount_minor`: provider price for the usage event
148
- - `protocol_fee_minor`: metered protocol fee
149
- - `gross_buyer_debit_minor`: expected buyer debit for the event
151
+ - `protocol_fee_minor`: provider-borne metered protocol fee
152
+ - `gross_buyer_debit_minor`: provider usage amount before integer-token rounding
150
153
  - `expected_scheduled_debit_at`: derived schedule for an open period before a
151
154
  settlement batch exists
152
155
 
@@ -172,7 +175,7 @@ Buyer batch amount fields:
172
175
 
173
176
  - `estimated_buyer_debit_minor`: total buyer debit for the batch
174
177
  - `provider_usage_amount_minor`: provider usage amount before protocol fee
175
- - `gross_buyer_debit_minor`: provider usage amount plus protocol fee
178
+ - `gross_buyer_debit_minor`: provider usage amount before integer-token rounding
176
179
  - `buyer_debit_minor`: amount scheduled for the debit transaction
177
180
 
178
181
  Past-due batches include:
@@ -305,12 +308,13 @@ Important batch fields:
305
308
  | `latest_execution_attempt_status` | Latest non-sensitive execution attempt status |
306
309
  | `chain_receipt_id` | On-chain receipt id when available |
307
310
  | `usage_event_digest` | Digest of usage rows included in the batch |
308
- | `provider_receivable_minor` | Provider amount for the batch |
309
- | `settled_provider_receivable_minor` | Provider amount that is settled on-chain |
310
- | `unsettled_provider_receivable_minor` | Provider amount not yet settled |
311
- | `past_due_provider_receivable_minor` | Provider amount blocked on past-due settlement |
312
- | `gross_buyer_debit_minor` | Provider amount plus protocol fee |
313
- | `protocol_fee_minor` | Micro / Nano protocol fee |
311
+ | `provider_usage_amount_minor` | Provider usage amount before protocol fee |
312
+ | `provider_receivable_minor` | Provider amount for the batch after provider-borne protocol fee |
313
+ | `settled_provider_receivable_minor` | Provider receivable that is settled on-chain |
314
+ | `unsettled_provider_receivable_minor` | Provider receivable not yet settled |
315
+ | `past_due_provider_receivable_minor` | Provider receivable blocked on past-due settlement |
316
+ | `gross_buyer_debit_minor` | Provider usage amount before integer-token rounding |
317
+ | `protocol_fee_minor` | Micro / Nano protocol fee deducted from provider receivable |
314
318
  | `buyer_debit_minor` | Amount scheduled for the buyer debit |
315
319
  | `attempt_count`, `next_attempt_at` | Retry state |
316
320
  | `failure_reason_code`, `failure_reason_label`, `failure_reason_help` | Sanitized public failure reason |
@@ -330,7 +334,7 @@ curl https://siglume.com/v1/sdrp/metered/provider/settlement-batches/<batch-id>/
330
334
  The CSV contains exactly these columns:
331
335
 
332
336
  ```text
333
- metered_usage_id,created_at,plan_type,settlement_cadence,period_start,period_end,listing_id,capability_key,operation_key,currency,token_symbol,provider_receivable_minor,protocol_fee_minor,gross_buyer_debit_minor,rounding_delta_minor,buyer_debit_minor,status,settlement_batch_id,buyer_period_ref
337
+ metered_usage_id,created_at,plan_type,settlement_cadence,period_start,period_end,listing_id,capability_key,operation_key,currency,token_symbol,provider_usage_amount_minor,provider_receivable_minor,protocol_fee_minor,gross_buyer_debit_minor,rounding_delta_minor,buyer_debit_minor,status,settlement_batch_id,buyer_period_ref
334
338
  ```
335
339
 
336
340
  The CSV uses `buyer_period_ref`, not `buyer_user_id`.
package/docs/pricing.md CHANGED
@@ -34,18 +34,19 @@ charging.
34
34
  | Public one-time payment amount | Applied automatically | What you select | Fee | Settlement |
35
35
  | --- | --- | --- | --- | --- |
36
36
  | JPY 501+ / USD 3.01+ | Standard Payment | Select one Standard plan: Launch, Starter, Growth, or Pro | Launch: JPY 0 / USD 0 monthly, 1.8%; Starter: JPY 980 / USD 6 monthly, 1.0%; Growth: JPY 2,980 / USD 18 monthly, 0.7%; Pro: JPY 9,800 / USD 60 monthly, 0.5%. Minimum JPY 30 / USD 0.20 per payment. | Settled on-chain immediately after the payment confirms |
37
- | JPY 50-500 / USD 0.31-3.00 | Micro Payment | Applied automatically by amount | USD 0.01 / SDRP Tx, about JPY 2 | Aggregated and settled **weekly** (see [Settlement schedule](#settlement-schedule)) |
38
- | JPY 1-49 / USD 0.01-0.30 | Nano Payment | Applied automatically by amount | USD 0.001 / SDRP Tx, about JPY 0.2 | Aggregated and settled **monthly** (see [Settlement schedule](#settlement-schedule)) |
37
+ | JPY 50-500 / USD 0.31-3.00 | Micro Payment | Applied automatically by amount | USD 0.01 / SDRP Tx, about JPY 2 | Aggregated and settled **weekly**, or earlier once the buyer/payee batch reaches JPY 10,000 / USD 100.00 (see [Settlement schedule](#settlement-schedule)) |
38
+ | JPY 1-49 / USD 0.01-0.30 | Nano Payment | Applied automatically by amount | USD 0.001 / SDRP Tx, about JPY 0.2 | Aggregated and settled **monthly**, or earlier once the buyer/payee batch reaches JPY 10,000 / USD 100.00 (see [Settlement schedule](#settlement-schedule)) |
39
39
 
40
40
  In this table, `Tx` means one accepted SDRP payment, not an on-chain settlement
41
41
  transaction. Micro / Nano settlement batches are aggregated on-chain after the
42
- weekly or monthly close.
42
+ weekly or monthly close, or earlier when the fixed amount threshold is reached.
43
43
 
44
44
  Standard Payment settles per payment. Micro Payment and Nano Payment are
45
- aggregated and settled in account-assigned weekly / monthly slots - see
46
- [Settlement schedule](#settlement-schedule) for how each band closes, when the
47
- pre-debit notice window elapses, when revenue becomes settled, and how rejected
48
- requests behave.
45
+ aggregated and settled in account-assigned weekly / monthly slots, with early
46
+ settlement when the same buyer/payee/token/period batch reaches JPY 10,000 or
47
+ USD 100.00. See [Settlement schedule](#settlement-schedule) for how each band
48
+ closes, when the pre-debit notice window elapses, when revenue becomes settled,
49
+ and how rejected requests behave.
49
50
 
50
51
  The current public API chooses the band from `amount_minor`; JPY 500-and-under /
51
52
  USD 3-and-under payments are routed to Micro / Nano delayed aggregated
@@ -71,11 +72,12 @@ If no paid plan is selected during merchant setup, the merchant account uses the
71
72
  Launch plan. A merchant billing mandate is still required before accepting
72
73
  payments so Siglume can collect the monthly base fee automatically.
73
74
 
74
- Standard Payment fees are deducted at settlement, so the merchant receives the
75
- net amount for each Standard payment. Micro / Nano protocol fees are different:
76
- they are added to the buyer debit, are reported as `protocol_fee_minor`, and are
77
- not provider revenue. Monthly base fees are collected separately through the
78
- merchant billing mandate.
75
+ All SDRP payment fees are seller-borne. Standard Payment fees are deducted at
76
+ settlement, so the merchant receives the net amount for each Standard payment.
77
+ Micro / Nano protocol fees are deducted from provider receivable at aggregated
78
+ settlement, are reported as `protocol_fee_minor`, and are not added to the buyer
79
+ debit. Monthly base fees are collected separately through the merchant billing
80
+ mandate.
79
81
 
80
82
  The same Standard Payment percentage schedule applies in JPY and USD. For
81
83
  Standard Payment, the Siglume platform returns `fee_bps` in the merchant's
@@ -93,23 +95,27 @@ confirmed payment turns into money in your settlement wallet.
93
95
  | Band | Cadence | Period | You are paid |
94
96
  | --- | --- | --- | --- |
95
97
  | Standard Payment | Per payment | n/a | On-chain, immediately after each payment confirms |
96
- | Micro Payment | Weekly | Account-assigned fixed weekly slot in the buyer settlement timezone; the assigned close time is visible through the statement APIs | After the period closes and the roughly 3-day pre-debit notice window has elapsed, in aggregated on-chain settlement(s) grouped per buyer, payee, token, and period |
97
- | Nano Payment | Monthly | Account-assigned fixed monthly slot in the buyer settlement timezone; the assigned close time is visible through the statement APIs | After the period closes and the roughly 3-day pre-debit notice window has elapsed, in aggregated on-chain settlement(s) grouped per buyer, payee, token, and period |
98
+ | Micro Payment | Weekly, with early threshold settlement | Account-assigned fixed weekly slot in the buyer settlement timezone; the assigned close time is visible through the statement APIs. If a buyer/payee/token/period batch reaches JPY 10,000 or USD 100.00 first, Siglume can close that batch early. | After the period closes or the fixed amount threshold is reached, and the roughly 3-day pre-debit notice window has elapsed, in aggregated on-chain settlement(s) grouped per buyer, payee, token, and period |
99
+ | Nano Payment | Monthly, with early threshold settlement | Account-assigned fixed monthly slot in the buyer settlement timezone; the assigned close time is visible through the statement APIs. If a buyer/payee/token/period batch reaches JPY 10,000 or USD 100.00 first, Siglume can close that batch early. | After the period closes or the fixed amount threshold is reached, and the roughly 3-day pre-debit notice window has elapsed, in aggregated on-chain settlement(s) grouped per buyer, payee, token, and period |
98
100
 
99
101
  ### Micro weekly settlement
100
102
 
101
103
  - **Closing period.** Micro-band payments accrue across one weekly period. The
102
104
  specific closing weekday and time are assigned as a fixed slot per account to
103
105
  spread settlement load.
106
+ - **Early threshold settlement.** If a buyer/payee/token batch reaches JPY
107
+ 10,000 or USD 100.00 before the weekly close, Siglume can close that batch
108
+ early and start the same final-notice and settlement flow.
104
109
  - **Timezone.** Period boundaries are evaluated in the buyer's configured
105
110
  settlement timezone, defaulting to UTC. Assigned slots are persisted and are
106
111
  not recalculated on the fly.
107
- - **Settlement.** After the week closes, Siglume aggregates that week's Micro
112
+ - **Settlement.** After the week closes or the early threshold is reached,
113
+ Siglume aggregates the Micro
108
114
  payments — grouped per buyer, payee, token, and period — into on-chain
109
115
  settlement(s). Siglume sends the final debit notice first; the on-chain debit
110
116
  is not attempted until the scheduled attempt time after an approximately
111
117
  3-day pre-debit notice window (`not_before_attempt_at`).
112
- - **Revenue recognition.** A Micro payment is final only once its weekly
118
+ - **Revenue recognition.** A Micro payment is final only once its aggregated
113
119
  settlement confirms on-chain. Until then it is accrued, not settled.
114
120
 
115
121
  ### Nano monthly settlement
@@ -117,15 +123,19 @@ confirmed payment turns into money in your settlement wallet.
117
123
  - **Closing period.** Nano-band payments accrue across one monthly period. The
118
124
  specific closing day and time are assigned as a fixed slot per account to
119
125
  spread settlement load.
126
+ - **Early threshold settlement.** If a buyer/payee/token batch reaches JPY
127
+ 10,000 or USD 100.00 before the monthly close, Siglume can close that batch
128
+ early and start the same final-notice and settlement flow.
120
129
  - **Timezone.** As with Micro, period boundaries use the buyer's configured
121
130
  settlement timezone, defaulting to UTC. Assigned slots are persisted and are
122
131
  not recalculated on the fly.
123
- - **Settlement.** After the month closes, Siglume aggregates that month's Nano
132
+ - **Settlement.** After the month closes or the early threshold is reached,
133
+ Siglume aggregates the Nano
124
134
  payments — grouped per buyer, payee, token, and period — into on-chain
125
135
  settlement(s). Siglume sends the final debit notice first; the on-chain debit
126
136
  is not attempted until the scheduled attempt time after an approximately
127
137
  3-day pre-debit notice window (`not_before_attempt_at`).
128
- - **Revenue recognition.** A Nano payment is final only once its monthly
138
+ - **Revenue recognition.** A Nano payment is final only once its aggregated
129
139
  settlement confirms on-chain.
130
140
 
131
141
  ### Failures, retries, and carry-over
@@ -150,8 +160,9 @@ confirmed payment turns into money in your settlement wallet.
150
160
 
151
161
  Micro and Nano run a budget check before the buyer's paid request is fulfilled:
152
162
 
153
- - A buyer's wallet budget reservation is consumed at the **gross amount** (your
154
- price plus the protocol fee) from acceptance until settlement confirms. This
163
+ - A buyer's wallet budget reservation is consumed at the **gross buyer debit
164
+ amount** (your usage price, before any provider-borne protocol fee) from
165
+ acceptance until settlement confirms. This
155
166
  is a reservation against Siglume spending limits; it does not lock, escrow,
156
167
  preserve, or guarantee the buyer's token balance, allowance, BudgetVault
157
168
  authorization, or payment source.
@@ -166,14 +177,15 @@ Micro and Nano run a budget check before the buyer's paid request is fulfilled:
166
177
 
167
178
  ### What is fixed vs platform-managed
168
179
 
169
- The cadence is fixed: **Micro settles weekly, Nano settles monthly**, and a
170
- payment is final only after its on-chain settlement confirms. Micro and Nano are
171
- automatic amount bands, not customer-selected options. The account-assigned
172
- period boundaries, roughly 3-day pre-debit notice window, and current retry policy
173
- above are the public behavior as of 2026-06-18. Treat the platform's statement
174
- status, `not_before_attempt_at`, Standard `fee_bps`, and Micro / Nano statement
175
- amount fields as authoritative rather than hard-coding local revenue
176
- recognition.
180
+ The cadence fields are fixed: **Micro is weekly, Nano is monthly**. In both
181
+ bands, Siglume can close a buyer/payee/token batch early once it reaches JPY
182
+ 10,000 or USD 100.00. A payment is final only after its on-chain settlement
183
+ confirms. Micro and Nano are automatic amount bands, not customer-selected
184
+ options. The account-assigned period boundaries, roughly 3-day pre-debit notice
185
+ window, early settlement threshold, and current retry policy above are the
186
+ public behavior as of 2026-06-19. Treat the platform's statement status,
187
+ `not_before_attempt_at`, Standard `fee_bps`, and Micro / Nano statement amount
188
+ fields as authoritative rather than hard-coding local revenue recognition.
177
189
 
178
190
  ## Micro / Nano Amount Rounding
179
191
 
@@ -184,7 +196,8 @@ current settlement rule is:
184
196
  ```text
185
197
  provider_usage_amount_minor = sum(provider price minor units for accepted metered rows)
186
198
  protocol_fee_minor = sum(Micro/Nano fixed protocol fee minor units for accepted metered rows)
187
- gross_buyer_debit_minor = provider_usage_amount_minor + protocol_fee_minor
199
+ provider_receivable_minor = max(provider_usage_amount_minor - protocol_fee_minor, 0)
200
+ gross_buyer_debit_minor = provider_usage_amount_minor
188
201
  buyer_debit_minor = ceil(gross_buyer_debit_minor)
189
202
  rounding_delta_minor = buyer_debit_minor - gross_buyer_debit_minor
190
203
  ```
@@ -195,20 +208,23 @@ The rounding mode is ceiling to the next integer token minor unit because
195
208
  on-chain settlement cannot debit fractional JPYC/USDC minor units. The positive
196
209
  `rounding_delta_minor` is part of the buyer debit for that batch and is retained
197
210
  as a rounding adjustment in Siglume's settlement accounting; it is not provider
198
- revenue. Providers should reconcile their revenue with
211
+ revenue. `protocol_fee_minor` is provider-borne and is deducted from provider
212
+ receivable, not added to the buyer debit. Providers should reconcile their
213
+ revenue with
199
214
  `provider_receivable_minor`, `settled_provider_receivable_minor`,
200
215
  `unsettled_provider_receivable_minor`, and
201
216
  `past_due_provider_receivable_minor`, not with `buyer_debit_minor`.
202
217
 
203
218
  For low-count Nano batches, the integer ceiling can make the effective buyer
204
- burden per SDRP Tx higher than the headline USD 0.001 / SDRP Tx protocol fee. The
205
- decimal protocol fee remains visible as `protocol_fee_minor`; the difference
206
- created by integer-token settlement is visible as `rounding_delta_minor` on the
207
- batch. Each settlement batch can add a positive rounding adjustment of less than
208
- 1 token minor unit. If a buyer uses many providers / payees in one period, that
209
- adjustment can occur once per settlement batch. JavaScript integrations should
210
- not sum Micro / Nano minor amounts with `number`; use a decimal library. Python
211
- integrations should use `Decimal`.
219
+ rounded debit per SDRP Tx higher than the decimal provider usage amount. The
220
+ decimal protocol fee remains visible as `protocol_fee_minor` and is deducted
221
+ from provider receivable; the difference created by integer-token settlement is
222
+ visible as `rounding_delta_minor` on the batch. Each settlement batch can add a
223
+ positive rounding adjustment of less than 1 token minor unit. If a buyer uses
224
+ many providers / payees in one period, that adjustment can occur once per
225
+ settlement batch. JavaScript integrations should not sum Micro / Nano minor
226
+ amounts with `number`; use a decimal library. Python integrations should use
227
+ `Decimal`.
212
228
 
213
229
  ## Statement APIs and Notices
214
230
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siglume/direct-request-payment",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "SDK for the Siglume Direct Request Payment SDRP payment protocol",
5
5
  "keywords": [
6
6
  "siglume",