openreceive-server 0.4.9 → 0.4.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4863bd516d545ee67876f12d51dcb34f16981c04fd8d3a5afeba1c8f51aa815
4
- data.tar.gz: 5815d70b2ea731a5541c1b77ab43fd924b65f93946a2ddcfb0aa05d1358b5dea
3
+ metadata.gz: 39aa74c7725e2887e61131f418feceb4a03194b5a079ac46307f685600d062f5
4
+ data.tar.gz: 33e89f647cef3990e85ce10990ec868267251001bbf03b280921d522bdd5dce6
5
5
  SHA512:
6
- metadata.gz: 7eb3938e40025cf9821820311c3d4f9a909ea27825bdf37510d24ccc9e5075dbcdefb922e1a8a6dc1c42e27ac42df4ac0e83befe639d4b4d5e1b73faa6dfdc99
7
- data.tar.gz: 476e31a93f723c57e0c08ec729e2f9a9afbcc8ec45e7b16f15992f02213751de6fd36f6b110b38b162aa796d633b26f1c7417909cd968eaead442177abec8d0c
6
+ metadata.gz: 928f356068c9f63b15b9955ea89fc6e77187828eb41a619c4a9bce4fbdd8b2b61c73e432387a777f35005e32a093347531b41e065e28e5b3b48551d813d1946d
7
+ data.tar.gz: fd128c515bd6a1f99c836dae1c57c3fd3d3468a52130d2e5b7ffacc5ba049d3ed84ac1b5e34b4c626fe9f00c91469030bb68f3343debf4f6aff658337fa38ca3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.11 - 2026-09-21
4
+
5
+ The mounted HTTP routes mint invoices with the host's own description. The
6
+ display string `amount_for` returns beside the price is now the default
7
+ `make_invoice` memo, so a host that writes no invoice code stops minting
8
+ BOLT11s with an empty description. An explicit request-body `memo` still wins
9
+ and still carries the length cap; a host that returns no description still
10
+ mints without one.
11
+
12
+ Payment safety and disclosure fixes: a checkout's `created_at_source` (whether
13
+ the creation time came from the wallet or from us) is internal and is stripped
14
+ from every public body, error responses carry a redacted message and no
15
+ arbitrary internal `details`, unexpected errors are reported to `Rails.error`
16
+ detached from their cause and backtrace, a host callback that returns an
17
+ invalid amount raises `InternalHostError` instead of leaking a validation
18
+ failure, and a refund address is rejected unless the attempt has a saved,
19
+ supported pay-in asset. A host that refuses an attempt now answers 409 with
20
+ instructions withheld, while genuine storage failure stays a retryable 503.
21
+
22
+ ## 0.4.10 - 2026-09-16
23
+
24
+ Release in lockstep with the 0.4.10 stablecoin checkout fix. The swap fee
25
+ object (`currency`, `pay_in_fiat`, `payout_fiat`) is unchanged on the wire;
26
+ `pay_in_fiat` is documented as a valuation that explains the spread, never
27
+ an amount a payer is told to send. No Ruby server API or payment behavior
28
+ changes.
29
+
3
30
  ## 0.4.9 - 2026-09-14
4
31
 
5
32
  Release in lockstep with the 0.4.9 checkout method-switch fix and updated
@@ -97,7 +97,7 @@ module OpenReceive
97
97
  class HostPersistenceError < StandardError
98
98
  attr_reader :status, :code, :retryable
99
99
 
100
- def initialize(message = "The host could not persist this payment attempt; " \
100
+ def initialize(message = "Payment storage is unavailable; " \
101
101
  "payer instructions were withheld. Please retry.")
102
102
  super(message)
103
103
  @status = 503
@@ -88,7 +88,7 @@ module OpenReceive
88
88
  else
89
89
  @service.create_checkout(
90
90
  "reference" => reference, "amount" => required_amount(resolved),
91
- "memo" => validated_memo(body), "metadata" => body["metadata"]
91
+ "memo" => mint_memo(body, resolved), "metadata" => body["metadata"]
92
92
  )
93
93
  end
94
94
  commit(checkout, nil, request) unless resolved["payment_hash"]
@@ -99,7 +99,7 @@ module OpenReceive
99
99
  # committed invoice amount — and served on the re-fetch path too, so
100
100
  # a repeated create answers with the same shape it first did.
101
101
  payment_methods = @service.list_swap_options(amount_msats: checkout["amount_msats"])
102
- body = { "checkout" => checkout, "payment_methods" => payment_methods }
102
+ body = { "checkout" => public_checkout(checkout), "payment_methods" => payment_methods }
103
103
  description = resolved_description(resolved)
104
104
  body["description"] = description if description
105
105
  success(201, body, request_id)
@@ -180,7 +180,7 @@ module OpenReceive
180
180
  "reference" => reference,
181
181
  "amount" => required_amount(resolved),
182
182
  "pay_in_asset" => asset,
183
- "memo" => validated_memo(body),
183
+ "memo" => mint_memo(body, resolved),
184
184
  "metadata" => body["metadata"]
185
185
  )
186
186
  end
@@ -255,9 +255,9 @@ module OpenReceive
255
255
  retryable = Nwc::RETRYABLE_ERROR_CODES.include?(code) if retryable.nil?
256
256
  status = retryable ? 503 : 502
257
257
  end
258
- body = { "code" => code, "message" => error.message, "request_id" => request_id }
258
+ body = { "code" => code, "message" => Nwc.redact_error_text(error.message), "request_id" => request_id }
259
259
  body["retryable"] = retryable unless retryable.nil?
260
- body["details"] = error.details if error.respond_to?(:details) && error.details.is_a?(Hash)
260
+ # Arbitrary internal details and causes have no public projection.
261
261
  response_headers = headers(request_id)
262
262
  # Mirrors the JS handler: a Retry-After hint (whole seconds, minimum 1)
263
263
  # rides along with retryable throttling errors.
@@ -271,6 +271,10 @@ module OpenReceive
271
271
 
272
272
  private
273
273
 
274
+ def public_checkout(checkout)
275
+ checkout.reject { |key, _| key.to_s == "created_at_source" }
276
+ end
277
+
274
278
  # Status refresh with no request-level pass: one-attempt reconcile_payments,
275
279
  # delivering settlement inline. A truncated walk raises WalletUnavailableError
276
280
  # (retryable 503) rather than reporting not_found.
@@ -391,11 +395,11 @@ module OpenReceive
391
395
  # (database down, bug): retryable 503, never a payer-blaming conflict
392
396
  # — mirrors the JS handler's commit().
393
397
  raise e if e.respond_to?(:status) && e.respond_to?(:code)
394
- raise HostPersistenceError
398
+ raise ConflictError, "The host did not accept this payment attempt; payer instructions were withheld."
395
399
  end
396
400
 
397
401
  def public_swap(swap)
398
- swap.reject { |key, _| key == "swap_data" }
402
+ swap.reject { |key, _| key == "swap_data" }.merge("checkout" => public_checkout(swap.fetch("checkout")))
399
403
  end
400
404
 
401
405
  # Payer-facing subset of a settlement's wallet details, whitelisted
@@ -442,7 +446,9 @@ module OpenReceive
442
446
  # preimages.
443
447
  def report_unexpected_error(error, request_id)
444
448
  if defined?(::Rails) && ::Rails.respond_to?(:error) && ::Rails.error
445
- ::Rails.error.report(error, handled: true, source: "openreceive")
449
+ # Detached diagnostic: no cause, stack or attached provider configuration.
450
+ safe_error = RuntimeError.new(OpenReceive::Nwc.redact_error_text(error.message))
451
+ ::Rails.error.report(safe_error, handled: true, source: "openreceive")
446
452
  else
447
453
  origin = Array(error.backtrace).first
448
454
  line = "[openreceive] unexpected #{error.class} (request_id=#{request_id})" \
@@ -550,10 +556,24 @@ module OpenReceive
550
556
  memo
551
557
  end
552
558
 
559
+ # The description that goes INTO the invoice. An explicit body memo wins,
560
+ # so a client that writes its own copy keeps it; otherwise the host's
561
+ # display string is it. Without the fallback a host on the mounted routes
562
+ # mints BOLT11s with no description at all and the payer's wallet shows a
563
+ # blank line next to the amount. Only the body memo carries the length
564
+ # cap: the cap bounds client input, and the host description is host data
565
+ # exactly like the price beside it.
566
+ def mint_memo(body, resolved)
567
+ memo = validated_memo(body)
568
+ blank = memo.nil? || (memo.is_a?(String) && memo.strip.empty?)
569
+ blank ? resolved_description(resolved) : memo
570
+ end
571
+
553
572
  # What the payer is buying, in the host's own words: one optional display
554
- # string the host returns beside the price. Response only — it is never
555
- # read from a request body, because the payer does not get to write the
556
- # copy next to the amount. Blank is the same as absent.
573
+ # string the host returns beside the price. Never read from a request
574
+ # body, because the payer does not get to write the copy next to the
575
+ # amount; it rides the prepare and create responses and, via mint_memo,
576
+ # defaults the invoice description. Blank is the same as absent.
557
577
  def resolved_description(resolved)
558
578
  value = resolved["description"]
559
579
  return nil unless value.is_a?(String)
@@ -162,6 +162,7 @@ module OpenReceive
162
162
  "bolt11" => wallet.fetch("invoice"),
163
163
  "amount_msats" => wallet.fetch("amount_msats"),
164
164
  "created_at" => created_at,
165
+ "created_at_source" => wallet["created_at"].nil? ? "host" : "wallet",
165
166
  "expires_at" => expires_at,
166
167
  "fiat_quote" => fiat_quote
167
168
  }
@@ -563,6 +564,12 @@ module OpenReceive
563
564
  end
564
565
 
565
566
  def resolve_amount(input)
567
+ resolve_amount_value(input)
568
+ rescue ArgumentError, TypeError, KeyError, ValidationError
569
+ raise InternalHostError, "The host supplied an invalid payment amount."
570
+ end
571
+
572
+ def resolve_amount_value(input)
566
573
  amount = stringify(input)
567
574
  if amount.key?("sats")
568
575
  return [OpenReceive::Money.direct_to_msats(currency: "SATS", value: amount.fetch("sats")), nil]
@@ -639,6 +646,9 @@ module OpenReceive
639
646
  # checksum — a false accept here sends the payer's money somewhere
640
647
  # unrecoverable. Mirrors the JS normalizeRefundAddress exactly.
641
648
  def normalize_refund_address(value, pay_in_asset)
649
+ unless OpenReceive::Server::Swap::Assets::PAY_IN_ASSETS.include?(pay_in_asset)
650
+ raise InternalHostError, "Swap recovery requires a supported pay-in asset/network."
651
+ end
642
652
  normalized = value.to_s.strip
643
653
  if normalized.empty? || normalized.length > 300
644
654
  raise ValidationError, "refundAddress is invalid."
@@ -306,9 +306,7 @@ module OpenReceive
306
306
  def post(path, body)
307
307
  @weight_budget&.reserve(path)
308
308
  body_string = JSON.generate(body)
309
- # Surface every outbound request before the call. The host sink is
310
- # responsible for sanitizing nested secrets; the API key and HMAC
311
- # signature live in headers and are deliberately never logged.
309
+ # Host diagnostic sinks receive summaries only, before any provider I/O.
312
310
  log_api_request(path, body)
313
311
  begin
314
312
  response = @http.call(
@@ -341,9 +339,7 @@ module OpenReceive
341
339
  message: "FixedFloat #{path} returned invalid JSON."
342
340
  )
343
341
  end
344
- # Surface every response (including API-error envelopes) before any
345
- # raise. The host sink sanitizes nested secrets — notably the order
346
- # token in a create/order response — so this must not pre-redact.
342
+ # Summarize before invoking any host sink, including error envelopes.
347
343
  log_api_response(path: path, status: status, ok: ok,
348
344
  code: parsed["code"], msg: parsed["msg"], data: parsed["data"])
349
345
  unless ok
@@ -369,7 +365,10 @@ module OpenReceive
369
365
  end
370
366
 
371
367
  def log_api_request(path, body = {})
372
- @api_request_logger&.call("provider" => @name, "path" => path, "body" => body)
368
+ @api_request_logger&.call(
369
+ "provider" => @name, "path" => path, "has_body" => !body.empty?,
370
+ "has_token" => body.is_a?(Hash) && !body["token"].nil?
371
+ )
373
372
  rescue StandardError
374
373
  nil
375
374
  end
@@ -377,7 +376,7 @@ module OpenReceive
377
376
  def log_api_response(path:, status:, ok:, code: nil, msg: nil, data: nil)
378
377
  @api_response_logger&.call(
379
378
  "provider" => @name, "path" => path, "status" => status, "ok" => ok,
380
- "code" => code, "msg" => msg, "data" => data
379
+ "code" => code.is_a?(Numeric) ? code : nil, "has_data" => !data.nil?
381
380
  )
382
381
  rescue StandardError
383
382
  nil
@@ -600,7 +599,10 @@ module OpenReceive
600
599
 
601
600
  # FixedFloat reports the USD equivalents of both sides of the
602
601
  # exchange; their gap is the swap fee the payer absorbs, so both are
603
- # surfaced to explain the price.
602
+ # surfaced to explain the price. pay_in_fiat is a VALUATION, never an
603
+ # amount a payer is told to send: deposit_amount is the only such
604
+ # amount, and the checkout does not render pay_in_fiat at all for a
605
+ # USD stablecoin (it reads as the deposit amount with a typo).
604
606
  def read_order_fee(record)
605
607
  pay_in_fiat = read_nested_string(record, %w[from usd])
606
608
  payout_fiat = read_nested_string(record, %w[to usd])
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OpenReceive
4
4
  module Server
5
- VERSION = "0.4.9"
5
+ VERSION = "0.4.11"
6
6
  end
7
7
  end
@@ -70,6 +70,14 @@ same diagnostics redacted, always exit 0 — safe to share.
70
70
  - Refunds exist only for swap deposits from `refund_required`. There is **no
71
71
  Lightning refund** — the wallet cannot spend. Do not chase one.
72
72
  https://openreceive.org/guides/swap-refunds.md
73
+ - "Payer reports two different amounts on a stablecoin checkout" (50.05 or
74
+ 50.03?): the deposit amount is a token quantity, `fee.pay_in_fiat` is its
75
+ fiat valuation. Only `swap.deposit_amount` is an instruction. From 0.4.10 the
76
+ packaged checkout renders a USD stablecoin's breakdown in the token and never
77
+ shows `pay_in_fiat`; on an older bundle, upgrade `@openreceive/*`. To verify,
78
+ read the row's `deposit_amount` and `fee` and confirm the UI shows only the
79
+ deposit amount. A custom UI must call `createSwapFeeBreakdown(fee, swap)`
80
+ with the swap, not the fee alone.
73
81
 
74
82
  ## 6. Checkout UI shows nothing
75
83
 
@@ -86,6 +86,17 @@ state; do not retry-loop it, and do not build an idempotency store around it —
86
86
  that serialization is the library's job. (A hook failure while persisting an
87
87
  attempt is a **503 retryable**, deliberately distinct.)
88
88
 
89
+ ## Amounts on the deposit panel
90
+
91
+ `swap.deposit_amount` is the ONLY amount a payer is ever told to send, in the
92
+ pay-in token. `swap.fee.pay_in_fiat` / `payout_fiat` are fiat valuations that
93
+ explain the spread (why the deposit exceeds the cart total); they are not
94
+ instructions. For a stablecoin pegged to the fee currency (USDT, USDC) the
95
+ packaged checkout expresses the breakdown in the token and never renders
96
+ `pay_in_fiat` — "$50.03" under "50.05 USDC" reads as the same number with a
97
+ typo. A custom UI gets the same rule from `createSwapFeeBreakdown(fee, swap)`;
98
+ pass the swap, not just the fee.
99
+
89
100
  ## Secrets
90
101
 
91
102
  `NWC_URI` and `LSC_URI_*` are server-only. Never put them in browser code,
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (BTCPay Server)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Connect a BTCPay Server store to a receive-only NWC wallet with the OpenReceive
6
6
  plugin, and optionally let payers pay BTCPay invoices with USDT, USDC, ETH or
@@ -32,7 +32,7 @@ refund path on the same checkout screen.
32
32
 
33
33
  ## Step 0 — check the deployment before you change anything
34
34
 
35
- 1. Confirm the BTCPay Server version is 2.4.2 or later (Server Settings →
35
+ 1. Confirm the BTCPay Server version is 2.4.4 or later (Server Settings →
36
36
  About, or `GET /api/v1/server/info`). The plugin declares that minimum and
37
37
  BTCPay refuses to load it below.
38
38
  2. Check whether the plugin is installed (Server Settings → Plugins, or the
@@ -119,6 +119,8 @@ enough; drop the `.md` for the same page a person would read.
119
119
  Questions, or a problem with the plugin itself:
120
120
  https://openreceive.org/contact
121
121
 
122
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
123
+
122
124
  ---
123
125
 
124
126
  ## The quickstart, in full
@@ -128,7 +130,7 @@ passes. The page it comes from is https://openreceive.org/guides/quickstart-btcp
128
130
 
129
131
  ## BTCPay Server quickstart
130
132
 
131
- Requires BTCPay Server ≥ 2.4.2.
133
+ Requires BTCPay Server ≥ 2.4.4.
132
134
 
133
135
  The OpenReceive plugin makes a receive-only NWC wallet the Lightning node of a
134
136
  BTCPay store. BTCPay mints every Lightning invoice in that wallet and records
@@ -143,7 +145,7 @@ invoices, checkout, webhooks and Greenfield API are the host.
143
145
 
144
146
  ### 1. Prerequisites
145
147
 
146
- - A BTCPay Server, version 2.4.2 or later, on any network (mainnet, testnet,
148
+ - A BTCPay Server, version 2.4.4 or later, on any network (mainnet, testnet,
147
149
  signet, regtest). The wallet must be on the same network.
148
150
  - A receive-only NWC code for the wallet you want to receive into
149
151
  ([get one here](https://openreceive.org/get_a_nwc_code_to_receive_payments)).
@@ -157,9 +159,9 @@ invoices, checkout, webhooks and Greenfield API are the host.
157
159
 
158
160
  In BTCPay, open **Server Settings → Plugins**, search the plugin directory
159
161
  for **OpenReceive**, click **Install**, and restart BTCPay when prompted.
160
- BTCPay creates the plugin's one table (`openreceive_swaps`, schema
161
- `BTCPayServer.Plugins.OpenReceive`) in its own Postgres at startup; nothing
162
- else is created.
162
+ BTCPay creates the plugin's two tables (`openreceive_invoices` and
163
+ `openreceive_swaps`, schema `BTCPayServer.Plugins.OpenReceive`) in its own
164
+ Postgres at startup; nothing else is created.
163
165
 
164
166
  To build the plugin from source instead, follow
165
167
  [the .NET workspace README](https://github.com/OpenReceive/openreceive/blob/master/packages/dotnet/README.md).
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Django)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a Django project — the app you are already working in. You
6
6
  do not need a copy of the OpenReceive source: the Python package is on PyPI
@@ -130,7 +130,7 @@ itself, and they hold for every integration.
130
130
  a placeholder that allows everything (`manage.py check` warns
131
131
  `openreceive.W002` while it is set) — replace it with this app's real
132
132
  ownership check, same as `on_paid`.
133
- - `on_paid` must be idempotent. It runs once per `reference` — your order
133
+ - `on_paid` must be idempotent. Its database fulfillment commits once per `reference` — your order
134
134
  id, one per thing you fulfill, created before checkout, kept across retries,
135
135
  never reused. A fresh id per page load lets one order be paid twice.
136
136
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -231,6 +231,13 @@ built on `@openreceive/browser/headless`. Read that before writing components.
231
231
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
232
232
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
233
233
  the model gives it.
234
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
235
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
236
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
237
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
238
+ (`payout_fiat`); express "you send" and the fee in the token. Use
239
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
240
+ it applies this for you; SOL and ETH keep a fiat breakdown.
234
241
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
235
242
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
236
243
  `startSwap` reports through `onError`.
@@ -300,6 +307,8 @@ enough; drop the `.md` for the same page a person would read.
300
307
  Questions, or a problem with the library itself:
301
308
  https://openreceive.org/contact
302
309
 
310
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
311
+
303
312
  ---
304
313
 
305
314
  ## The quickstart, in full
@@ -473,7 +482,7 @@ The host class needs three things: authorization, the trusted price, and
473
482
  fulfillment. All three receive the `reference` — a string you choose, and the
474
483
  fulfillment identity: your order id, one per thing you fulfill, created before
475
484
  checkout, kept across retries, never reused. OpenReceive never looks inside
476
- it, but `on_paid` runs once per reference, a new checkout under a reference
485
+ it, but `on_paid` commits fulfillment once per reference, a new checkout under a reference
477
486
  that already settled is refused with 409, and a fresh id per page load lets
478
487
  one order be paid twice.
479
488
 
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (FastAPI)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a FastAPI application — the app you are already working in.
6
6
  You do not need a copy of the OpenReceive source: the engine is on PyPI
@@ -116,7 +116,7 @@ itself, and they hold for every integration.
116
116
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
117
117
  the payer made, not proof. Read the Starlette request's session, cookie or
118
118
  auth dependency; never trust a body field.
119
- - `on_paid` must be idempotent. It runs once per `reference` — your order id, one
119
+ - `on_paid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
120
120
  per thing you fulfill, created before checkout, kept across retries, never
121
121
  reused. A fresh id per page load lets one order be paid twice.
122
122
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -228,6 +228,13 @@ components.
228
228
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
229
229
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
230
230
  the model gives it.
231
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
232
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
233
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
234
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
235
+ (`payout_fiat`); express "you send" and the fee in the token. Use
236
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
237
+ it applies this for you; SOL and ETH keep a fiat breakdown.
231
238
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
232
239
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
233
240
  `startSwap` reports through `onError`.
@@ -294,6 +301,8 @@ enough; drop the `.md` for the same page a person would read.
294
301
  Questions, or a problem with the library itself:
295
302
  https://openreceive.org/contact
296
303
 
304
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
305
+
297
306
  ---
298
307
 
299
308
  ## The quickstart, in full
@@ -468,7 +477,7 @@ the `reference`. OpenReceive never prices from payer input.
468
477
  The `reference` is a string you choose, and it is the fulfillment identity:
469
478
  your order id — one per thing you fulfill, created before checkout, kept
470
479
  across retries, never reused. OpenReceive never looks inside it, but `on_paid`
471
- runs once per reference, a new checkout under a reference that already
480
+ commits fulfillment once per reference, a new checkout under a reference that already
472
481
  settled is refused with 409, and a fresh id per page load lets one order be
473
482
  paid twice.
474
483
 
@@ -517,7 +526,7 @@ Content-Security-Policy has a strict `img-src`, allow `data:`
517
526
  ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets)).
518
527
 
519
528
  That is the whole loop: your server owns the price and the order, the payer gets
520
- an invoice, and `onPaid` runs once inside the settlement transaction.
529
+ an invoice, and `onPaid` runs inside the settlement transaction. Rolled-back transactions may retry the callback; use a host outbox for external delivery.
521
530
 
522
531
  A page without a bundler renders the same checkout as a custom element:
523
532
  `<openreceive-checkout reference="…" prefix="/openreceive">` from
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Fastify)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a Fastify application — the app you are already working in.
6
6
  You do not need a copy of the OpenReceive source: the packages are on npm, and
@@ -107,7 +107,7 @@ itself, and they hold for every integration.
107
107
  payer-supplied amounts.
108
108
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
109
109
  the payer made, not proof. Read a framework session; never trust a body field.
110
- - `onPaid` must be idempotent. It runs once per `reference` — your order id, one
110
+ - `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
111
111
  per thing you fulfill, created before checkout, kept across retries, never
112
112
  reused. A fresh id per page load lets one order be paid twice.
113
113
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -211,6 +211,13 @@ components.
211
211
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
212
212
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
213
213
  the model gives it.
214
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
215
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
216
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
217
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
218
+ (`payout_fiat`); express "you send" and the fee in the token. Use
219
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
220
+ it applies this for you; SOL and ETH keep a fiat breakdown.
214
221
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
215
222
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
216
223
  `startSwap` reports through `onError`.
@@ -277,6 +284,8 @@ enough; drop the `.md` for the same page a person would read.
277
284
  Questions, or a problem with the library itself:
278
285
  https://openreceive.org/contact
279
286
 
287
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
288
+
280
289
  ---
281
290
 
282
291
  ## The quickstart, in full
@@ -470,7 +479,7 @@ the `reference`. OpenReceive never prices from payer input.
470
479
  The `reference` is a string you choose, and it is the fulfillment identity:
471
480
  your order id — one per thing you fulfill, created before checkout, kept
472
481
  across retries, never reused. OpenReceive never looks inside it, but `onPaid`
473
- runs once per reference, a new checkout under a reference that already
482
+ commits fulfillment once per reference, a new checkout under a reference that already
474
483
  settled is refused with 409, and a fresh id per page load lets one order be
475
484
  paid twice.
476
485
 
@@ -519,7 +528,7 @@ Content-Security-Policy has a strict `img-src`, allow `data:`
519
528
  ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets)).
520
529
 
521
530
  That is the whole loop: your server owns the price and the order, the payer gets
522
- an invoice, and `onPaid` runs once inside the settlement transaction.
531
+ an invoice, and `onPaid` runs inside the settlement transaction. Rolled-back transactions may retry the callback; use a host outbox for external delivery.
523
532
 
524
533
  A runnable illustration of this boundary — not a template to copy models from —
525
534
  is Buy a Button
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Laravel)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a Laravel application — the app you are already working in.
6
6
  You do not need a copy of the OpenReceive source: the package is on Packagist
@@ -121,7 +121,7 @@ itself, and they hold for every integration.
121
121
  scaffolds `use AllowAllAuthorize;`, a placeholder trait that allows
122
122
  everything (the engine warns at boot while it is there) — replace it with
123
123
  this app's real ownership check, same as `onPaid`.
124
- - `onPaid` must be idempotent. It runs once per `reference` — your order
124
+ - `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order
125
125
  id, one per thing you fulfill, created before checkout, kept across retries,
126
126
  never reused. A fresh id per page load lets one order be paid twice.
127
127
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -216,6 +216,13 @@ built on `@openreceive/browser/headless`. Read that before writing components.
216
216
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
217
217
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
218
218
  the model gives it.
219
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
220
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
221
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
222
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
223
+ (`payout_fiat`); express "you send" and the fee in the token. Use
224
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
225
+ it applies this for you; SOL and ETH keep a fiat breakdown.
219
226
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
220
227
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
221
228
  `startSwap` reports through `onError`.
@@ -284,6 +291,8 @@ enough; drop the `.md` for the same page a person would read.
284
291
  Questions, or a problem with the library itself:
285
292
  https://openreceive.org/contact
286
293
 
294
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
295
+
287
296
  ---
288
297
 
289
298
  ## The quickstart, in full
@@ -449,7 +458,7 @@ variable as set/unset only.
449
458
  price, and fulfillment. All three receive the `reference` — a string you
450
459
  choose, and the fulfillment identity: your order id, one per thing you
451
460
  fulfill, created before checkout, kept across retries, never reused.
452
- OpenReceive never looks inside it, but `onPaid` runs once per reference, a new
461
+ OpenReceive never looks inside it, but `onPaid` commits fulfillment once per reference, a new
453
462
  checkout under a reference that already settled is refused with 409, and a
454
463
  fresh id per page load lets one order be paid twice.
455
464
 
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Next.js)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a Next.js App Router application — the app you are already
6
6
  working in. You do not need a copy of the OpenReceive source: the packages are
@@ -109,7 +109,7 @@ itself, and they hold for every integration.
109
109
  payer-supplied amounts.
110
110
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
111
111
  the payer made, not proof. Read a framework session; never trust a body field.
112
- - `onPaid` must be idempotent. It runs once per `reference` — your order id, one
112
+ - `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
113
113
  per thing you fulfill, created before checkout, kept across retries, never
114
114
  reused. A fresh id per page load lets one order be paid twice.
115
115
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -217,6 +217,13 @@ components.
217
217
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
218
218
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
219
219
  the model gives it.
220
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
221
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
222
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
223
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
224
+ (`payout_fiat`); express "you send" and the fee in the token. Use
225
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
226
+ it applies this for you; SOL and ETH keep a fiat breakdown.
220
227
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
221
228
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
222
229
  `startSwap` reports through `onError`.
@@ -283,6 +290,8 @@ enough; drop the `.md` for the same page a person would read.
283
290
  Questions, or a problem with the library itself:
284
291
  https://openreceive.org/contact
285
292
 
293
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
294
+
286
295
  ---
287
296
 
288
297
  ## The quickstart, in full
@@ -489,7 +498,7 @@ the `reference`. OpenReceive never prices from payer input.
489
498
  The `reference` is a string you choose, and it is the fulfillment identity:
490
499
  your order id — one per thing you fulfill, created before checkout, kept
491
500
  across retries, never reused. OpenReceive never looks inside it, but `onPaid`
492
- runs once per reference, a new checkout under a reference that already
501
+ commits fulfillment once per reference, a new checkout under a reference that already
493
502
  settled is refused with 409, and a fresh id per page load lets one order be
494
503
  paid twice.
495
504
 
@@ -569,7 +578,7 @@ Content-Security-Policy has a strict `img-src`, allow `data:`
569
578
  ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets)).
570
579
 
571
580
  That is the whole loop: your server owns the price and the order, the payer gets
572
- an invoice, and `onPaid` runs once inside the settlement transaction.
581
+ an invoice, and `onPaid` runs inside the settlement transaction. Rolled-back transactions may retry the callback; use a host outbox for external delivery.
573
582
 
574
583
  A runnable illustration of this boundary — not a template to copy models from —
575
584
  is Buy a Button
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Node.js)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a Node application — the app you are already working in. You
6
6
  do not need a copy of the OpenReceive source: the packages are on npm, and the
@@ -104,7 +104,7 @@ itself, and they hold for every integration.
104
104
  payer-supplied amounts.
105
105
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
106
106
  the payer made, not proof. Read a framework session; never trust a body field.
107
- - `onPaid` must be idempotent. It runs once per `reference` — your order id, one
107
+ - `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
108
108
  per thing you fulfill, created before checkout, kept across retries, never
109
109
  reused. A fresh id per page load lets one order be paid twice.
110
110
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -203,6 +203,13 @@ components.
203
203
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
204
204
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
205
205
  the model gives it.
206
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
207
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
208
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
209
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
210
+ (`payout_fiat`); express "you send" and the fee in the token. Use
211
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
212
+ it applies this for you; SOL and ETH keep a fiat breakdown.
206
213
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
207
214
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
208
215
  `startSwap` reports through `onError`.
@@ -269,6 +276,8 @@ enough; drop the `.md` for the same page a person would read.
269
276
  Questions, or a problem with the library itself:
270
277
  https://openreceive.org/contact
271
278
 
279
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
280
+
272
281
  ---
273
282
 
274
283
  ## The quickstart, in full
@@ -447,7 +456,7 @@ the `reference`. OpenReceive never prices from payer input.
447
456
  The `reference` is a string you choose, and it is the fulfillment identity:
448
457
  your order id — one per thing you fulfill, created before checkout, kept
449
458
  across retries, never reused. OpenReceive never looks inside it, but `onPaid`
450
- runs once per reference, a new checkout under a reference that already
459
+ commits fulfillment once per reference, a new checkout under a reference that already
451
460
  settled is refused with 409, and a fresh id per page load lets one order be
452
461
  paid twice.
453
462
 
@@ -496,7 +505,7 @@ Content-Security-Policy has a strict `img-src`, allow `data:`
496
505
  ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets)).
497
506
 
498
507
  That is the whole loop: your server owns the price and the order, the payer gets
499
- an invoice, and `onPaid` runs once inside the settlement transaction.
508
+ an invoice, and `onPaid` runs inside the settlement transaction. Rolled-back transactions may retry the callback; use a host outbox for external delivery.
500
509
 
501
510
  A runnable illustration of this boundary — not a template to copy models from —
502
511
  is Buy a Button
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (PHP)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a PHP application — the app you are already working in. You
6
6
  do not need a copy of the OpenReceive source: the engine is on Packagist
@@ -125,7 +125,7 @@ itself, and they hold for every integration.
125
125
  is a placeholder that allows everything (the engine warns at boot while a
126
126
  host uses it) — replace it with this app's real ownership check, same as
127
127
  `onPaid`'s `Hosts\LoggingOnPaid`.
128
- - `onPaid` must be idempotent. It runs once per `reference` — your order id, one
128
+ - `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
129
129
  per thing you fulfill, created before checkout, kept across retries, never
130
130
  reused. A fresh id per page load lets one order be paid twice.
131
131
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -229,6 +229,13 @@ of https://openreceive.org/guides/checkout-ux.md, for a UI built on
229
229
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
230
230
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
231
231
  the model gives it.
232
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
233
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
234
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
235
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
236
+ (`payout_fiat`); express "you send" and the fee in the token. Use
237
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
238
+ it applies this for you; SOL and ETH keep a fiat breakdown.
232
239
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
233
240
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
234
241
  `startSwap` reports through `onError`.
@@ -294,6 +301,8 @@ enough; drop the `.md` for the same page a person would read.
294
301
  Questions, or a problem with the library itself:
295
302
  https://openreceive.org/contact
296
303
 
304
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
305
+
297
306
  ---
298
307
 
299
308
  ## The quickstart, in full
@@ -505,7 +514,7 @@ prices with exact decimal math, and returns the order id the page will pass as
505
514
  the `reference`. OpenReceive never prices from payer input. The `reference` is
506
515
  a string you choose, and it is the fulfillment identity: your order id — one
507
516
  per thing you fulfill, created before checkout, kept across retries, never
508
- reused. `onPaid` runs once per reference, a new checkout under a reference
517
+ reused. `onPaid` commits fulfillment once per reference, a new checkout under a reference
509
518
  that already settled is refused with 409, and a fresh id per page load lets
510
519
  one order be paid twice.
511
520
 
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Rails)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Add OpenReceive to a Rails application — the app you are already working in. You
6
6
  do not need a copy of the OpenReceive source: the gem is on RubyGems, the
@@ -116,7 +116,7 @@ itself, and they hold for every integration.
116
116
  body field. The generator installs `OpenReceive::ALLOW_ALL_AUTHORIZE`, a
117
117
  placeholder that allows everything (the engine warns at boot while it is
118
118
  set) — replace it with this app's real ownership check, same as `on_paid`.
119
- - `config.on_paid` must be idempotent. It runs once per `reference` — your order
119
+ - `config.on_paid` must be idempotent. Its database fulfillment commits once per `reference` — your order
120
120
  id, one per thing you fulfill, created before checkout, kept across retries,
121
121
  never reused. A fresh id per page load lets one order be paid twice.
122
122
  - Receive-only NWC is required; a spend-capable code fails closed at boot unless
@@ -210,6 +210,13 @@ built on `@openreceive/browser/headless`. Read that before writing components.
210
210
  - `createSwapDisplayModel` → `display.copyRows` for deposits: address, memo,
211
211
  and the bare amount each get a copy row. Render `swap.networkWarning*` as
212
212
  the model gives it.
213
+ - `swap.deposit_amount` is the only amount a payer is told to send. Never put
214
+ a fiat valuation of it (`swap.fee.pay_in_fiat`) next to a stablecoin amount:
215
+ "$50.03" under "50.05 USDC" reads as a typo, and the payer asks which one to
216
+ send. The one fiat figure on a USDT/USDC deposit panel is the cart total
217
+ (`payout_fiat`); express "you send" and the fee in the token. Use
218
+ `createSwapFeeBreakdown(fee, swap)` — with the swap, not the fee alone — and
219
+ it applies this for you; SOL and ETH keep a fiat breakdown.
213
220
  - `createCheckoutSession` owns mint and swap start. To start swaps, pass its
214
221
  `swap` option (`selection`, `prefix`, `fetch`) together. Without it
215
222
  `startSwap` reports through `onError`.
@@ -278,6 +285,8 @@ enough; drop the `.md` for the same page a person would read.
278
285
  Questions, or a problem with the library itself:
279
286
  https://openreceive.org/contact
280
287
 
288
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
289
+
281
290
  ---
282
291
 
283
292
  ## The quickstart, in full
@@ -425,7 +434,7 @@ The initializer needs three things: authorization, the trusted price, and
425
434
  fulfillment. All three receive the `reference` — a string you choose, and the
426
435
  fulfillment identity: your order id, one per thing you fulfill, created before
427
436
  checkout, kept across retries, never reused. OpenReceive never looks inside
428
- it, but `on_paid` runs once per reference, a new checkout under a reference
437
+ it, but `on_paid` commits fulfillment once per reference, a new checkout under a reference
429
438
  that already settled is refused with 409, and a fresh id per page load lets
430
439
  one order be paid twice.
431
440
 
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (WordPress + WooCommerce)
2
2
 
3
- These directions describe OpenReceive 0.4.9.
3
+ These directions describe OpenReceive 0.4.11.
4
4
 
5
5
  Install and configure the OpenReceive gateway in the existing WooCommerce
6
6
  store. Preserve its theme, checkout, customer accounts, order model and prices.
@@ -73,6 +73,8 @@ flows; a receive-only NWC wallet cannot send payments.
73
73
  - [Agent Directions: BTCPay Server](https://openreceive.org/guides/agent-directions-btcpay.md)
74
74
  - [WordPress + WooCommerce Quickstart](https://openreceive.org/guides/quickstart-woocommerce.md)
75
75
 
76
+ - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
77
+
76
78
  ---
77
79
 
78
80
  ## The quickstart, in full
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openreceive-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenReceive
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.4.9
18
+ version: 0.4.11
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.4.9
25
+ version: 0.4.11
26
26
  description: |
27
27
  Accept Bitcoin Lightning payments directly into a wallet you control, from your
28
28
  Ruby or Rack application. OpenReceive provides invoice creation, payment checks,