openreceive 0.4.31 → 0.4.33

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/lib/openreceive/nwc_ruby.rb +27 -0
  4. data/lib/openreceive/version.rb +1 -1
  5. data/skills/debug-openreceive-payment/SKILL.md +1 -0
  6. data/skills/integrate-openreceive/references/astro.md +35 -12
  7. data/skills/integrate-openreceive/references/bolt.md +3 -3
  8. data/skills/integrate-openreceive/references/btcpay.md +2 -1
  9. data/skills/integrate-openreceive/references/django.md +28 -8
  10. data/skills/integrate-openreceive/references/edd.md +12 -10
  11. data/skills/integrate-openreceive/references/fastapi.md +54 -30
  12. data/skills/integrate-openreceive/references/fastify.md +39 -13
  13. data/skills/integrate-openreceive/references/flask.md +38 -12
  14. data/skills/integrate-openreceive/references/fossbilling.md +25 -15
  15. data/skills/integrate-openreceive/references/laravel.md +36 -7
  16. data/skills/integrate-openreceive/references/lovable.md +2 -2
  17. data/skills/integrate-openreceive/references/medusa.md +2 -1
  18. data/skills/integrate-openreceive/references/mobile.md +2 -1
  19. data/skills/integrate-openreceive/references/nestjs.md +36 -12
  20. data/skills/integrate-openreceive/references/next.md +55 -29
  21. data/skills/integrate-openreceive/references/node.md +46 -14
  22. data/skills/integrate-openreceive/references/nuxt.md +35 -12
  23. data/skills/integrate-openreceive/references/odoo.md +13 -12
  24. data/skills/integrate-openreceive/references/paymenter.md +11 -7
  25. data/skills/integrate-openreceive/references/php.md +35 -10
  26. data/skills/integrate-openreceive/references/prestashop.md +28 -18
  27. data/skills/integrate-openreceive/references/rails.md +44 -13
  28. data/skills/integrate-openreceive/references/react-router.md +35 -12
  29. data/skills/integrate-openreceive/references/sveltekit.md +43 -14
  30. data/skills/integrate-openreceive/references/tanstack-start.md +35 -12
  31. data/skills/integrate-openreceive/references/vendure.md +2 -1
  32. data/skills/integrate-openreceive/references/woocommerce.md +17 -11
  33. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e14b1d9f9ff049eeb46e718b76e4f22ed33c762e18a395191d5a3644f9099d06
4
- data.tar.gz: 86668b11e568545b70037fe04d7bd0a48e10f6e8bf4c0cc611dcceddd1c716a3
3
+ metadata.gz: 0ecb8b6bdddd85ccabd387c9ebe3e23653c2eb5ca181d393c8504d82d2fdfa61
4
+ data.tar.gz: 35199d0141a530f5e319180c3a64023397f4782e979a9b018974b2d580752560
5
5
  SHA512:
6
- metadata.gz: 408b766d25f9ab3f488cacb2a3f144804d93e1ad3c596275f5542e80399eac04203399c4e4b5d410b8f76d3c823d4857a3e39e6f74bbefd281366af634e44efb
7
- data.tar.gz: e68e45763fa2e972e199ea036496a6c7d865e572763398b0fab0cd1e06c97e3c4016fb759606575354a88b0a70ed18f62c245bbae1e29a8cc406ba20ebbce71f
6
+ metadata.gz: 57214c610d1684e8f604e57b2e0739fb000f520e24a044b3335c0e9ad2e75a0fe40b7629c261ea9fd4731c1bd7ff8c71a335b56397b0efec9b9ab83eddad514b
7
+ data.tar.gz: 6a05dd9a08971b9af0a3e79966461819698a249eddd1f14ffece00f0c03bd0fe1c0f1ce87c6209cfdba6d07bb87fceb229b74c8b41b841486c6e418f69eb924c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.33 - 2026-11-09
4
+
5
+ - Added: `OpenReceive::NwcRubyReceiveClient.from_uri` builds the wallet client
6
+ a Rack host passes to `OpenReceive::Server::Service`.
7
+ - Fixed: a relay that accepts the connection and never answers now costs 12 s
8
+ instead of 30 s (`NwcRubyReceiveClient::REQUEST_TIMEOUT_SECONDS`).
9
+
10
+ ## 0.4.32 - 2026-11-07
11
+
12
+ Release with the complete 0.4.32 package family. No Ruby runtime changes
13
+ from 0.4.31.
14
+
3
15
  ## 0.4.31 - 2026-10-20
4
16
 
5
17
  Release with the complete 0.4.31 package family. The gem's summary names
@@ -14,8 +14,35 @@ module OpenReceive
14
14
  # declares snake_case keyword arguments, and spells the list_transactions
15
15
  # window `until_ts` because `until` is a Ruby keyword.
16
16
  class NwcRubyReceiveClient
17
+ # nwc-ruby's `request_timeout:` is one budget per call: the info fetch,
18
+ # the relay handshake and the wallet's reply. Its default of 30 s is how
19
+ # long a checkout waited for its 503 on a relay that accepts the connection
20
+ # and never answers. 12 s brings that near the other engines (Python
21
+ # 10 s, Node 8 s, PHP about 6 s) and still leaves a slow wallet room:
22
+ # relay handshakes measured 0.6 to 3.2 s, a call that has not read the
23
+ # info event yet makes two of them (the info event, then the request),
24
+ # and the wallet's own make_invoice reply takes a few seconds more. A
25
+ # relay that refuses fails fast either way; the gem retries it inside the
26
+ # same budget.
27
+ REQUEST_TIMEOUT_SECONDS = 12
28
+
17
29
  attr_reader :redacted_connection_uri
18
30
 
31
+ # The adapter over a nwc-ruby client built from a connection URI, with
32
+ # REQUEST_TIMEOUT_SECONDS. The Rails engine builds its default client here;
33
+ # a Rack host passes the result to OpenReceive::Server::Service. Requires
34
+ # the nwc-ruby gem, which this gem does not depend on.
35
+ def self.from_uri(connection_uri, request_timeout: REQUEST_TIMEOUT_SECONDS, **options)
36
+ # The engine's own parser first, so a malformed code fails as
37
+ # OpenReceive::NwcUriParseError, not as whatever the gem raises.
38
+ OpenReceive.parse_nwc_uri(connection_uri)
39
+ require "nwc_ruby"
40
+ new(
41
+ client: ::NwcRuby::Client.from_uri(connection_uri, request_timeout: request_timeout, **options),
42
+ connection_uri: connection_uri
43
+ )
44
+ end
45
+
19
46
  def initialize(client:, connection_uri: nil)
20
47
  @client = client
21
48
  @redacted_connection_uri = connection_uri.nil? ? nil : OpenReceive.redact_nwc_uri(connection_uri)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenReceive
4
- VERSION = "0.4.31"
4
+ VERSION = "0.4.33"
5
5
  end
@@ -19,6 +19,7 @@ URL below is raw markdown — fetch it when the step needs it.
19
19
  npx openreceive doctor # Node version, NWC_URI, swap config, wallet probe
20
20
  npx openreceive doctor --db <db> # + are openreceive_payments/openreceive_meta migrated?
21
21
  npx openreceive doctor --url http://localhost:3000 # + are the routes actually mounted?
22
+ npx openreceive doctor --scan-build <dir> # alone, after a production build: did a code reach it?
22
23
  bin/rails openreceive:doctor # Rails
23
24
  manage.py openreceive_doctor # Django
24
25
  openreceive doctor --app main:app # FastAPI
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (Astro)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 35 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 37 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/astro/full.md
8
+ # If your tool cuts long output, save it and read it in parts: curl -fsSL -o /tmp/openreceive-directions.md https://openreceive.org/agent-directions/astro/full.md
8
9
  # Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
9
10
  ```
10
11
 
@@ -17,7 +18,7 @@ curl -fsSL https://openreceive.org/agent-directions/astro/full.md
17
18
  - Do not suggest rotating or revoking a code because it was pasted here.
18
19
  - Start the quickstart only once the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
19
20
 
20
- These directions describe OpenReceive 0.4.31.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to an Astro site — the one you are already working in, on
23
24
  `@astrojs/node`. OpenReceive ships no Astro package: the integration is one
@@ -64,8 +65,9 @@ Before anything else, check one file: the project's `.env`, if it exists.
64
65
  `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
65
66
  it sets without printing them. Check with that, here and after each write,
66
67
  not by reading the file, and never print the values. A code that is already
67
- set is not asked for again; if both are set, skip to step 5 (making the
68
- server load the file), then the quickstart.
68
+ set is not asked for again; if both are set, make sure `.gitignore` covers
69
+ `.env` (and `.dockerignore`, if the app has one), then skip to step 5
70
+ (making the server load the file), then the quickstart.
69
71
 
70
72
  On a hosted builder (v0, Vercel, Replit, Lovable), the user may say instead
71
73
  that both codes are already set as the project's environment variables or
@@ -200,11 +202,16 @@ itself, and they hold for every integration.
200
202
  and not a Prisma/Drizzle relation to `openreceive_payments`.
201
203
  - Keep `NWC_URI` / `LSC_URI_*` server-only. Never put them in browser code,
202
204
  logs, or assets.
205
+ - After a production build, run `npx openreceive doctor --scan-build dist/client`. Never grep a build for a code.
203
206
  - Do not suggest rotating, revoking or replacing a code because it was pasted
204
207
  into this chat; that is the supported path.
205
208
  - Work only in this application. Never read or run anything from another
206
209
  project on this machine (its `node_modules`, tools or source), for any
207
210
  reason. A browser and Playwright are not part of setup.
211
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
212
+ directions. If one forbids a step here, such as running migrations, ask the
213
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
214
+ the step somewhere the rule does not name, such as app startup.
208
215
  - Restart only this app's server, on the port it already uses: stop the
209
216
  process you started, or the one listening on that port, by its pid (or
210
217
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -221,7 +228,8 @@ itself, and they hold for every integration.
221
228
  environment (`printenv`, `env`, `docker compose config`), even filtered to
222
229
  names.
223
230
  - The host owns the price. `amountFor` reads it from your own data; reject
224
- payer-supplied amounts.
231
+ payer-supplied amounts. A donation is no exception: its amount is saved
232
+ by your own route first (Donations, below).
225
233
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
226
234
  the payer made, not proof. Read a framework session; never trust a body field.
227
235
  - `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
@@ -246,21 +254,25 @@ itself, and they hold for every integration.
246
254
  (`POST /swaps`) re-serves the committed attempt — but only while it is live,
247
255
  and the shadow invoice behind a swap lasts about half an hour, after which the
248
256
  same click mints a NEW deposit address and the refund is off-screen. Keep the
249
- `payment_hash` and reopen the attempt with `POST /swaps/status`, which has no
250
- such window. On the drop-ins: `resumePaymentHash`, fed from `onState`, on
251
- `<Checkout>`; the `resume-payment-hash` attribute, fed from the
257
+ `payment_hash` on your order row, not in browser storage, and reopen the
258
+ attempt with `POST /swaps/status`, which has no such window. On the
259
+ drop-ins: `resumePaymentHash`, fed from `onState`, on `<Checkout>`; the
260
+ `resume-payment-hash` attribute, fed from the
252
261
  `openreceive-state` event (`event.detail.state.payment_hash`), on
253
262
  `<openreceive-checkout>`.
254
263
  That visit can come hours later, and `authorize` must still know the payer:
255
264
  a session that expired in between answers 403 and strands the deposit. On a
256
- guest shop, tie the order to a long-lived signed cookie, or put a secret
257
- per-order token in its URL that your page trades for that cookie.
265
+ guest shop, tie the order to a long-lived cookie signed with the app's own
266
+ secret (such as `SESSION_SECRET`, never a wallet or swap code), or put a
267
+ secret per-order token in its URL that your page trades for that cookie.
258
268
  https://openreceive.org/guides/swap-refunds.md
259
269
  - Show the payer WHAT THEY ARE BUYING. Return an optional `description` beside
260
270
  the price from `amountFor` and both drop-ins render it above the amount.
261
271
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
262
272
  is for.
263
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
273
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
274
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
275
+ no `createTransactionDetails`, and one bad import stops the whole page),
264
276
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
265
277
  hash and a deposit txid are the only evidence a payer has that they paid you.
266
278
  `<Checkout>` / `<openreceive-checkout>` already render this panel and the
@@ -315,6 +327,15 @@ products, and you do not join them.
315
327
  live catalog lookup that could re-price a cart already placed. Return
316
328
  `{ currency, value }` as a decimal STRING, plus a `description` of what they
317
329
  are buying.
330
+ - **Donations and pay-what-you-want are fine.** The amount is the payer's
331
+ choice, so it enters through YOUR route, never OpenReceive's: the donate form
332
+ posts it to your own handler, which checks it and saves it on a new donation
333
+ row, made like an order. That row's id is the `reference`, and `amountFor`
334
+ reads the amount from the row, as it does for an order. Check it in that
335
+ handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
336
+ at most two decimal places. Refuse an amount outside them with a message;
337
+ never round it. Small amounts may be Lightning-only for some coins: the
338
+ checkout says which coins an amount is too small for.
318
339
  - **Users own the order; OpenReceive never sees them.** `authorize` uses the
319
340
  same ownership check this app already uses on the order show / pay page —
320
341
  `context.cookies`, `context.locals.user`, whatever it is. `native` is the
@@ -383,7 +404,9 @@ components.
383
404
  are on `@openreceive/browser`, not `/headless`.
384
405
  - A refund replaces the deposit panel. On `refund_required` also drop
385
406
  "switch payment method".
386
- - No "Open wallet" button on desktop.
407
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
408
+ App cancels an invoice opened from a link and pays the same invoice scanned
409
+ or pasted. Show the QR code and a Copy invoice button.
387
410
  - Wallet suggestions: `getPaymentWizardRoutes()` +
388
411
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
389
412
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -17,7 +17,7 @@ If your fetch tool gave you a summary, fetch that URL again for the full text.
17
17
  - Do not suggest rotating or revoking a code because it was pasted here.
18
18
  - Start Step 1 only once NWC_URI is saved, and LSC_URI_PRIMARY is saved or the user said "Bitcoin only".
19
19
 
20
- These directions describe OpenReceive 0.4.31.
20
+ These directions describe OpenReceive 0.4.33.
21
21
 
22
22
  Add OpenReceive to this Bolt app: a Vite React app on Bolt Cloud, with Bolt
23
23
  Database or a connected Supabase project as its database, and Supabase Edge
@@ -123,8 +123,8 @@ explicitly declined.
123
123
 
124
124
  ## Step 1 — the packages
125
125
 
126
- Add `@openreceive/react` at 0.4.31 or newer to the app's
127
- `package.json`. The function imports `npm:@openreceive/http@^0.4.31`
126
+ Add `@openreceive/react` at 0.4.33 or newer to the app's
127
+ `package.json`. The function imports `npm:@openreceive/http@^0.4.33`
128
128
  and `npm:@supabase/supabase-js@2` directly; add nothing else. (The recipe
129
129
  below writes `^0.4.27`, the oldest release with the `cors` option; both
130
130
  resolve to the newest 0.4.x.) No `pg`, no
@@ -5,6 +5,7 @@ This is the full file; follow it from Step 0.
5
5
  ```sh
6
6
  # READ THIS FIRST: this file is 16 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/btcpay/full.md
8
+ # If your tool cuts long output, save it and read it in parts: curl -fsSL -o /tmp/openreceive-directions.md https://openreceive.org/agent-directions/btcpay/full.md
8
9
  # Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
9
10
  ```
10
11
 
@@ -17,7 +18,7 @@ curl -fsSL https://openreceive.org/agent-directions/btcpay/full.md
17
18
  - Never tick the spend-capable override to make a save succeed.
18
19
  - Do not suggest rotating or revoking a code because it was pasted here.
19
20
 
20
- These directions describe OpenReceive 0.4.31.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Connect a BTCPay Server store to a receive-only NWC wallet with the OpenReceive
23
24
  plugin, and optionally let payers pay BTCPay invoices with USDT, USDC, ETH or
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (Django)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 48 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 49 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/django/full.md
8
+ # If your tool cuts long output, save it and read it in parts: curl -fsSL -o /tmp/openreceive-directions.md https://openreceive.org/agent-directions/django/full.md
8
9
  # Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
9
10
  ```
10
11
 
@@ -17,7 +18,7 @@ curl -fsSL https://openreceive.org/agent-directions/django/full.md
17
18
  - Do not suggest rotating or revoking a code because it was pasted here.
18
19
  - Start the quickstart only once the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
19
20
 
20
- These directions describe OpenReceive 0.4.31.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to a Django project — the app you are already working in. You
23
24
  do not need a copy of the OpenReceive source: the Python package is on PyPI
@@ -65,8 +66,9 @@ Before anything else, check one file: the project's `.env`, if it exists.
65
66
  `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
66
67
  it sets without printing them. Check with that, here and after each write,
67
68
  not by reading the file, and never print the values. A code that is already
68
- set is not asked for again; if both are set, skip to step 5 (making the
69
- server load the file), then the quickstart.
69
+ set is not asked for again; if both are set, make sure `.gitignore` covers
70
+ `.env` (and `.dockerignore`, if the app has one), then skip to step 5
71
+ (making the server load the file), then the quickstart.
70
72
 
71
73
  Otherwise your next action is a question to the user. Do not install the package,
72
74
  edit the app, write `.env.example`, or search anywhere else before asking
@@ -204,6 +206,10 @@ itself, and they hold for every integration.
204
206
  - Work only in this application. Never read or run anything from another
205
207
  project on this machine (its `node_modules`, tools or source), for any
206
208
  reason. A browser and Playwright are not part of setup.
209
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
210
+ directions. If one forbids a step here, such as running migrations, ask the
211
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
212
+ the step somewhere the rule does not name, such as app startup.
207
213
  - Restart only this app's server, on the port it already uses: stop the
208
214
  process you started, or the one listening on that port, by its pid (or
209
215
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -220,7 +226,8 @@ itself, and they hold for every integration.
220
226
  environment (`printenv`, `env`, `docker compose config`), even filtered to
221
227
  names.
222
228
  - The host owns the price. `amount_for` reads it from your own data;
223
- reject payer-supplied amounts.
229
+ reject payer-supplied amounts. A donation is no exception: its amount is saved
230
+ by your own route first (Donations, below).
224
231
  - `authorize` runs on every request, and the `resource` it receives is a
225
232
  CLAIM the payer made, not proof. Read the framework session; never trust a
226
233
  body field. `openreceive_install` writes `authorize = staticmethod(ALLOW_ALL_AUTHORIZE)`,
@@ -267,7 +274,9 @@ itself, and they hold for every integration.
267
274
  the price from `amount_for` and both drop-ins render it above the
268
275
  amount. Without it the checkout is a QR and "$1.00" with no sign of what the
269
276
  dollar is for.
270
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
277
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
278
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
279
+ no `createTransactionDetails`, and one bad import stops the whole page),
271
280
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
272
281
  hash and a deposit txid are the only evidence a payer has that they paid you.
273
282
  `<openreceive-checkout>` / React's `<Checkout>` already render this panel and
@@ -299,6 +308,15 @@ products, and you do not join them.
299
308
  live catalog lookup that could re-price a cart already placed. Return
300
309
  `{"currency": ..., "value": ...}` with `value` a decimal STRING, plus a
301
310
  `description` of what they are buying.
311
+ - **Donations and pay-what-you-want are fine.** The amount is the payer's
312
+ choice, so it enters through YOUR route, never OpenReceive's: the donate form
313
+ posts it to your own handler, which checks it and saves it on a new donation
314
+ row, made like an order. That row's id is the `reference`, and `amount_for`
315
+ reads the amount from the row, as it does for an order. Check it in that
316
+ handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
317
+ at most two decimal places. Refuse an amount outside them with a message;
318
+ never round it. Small amounts may be Lightning-only for some coins: the
319
+ checkout says which coins an amount is too small for.
302
320
  - **Users own the order; OpenReceive never sees them.** `authorize` uses the
303
321
  same ownership check this app already uses on the order detail / pay view —
304
322
  `request.user`, `request.session`, a signed cookie, whatever it is. Keep
@@ -389,7 +407,9 @@ built on `@openreceive/browser/headless`. Read that before writing components.
389
407
  are on `@openreceive/browser`, not `/headless`.
390
408
  - A refund replaces the deposit panel. On `refund_required` also drop
391
409
  "switch payment method".
392
- - No "Open wallet" button on desktop.
410
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
411
+ App cancels an invoice opened from a link and pays the same invoice scanned
412
+ or pasted. Show the QR code and a Copy invoice button.
393
413
  - Wallet suggestions: `getPaymentWizardRoutes()` +
394
414
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
395
415
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -468,7 +488,7 @@ pip install "openreceive[django]"
468
488
  That is the whole install. `openreceive[django]` brings Django. The base
469
489
  package brings the wallet client (websockets, coincurve, cryptography), the
470
490
  HTTP engine and the `openreceive` CLI. Use `uv` or a virtualenv on Python 3.10
471
- or newer. A system Python 3.9 cannot install it. If your app brings its own NWC
491
+ to 3.13. A system Python 3.9 cannot install it, and 3.14 cannot yet, because `coincurve` has no build for it. If your app brings its own NWC
472
492
  client, set `OPENRECEIVE["SERVICE"]` instead (see below).
473
493
 
474
494
  Then add the app, point it at a host class, and mount the routes:
@@ -5,6 +5,7 @@ This is the full file; follow it from Step 0.
5
5
  ```sh
6
6
  # READ THIS FIRST: this file is 21 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/edd/full.md
8
+ # If your tool cuts long output, save it and read it in parts: curl -fsSL -o /tmp/openreceive-directions.md https://openreceive.org/agent-directions/edd/full.md
8
9
  # Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
9
10
  ```
10
11
 
@@ -17,7 +18,7 @@ curl -fsSL https://openreceive.org/agent-directions/edd/full.md
17
18
  - Do not suggest rotating or revoking a code because it was pasted here.
18
19
  - Setup is done only when the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
19
20
 
20
- These directions describe OpenReceive 0.4.31.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Install and configure the OpenReceive payment gateway in the Easy Digital
23
24
  Downloads (EDD) store you are working in. Preserve its theme, checkout,
@@ -42,7 +43,8 @@ the user through the quickstart's admin screens instead.
42
43
  ## Step 0 — ask for the two codes, one question at a time
43
44
 
44
45
  Before anything else, check one thing: whether OpenReceive is already
45
- installed (`wp plugin is-active openreceive`). If it is, run
46
+ installed (`wp plugin is-active openreceive && echo active || echo "not active"`;
47
+ the bare command answers only with its exit code). If it is, run
46
48
  `wp openreceive doctor`. It prints `NWC_URI: set` or `unset` (likewise
47
49
  `LSC_URI_PRIMARY`), never the values. A code that is already set is not asked
48
50
  for again; if both are set, skip to `wp openreceive configure --enable` at
@@ -96,7 +98,7 @@ is saved or the user said "Bitcoin only". Never invent a placeholder code.
96
98
  Install this release from the WordPress.org plugin directory:
97
99
 
98
100
  ```sh
99
- wp plugin install openreceive --version=0.4.31 --activate
101
+ wp plugin install openreceive --version=0.4.33 --activate
100
102
  ```
101
103
 
102
104
  If that fails because WordPress.org does not have this version yet, install
@@ -104,7 +106,7 @@ the ZIP attached to the same GitHub release. Never install the GitHub
104
106
  source-code ZIP or a ZIP from an older release:
105
107
 
106
108
  ```sh
107
- wp plugin install https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-wordpress-0.4.31.zip --activate
109
+ wp plugin install https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-wordpress-0.4.33.zip --activate
108
110
  ```
109
111
 
110
112
  It needs Easy Digital Downloads active, and PHP 8.2+ with GMP and sodium in
@@ -145,15 +147,14 @@ Create a pending test order for the first published download, billed to the
145
147
  first administrator, and mint its Lightning invoice from the terminal:
146
148
 
147
149
  ```sh
148
- wp openreceive test-invoice --new
150
+ wp openreceive test-invoice --new --amount=20.00
149
151
  ```
150
152
 
151
153
  To use an order that already exists, pass `edd-<order id>` instead of
152
154
  `--new`. `test-invoice` goes through the same checkout route as the purchase
153
155
  confirmation page. It prints the amount in sats, the BOLT11 invoice, the
154
156
  receipt page and the methods that page offers, each swap asset marked
155
- available or followed by the reason it is not. That reason is the answer;
156
- report it. "Below the provider minimum" or "above the provider maximum" is
157
+ available or followed by the reason it is not. That reason is for you, not the user: it says whether anything is wrong, and the last message names no minimum. "Below the provider minimum" or "above the provider maximum" is
157
158
  about this order's amount, not a fault: a small test order is often under a
158
159
  swap minimum. Only when the reason says the provider is unreachable does
159
160
  doctor's "Swap provider" line have more detail. `test-invoice` and `doctor`
@@ -179,8 +180,9 @@ a provider minimum depends on the order total, and the user's own orders will
179
180
  differ. Do not list what you changed or what doctor checked. Send nothing
180
181
  after it. Do not install mail software, add containers or services, or set up
181
182
  cron. If doctor's "Reconcile scheduled" check fails, fix that. On a store with
182
- little traffic, add one sentence to that message: a system cron for WordPress
183
- scheduled work settles orders sooner, and this setup does not add one. State
183
+ little traffic, add one sentence to that message: WordPress runs its every-minute payment check only when someone visits the
184
+ store, so on a quiet store the user's host should call wp-cron.php every
185
+ minute (a system cron); this setup did not add one. State
184
186
  it as a recommendation. Do not offer to set it up or end the message on a
185
187
  question.
186
188
 
@@ -257,7 +259,7 @@ activate it. With WP-CLI, run `wp plugin install openreceive --activate`.
257
259
 
258
260
  Each GitHub release also attaches the plugin as a ZIP, for a site that cannot
259
261
  reach WordPress.org:
260
- [openreceive-wordpress-0.4.31.zip](https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-wordpress-0.4.31.zip).
262
+ [openreceive-wordpress-0.4.33.zip](https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-wordpress-0.4.33.zip).
261
263
  Install it through **Plugins → Add New → Upload Plugin**. The GitHub
262
264
  source-code ZIP is not an installable plugin.
263
265
 
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (FastAPI)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 43 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 45 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/fastapi/full.md
8
+ # If your tool cuts long output, save it and read it in parts: curl -fsSL -o /tmp/openreceive-directions.md https://openreceive.org/agent-directions/fastapi/full.md
8
9
  # Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
9
10
  ```
10
11
 
@@ -17,7 +18,7 @@ curl -fsSL https://openreceive.org/agent-directions/fastapi/full.md
17
18
  - Do not suggest rotating or revoking a code because it was pasted here.
18
19
  - Start the quickstart only once the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
19
20
 
20
- These directions describe OpenReceive 0.4.31.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to a FastAPI application — the app you are already working in.
23
24
  You do not need a copy of the OpenReceive source: the engine is on PyPI
@@ -65,8 +66,9 @@ Before anything else, check one file: the project's `.env`, if it exists.
65
66
  `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
66
67
  it sets without printing them. Check with that, here and after each write,
67
68
  not by reading the file, and never print the values. A code that is already
68
- set is not asked for again; if both are set, skip to step 5 (making the
69
- server load the file), then the quickstart.
69
+ set is not asked for again; if both are set, make sure `.gitignore` covers
70
+ `.env` (and `.dockerignore`, if the app has one), then skip to step 5
71
+ (making the server load the file), then the quickstart.
70
72
 
71
73
  Otherwise your next action is a question to the user. Do not install packages,
72
74
  edit the app, write `.env.example`, or search anywhere else before asking
@@ -124,15 +126,15 @@ you store it. Ask one question per message.
124
126
  5. **Make the server load the file — yourself.** OpenReceive reads
125
127
  `os.environ`, and a `.env` file on disk is not in it. Start the dev server
126
128
  with `uvicorn --env-file .env` (update the app's run script or Procfile, not
127
- just your own command). When it is started with Docker Compose, give the
128
- service `env_file: .env`. Restart the server after writing the file.
129
+ just your own command). Under Docker Compose, give the service
130
+ `env_file: .env` instead, with no `--env-file` in its command: the image
131
+ has no `.env`. Restart the server after writing the file.
129
132
  Under Compose, recreate the container with `docker compose up -d`:
130
133
  `docker compose restart` keeps its old environment.
131
- Doctor needs the file too: run it as
132
- `dotenv -f .env run -- openreceive doctor …`. The `dotenv` command comes
133
- with python-dotenv, which `uvicorn --env-file` already needs; if it is
134
- missing, `pip install "python-dotenv[cli]"`. Never `source`, `export` or
135
- `cat` the file: the codes contain `&`, and the shell prints the pieces.
134
+ Doctor reads `.env` from its working directory by itself. Under Compose,
135
+ run it in the service (`docker compose exec`), which already has the codes:
136
+ never copy `.env` into a container. Never `source`, `export` or `cat` the
137
+ file: the codes contain `&`, and the shell prints the pieces.
136
138
 
137
139
  Do not invent placeholder URIs. Start the quickstart only once `NWC_URI` is
138
140
  saved and `LSC_URI_PRIMARY` is saved or explicitly declined. The first boot
@@ -141,7 +143,7 @@ runs the receive-only preflight: if it reports spend methods such as
141
143
  again. Never set the spend-capable override to get past it.
142
144
 
143
145
  After the router is wired, run
144
- `dotenv -f .env run -- openreceive doctor --app <module>:app`. It reports
146
+ `openreceive doctor --app <module>:app`. It reports
145
147
  `NWC_URI` presence without printing it, probes the wallet, and names
146
148
  any hook still on a placeholder and whether the migration ran. Exit code 1 is a
147
149
  finding to fix, not a reason to skip the check.
@@ -160,8 +162,7 @@ Only then start the quickstart.
160
162
  ## After the quickstart — hand over, then stop
161
163
 
162
164
  The quickstart is done when
163
- `dotenv -f .env run -- openreceive doctor --app <module>:app --url <app url>`
164
- is clean and this app
165
+ `openreceive doctor --app <module>:app --url <app url>` is clean and this app
165
166
  serves the checkout page for one of its orders. Doctor names any failed check
166
167
  and exits nonzero; fix it before going on.
167
168
 
@@ -204,6 +205,10 @@ itself, and they hold for every integration.
204
205
  - Work only in this application. Never read or run anything from another
205
206
  project on this machine (its `node_modules`, tools or source), for any
206
207
  reason. A browser and Playwright are not part of setup.
208
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
209
+ directions. If one forbids a step here, such as running migrations, ask the
210
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
211
+ the step somewhere the rule does not name, such as app startup.
207
212
  - Restart only this app's server, on the port it already uses: stop the
208
213
  process you started, or the one listening on that port, by its pid (or
209
214
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -220,7 +225,8 @@ itself, and they hold for every integration.
220
225
  environment (`printenv`, `env`, `docker compose config`), even filtered to
221
226
  names.
222
227
  - The host owns the price. `amount_for` reads it from your own data; reject
223
- payer-supplied amounts.
228
+ payer-supplied amounts. A donation is no exception: its amount is saved
229
+ by your own route first (Donations, below).
224
230
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
225
231
  the payer made, not proof. Read the Starlette request's session, cookie or
226
232
  auth dependency; never trust a body field.
@@ -260,7 +266,9 @@ itself, and they hold for every integration.
260
266
  the price from `amount_for` and both drop-ins render it above the amount.
261
267
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
262
268
  is for.
263
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
269
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
270
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
271
+ no `createTransactionDetails`, and one bad import stops the whole page),
264
272
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
265
273
  hash and a deposit txid are the only evidence a payer has that they paid you.
266
274
  `<Checkout>` / `<openreceive-checkout>` already render this panel and the
@@ -305,6 +313,15 @@ orders, users, or products, and you do not join them.
305
313
  live catalog lookup that could re-price a cart already placed. Return
306
314
  `{"currency", "value"}` as a decimal STRING, plus a `description` of what
307
315
  they are buying.
316
+ - **Donations and pay-what-you-want are fine.** The amount is the payer's
317
+ choice, so it enters through YOUR route, never OpenReceive's: the donate form
318
+ posts it to your own handler, which checks it and saves it on a new donation
319
+ row, made like an order. That row's id is the `reference`, and `amount_for`
320
+ reads the amount from the row, as it does for an order. Check it in that
321
+ handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
322
+ at most two decimal places. Refuse an amount outside them with a message;
323
+ never round it. Small amounts may be Lightning-only for some coins: the
324
+ checkout says which coins an amount is too small for.
308
325
  - **Users own the order; OpenReceive never sees them.** `authorize` uses the
309
326
  same ownership check this app already uses on the order show / pay page —
310
327
  the `current_user` dependency, a session cookie, whatever it is, resolved
@@ -394,7 +411,9 @@ components.
394
411
  are on `@openreceive/browser`, not `/headless`.
395
412
  - A refund replaces the deposit panel. On `refund_required` also drop
396
413
  "switch payment method".
397
- - No "Open wallet" button on desktop.
414
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
415
+ App cancels an invoice opened from a link and pays the same invoice scanned
416
+ or pasted. Show the QR code and a Copy invoice button.
398
417
  - Wallet suggestions: `getPaymentWizardRoutes()` +
399
418
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
400
419
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -482,8 +501,8 @@ with the Django quickstart. A page without a bundler uses
482
501
  | Server | `openreceive[fastapi]`, `openreceive[django]`, `openreceive[sqlalchemy]` (Flask and plain WSGI/ASGI: [the Flask quickstart](https://openreceive.org/guides/quickstart-flask.md)) |
483
502
  | Frontend | `@openreceive/react`, `@openreceive/vue`, `@openreceive/svelte`, `@openreceive/angular`, `@openreceive/elements` (plain HTML) |
484
503
 
485
- Use `uv` or a virtualenv on Python 3.10 or newer. A system Python 3.9 cannot
486
- install the package.
504
+ Use `uv` or a virtualenv on Python 3.10 to 3.13. A system Python 3.9 cannot
505
+ install the package, and 3.14 cannot yet, because `coincurve` has no build for it.
487
506
 
488
507
  ### 2. Migrate the payment tables
489
508
 
@@ -617,11 +636,14 @@ old browser, is not refused. So `authorize` stays the actual boundary.
617
636
  [Security](https://openreceive.org/guides/security.md) has the full account.
618
637
 
619
638
  `openreceive_lifespan` runs the receive-only wallet preflight when uvicorn
620
- starts. It stops the process if the code is missing, unreachable, or able to
621
- spend. That way the deploy fails instead of the first payer. Pass `lazy=True`
622
- for tests and for build steps that have no secrets. The first request then
623
- checks the wallet, and requests get `503 WALLET_UNAVAILABLE` until the check
624
- passes.
639
+ starts. It stops the process if the code is missing or able to spend. That way
640
+ the deploy fails instead of the first payer. A relay that does not answer at
641
+ start does not stop it: the app starts, logs one line, and checkouts get a
642
+ retryable `503 WALLET_UNAVAILABLE` until the wallet answers. The first
643
+ checkout after a short wait (1 s, doubling to 60 s) checks again, so payments
644
+ come back without a restart. Pass `lazy=True` for tests and for build steps
645
+ that have no secrets. The first request then checks the wallet, and requests
646
+ get `503 WALLET_UNAVAILABLE` until the check passes.
625
647
  → [openreceive_router](https://openreceive.org/guides/api-reference.md#openreceive_router) ·
626
648
  [openreceive_lifespan](https://openreceive.org/guides/api-reference.md#openreceive_lifespan) ·
627
649
  [the authorize context](https://openreceive.org/guides/api-reference.md#host-python)
@@ -705,7 +727,9 @@ A page without a bundler renders the same checkout as a custom element:
705
727
  its standalone build from your static directory: copy
706
728
  `openreceive-checkout.js` and `openreceive-checkout.css` from
707
729
  `node_modules/@openreceive/elements/dist/standalone/` to `static/openreceive/`,
708
- and load both on the checkout page. The `openreceive` package from PyPI carries
730
+ and load both on the checkout page: the JS with `<script type="module">`, because
731
+ it is an ES module and a plain `<script>` tag runs nothing, and the CSS with
732
+ `<link rel="stylesheet">`. The `openreceive` package from PyPI carries
709
733
  the same two files in `openreceive/django/static/openreceive/`, so you can copy
710
734
  them from there without npm.
711
735
 
@@ -719,13 +743,13 @@ shape onto the models in THIS app.
719
743
  ### 6. Verify
720
744
 
721
745
  ```sh
722
- dotenv -f .env run -- openreceive doctor --app main:app
746
+ openreceive doctor --app main:app
723
747
  ```
724
748
 
725
- Doctor reads the process environment. `dotenv -f .env run --` loads `.env`
726
- into it, as `uvicorn --env-file .env` does for the server. The `dotenv`
727
- command comes with python-dotenv, which `uvicorn --env-file` needs anyway; if
728
- it is missing, run `pip install "python-dotenv[cli]"`. Never `source` or
749
+ Doctor reads `.env` from the working directory for the variables the
750
+ environment does not set, as `uvicorn --env-file .env` does. Under Docker
751
+ Compose, run it inside the service, which has the variables from `env_file`:
752
+ `docker compose exec web openreceive doctor …`. Never `source` or
729
753
  `export` `.env` in a shell: the codes contain `&`, and the shell splits the
730
754
  line and prints the pieces.
731
755