openreceive 0.4.32 → 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 +7 -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 +21 -9
  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 +13 -4
  10. data/skills/integrate-openreceive/references/edd.md +12 -10
  11. data/skills/integrate-openreceive/references/fastapi.md +40 -27
  12. data/skills/integrate-openreceive/references/fastify.md +23 -10
  13. data/skills/integrate-openreceive/references/flask.md +24 -9
  14. data/skills/integrate-openreceive/references/fossbilling.md +17 -10
  15. data/skills/integrate-openreceive/references/laravel.md +22 -4
  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 +20 -9
  20. data/skills/integrate-openreceive/references/next.md +39 -26
  21. data/skills/integrate-openreceive/references/node.md +25 -11
  22. data/skills/integrate-openreceive/references/nuxt.md +21 -9
  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 +21 -7
  26. data/skills/integrate-openreceive/references/prestashop.md +28 -18
  27. data/skills/integrate-openreceive/references/rails.md +30 -10
  28. data/skills/integrate-openreceive/references/react-router.md +21 -9
  29. data/skills/integrate-openreceive/references/sveltekit.md +29 -11
  30. data/skills/integrate-openreceive/references/tanstack-start.md +21 -9
  31. data/skills/integrate-openreceive/references/vendure.md +2 -1
  32. data/skills/integrate-openreceive/references/woocommerce.md +17 -11
  33. metadata +1 -1
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (Flask)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 46 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 47 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/flask/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/flask/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/flask/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.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to a Flask 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
@@ -209,6 +210,10 @@ itself, and they hold for every integration.
209
210
  - Work only in this application. Never read or run anything from another
210
211
  project on this machine (its `node_modules`, tools or source), for any
211
212
  reason. A browser and Playwright are not part of setup.
213
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
214
+ directions. If one forbids a step here, such as running migrations, ask the
215
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
216
+ the step somewhere the rule does not name, such as app startup.
212
217
  - Restart only this app's server, on the port it already uses: stop the
213
218
  process you started, or the one listening on that port, by its pid (or
214
219
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -266,7 +271,9 @@ itself, and they hold for every integration.
266
271
  the price from `amount_for` and both drop-ins render it above the amount.
267
272
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
268
273
  is for.
269
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
274
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
275
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
276
+ no `createTransactionDetails`, and one bad import stops the whole page),
270
277
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
271
278
  hash and a deposit txid are the only evidence a payer has that they paid you.
272
279
  `<Checkout>` / `<openreceive-checkout>` already render this panel and the
@@ -411,7 +418,9 @@ components.
411
418
  are on `@openreceive/browser`, not `/headless`.
412
419
  - A refund replaces the deposit panel. On `refund_required` also drop
413
420
  "switch payment method".
414
- - No "Open wallet" button on desktop.
421
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
422
+ App cancels an invoice opened from a link and pays the same invoice scanned
423
+ or pasted. Show the QR code and a Copy invoice button.
415
424
  - Wallet suggestions: `getPaymentWizardRoutes()` +
416
425
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
417
426
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -498,8 +507,8 @@ wallet client (websockets, coincurve, cryptography), the HTTP engine, the
498
507
  with Jinja templates needs no npm. Add your database driver if the app does
499
508
  not have one yet, such as `psycopg[binary]` for Postgres.
500
509
 
501
- Use `uv` or a virtualenv on Python 3.10 or newer. A system Python 3.9 cannot
502
- install the package.
510
+ Use `uv` or a virtualenv on Python 3.10 to 3.13. A system Python 3.9 cannot
511
+ install the package, and 3.14 cannot yet, because `coincurve` has no build for it.
503
512
 
504
513
  ### 2. Create the payment tables
505
514
 
@@ -615,7 +624,8 @@ class OpenReceiveFlask:
615
624
 
616
625
  def start(self):
617
626
  """Build the stack once. Raises ConfigurationError when NWC_URI is
618
- missing, unreachable or able to spend."""
627
+ missing or able to spend. A relay that does not answer is not raised:
628
+ checkouts answer 503 until a later one reaches the wallet."""
619
629
  with self._lock:
620
630
  if self._app is None:
621
631
  nwc = os.environ.get("NWC_URI", "").strip()
@@ -733,11 +743,16 @@ payments_engine = create_engine(os.environ["DATABASE_URL"])
733
743
  openreceive = OpenReceiveFlask(host, payments_engine, rate_limiting=True)
734
744
  app.register_blueprint(openreceive.blueprint()) # serves /openreceive/...
735
745
 
736
- # The receive-only wallet check, where the app boots: a missing, unreachable
737
- # or spend-capable code stops the server here instead of failing the first payer.
746
+ # The receive-only wallet check, where the app boots: a missing or
747
+ # spend-capable code stops the server here instead of failing the first payer.
738
748
  openreceive.start()
739
749
  ```
740
750
 
751
+ A relay that does not answer when the app boots does not stop it. The worker
752
+ starts, logs one line, and checkouts get a retryable `503 WALLET_UNAVAILABLE`
753
+ until the wallet answers. The first checkout after a short wait (1 s, doubling
754
+ to 60 s) checks again, so payments come back without a restart.
755
+
741
756
  `openreceive.start()` runs once per process. A command that imports the app
742
757
  with no wallet access, such as a build step, can skip it: the first payment
743
758
  request then runs the check, and the routes answer `503 WALLET_UNAVAILABLE`
@@ -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 25 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/fossbilling/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/fossbilling/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/fossbilling/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.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Install and configure the OpenReceive payment method in the FOSSBilling
23
24
  billing panel you are working in. Preserve its theme, clients, products,
@@ -121,7 +122,7 @@ Docker image, download and unpack it inside the container, as the web user,
121
122
  then activate the module:
122
123
 
123
124
  ```sh
124
- docker compose exec -T -u www-data fossbilling sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.32/openreceive-fossbilling-0.4.32.zip && unzip -oq openreceive-fossbilling-0.4.32.zip && rm openreceive-fossbilling-0.4.32.zip'
125
+ docker compose exec -T -u www-data fossbilling sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-fossbilling-0.4.33.zip && unzip -oq openreceive-fossbilling-0.4.33.zip && rm openreceive-fossbilling-0.4.33.zip'
125
126
  docker compose exec -T -u www-data fossbilling php modules/Openreceive/activate.php
126
127
  ```
127
128
 
@@ -165,14 +166,17 @@ creates once (`openreceive-test@example.invalid`, so no real client sees it
165
166
  and no email reaches anyone), and mint its Lightning invoice:
166
167
 
167
168
  ```sh
168
- php console.php openreceive:test-invoice --new
169
+ php console.php openreceive:test-invoice --new --amount 20.00
169
170
  ```
170
171
 
172
+ `--amount 20.00` (in the shop's currency) keeps the test invoice above the swap
173
+ providers' minimums, so the user can try every method on the link you give them.
174
+
171
175
  To use an invoice that already exists, pass its id instead of `--new`.
172
176
  `test-invoice` goes through the same route as the invoice's payment page. It
173
177
  prints the amount in sats, the BOLT11 invoice, the invoice page and the
174
178
  methods the payment page offers, each swap asset marked available or followed
175
- by the reason it is not. That reason is the answer; report it. "Below the
179
+ 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
176
180
  provider minimum" or "above the provider maximum" is about this invoice's
177
181
  amount, not a fault. Only when the reason says the provider is unreachable
178
182
  does doctor's "Swap provider" line have more detail. `test-invoice` and
@@ -197,8 +201,11 @@ list each coin's availability, mention a minimum, or say a coin will not work:
197
201
  a provider minimum depends on the invoice total, and real invoices will
198
202
  differ. Do not list what you changed or what doctor checked. Send nothing
199
203
  after it. Do not add containers, services, workers or cron jobs:
200
- FOSSBilling's own cron job runs the extension's pass. If doctor says
201
- FOSSBilling's cron has never run, say so in one line of that message.
204
+ FOSSBilling's own cron job runs the extension's pass, and the official Docker
205
+ image runs it every five minutes. If doctor says FOSSBilling's cron has never
206
+ run and this is not that image, give the user, in one line of that message,
207
+ the entry for the web user's crontab, with this install's folder:
208
+ `*/5 * * * * php /path/to/fossbilling/cron.php`.
202
209
 
203
210
  ## Non-negotiables
204
211
 
@@ -276,9 +283,9 @@ routes, console commands and cron hook), and
276
283
 
277
284
  ```sh
278
285
  cd /var/www/fossbilling
279
- curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.32/openreceive-fossbilling-0.4.32.zip
280
- unzip -oq openreceive-fossbilling-0.4.32.zip
281
- rm openreceive-fossbilling-0.4.32.zip
286
+ curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-fossbilling-0.4.33.zip
287
+ unzip -oq openreceive-fossbilling-0.4.33.zip
288
+ rm openreceive-fossbilling-0.4.33.zip
282
289
  chown -R www-data:www-data modules/Openreceive library/Payment/Adapter/OpenReceive
283
290
  sudo -u www-data php modules/Openreceive/activate.php
284
291
  ```
@@ -333,7 +340,7 @@ Run every command inside the container, in `/var/www/html`, as its web user
333
340
  `www-data`. Unpack the release there too:
334
341
 
335
342
  ```sh
336
- docker compose exec -T -u www-data fossbilling sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.32/openreceive-fossbilling-0.4.32.zip && unzip -oq openreceive-fossbilling-0.4.32.zip && rm openreceive-fossbilling-0.4.32.zip'
343
+ docker compose exec -T -u www-data fossbilling sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-fossbilling-0.4.33.zip && unzip -oq openreceive-fossbilling-0.4.33.zip && rm openreceive-fossbilling-0.4.33.zip'
337
344
  docker compose exec -T -u www-data fossbilling php modules/Openreceive/activate.php
338
345
  ```
339
346
 
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (Laravel)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 47 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 48 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/laravel/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/laravel/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/laravel/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.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to a Laravel application — the app you are already working in.
23
24
  You do not need a copy of the OpenReceive source: the package is on Packagist
@@ -201,6 +202,10 @@ itself, and they hold for every integration.
201
202
  - Work only in this application. Never read or run anything from another
202
203
  project on this machine (its `node_modules`, tools or source), for any
203
204
  reason. A browser and Playwright are not part of setup.
205
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
206
+ directions. If one forbids a step here, such as running migrations, ask the
207
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
208
+ the step somewhere the rule does not name, such as app startup.
204
209
  - Restart only this app's server, on the port it already uses: stop the
205
210
  process you started, or the one listening on that port, by its pid (or
206
211
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -262,7 +267,9 @@ itself, and they hold for every integration.
262
267
  the price from `amountFor` and both drop-ins render it above the
263
268
  amount. Without it the checkout is a QR and "$1.00" with no sign of what the
264
269
  dollar is for.
265
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
270
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
271
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
272
+ no `createTransactionDetails`, and one bad import stops the whole page),
266
273
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
267
274
  hash and a deposit txid are the only evidence a payer has that they paid you.
268
275
  `<openreceive-checkout>` / React's `<Checkout>` already render this panel and
@@ -366,7 +373,9 @@ built on `@openreceive/browser/headless`. Read that before writing components.
366
373
  are on `@openreceive/browser`, not `/headless`.
367
374
  - A refund replaces the deposit panel. On `refund_required` also drop
368
375
  "switch payment method".
369
- - No "Open wallet" button on desktop.
376
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
377
+ App cancels an invoice opened from a link and pays the same invoice scanned
378
+ or pasted. Show the QR code and a Copy invoice button.
370
379
  - Wallet suggestions: `getPaymentWizardRoutes()` +
371
380
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
372
381
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -452,6 +461,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends libgmp-dev \
452
461
  && rm -rf /var/lib/apt/lists/*
453
462
  ```
454
463
 
464
+ On Alpine images, Debian's package name does not exist. Use this instead:
465
+
466
+ ```dockerfile
467
+ RUN apk add --no-cache gmp \
468
+ && apk add --no-cache --virtual .gmp-build $PHPIZE_DEPS gmp-dev \
469
+ && docker-php-ext-install gmp \
470
+ && apk del .gmp-build
471
+ ```
472
+
455
473
  Run `composer require` with a PHP that has gmp. On a machine without one,
456
474
  use the rebuilt image with the project mounted, then rebuild again so the
457
475
  image installs the new lock:
@@ -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.32.
20
+ These directions describe OpenReceive 0.4.33.
21
21
 
22
22
  Add OpenReceive to this Lovable app: a TanStack Start app on Cloudflare
23
23
  Workers, with Lovable Cloud or a connected Supabase project as its database.
@@ -121,7 +121,7 @@ saved or explicitly declined.
121
121
 
122
122
  ## Step 1 — the packages
123
123
 
124
- Add `@openreceive/http` and `@openreceive/react` at 0.4.32 or newer.
124
+ Add `@openreceive/http` and `@openreceive/react` at 0.4.33 or newer.
125
125
  Nothing else: no `pg`, no Postgres driver, no OpenReceive scaffold. Do not
126
126
  change the Vite or Wrangler configuration.
127
127
 
@@ -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 22 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/medusa/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/medusa/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/medusa/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.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to the Medusa store you are working in: a Medusa server, and
23
24
  usually a storefront in its own project (Medusa's Next.js starter or another).
@@ -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 26 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/mobile/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/mobile/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/mobile/full.md
17
18
  - The app never decides paid: it asks the server. A link back to the app is navigation only.
18
19
  - Do not suggest rotating or revoking a code because it was pasted here.
19
20
 
20
- These directions describe OpenReceive 0.4.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add Bitcoin checkout, with optional USDT, USDC, ETH and SOL, to a mobile app:
23
24
  React Native or Expo, Flutter, Swift or Kotlin. OpenReceive has no mobile SDK
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (NestJS)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 44 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/nestjs/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/nestjs/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/nestjs/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.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to a NestJS application — the app you are already working in,
23
24
  on Nest's default Express platform. You do not need a copy of the OpenReceive
@@ -212,6 +213,10 @@ itself, and they hold for every integration.
212
213
  - Work only in this application. Never read or run anything from another
213
214
  project on this machine (its `node_modules`, tools or source), for any
214
215
  reason. A browser and Playwright are not part of setup.
216
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
217
+ directions. If one forbids a step here, such as running migrations, ask the
218
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
219
+ the step somewhere the rule does not name, such as app startup.
215
220
  - Restart only this app's server, on the port it already uses: stop the
216
221
  process you started, or the one listening on that port, by its pid (or
217
222
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -254,21 +259,25 @@ itself, and they hold for every integration.
254
259
  (`POST /swaps`) re-serves the committed attempt — but only while it is live,
255
260
  and the shadow invoice behind a swap lasts about half an hour, after which the
256
261
  same click mints a NEW deposit address and the refund is off-screen. Keep the
257
- `payment_hash` and reopen the attempt with `POST /swaps/status`, which has no
258
- such window. On the drop-ins: `resumePaymentHash`, fed from `onState`, on
259
- `<Checkout>`; the `resume-payment-hash` attribute, fed from the
262
+ `payment_hash` on your order row, not in browser storage, and reopen the
263
+ attempt with `POST /swaps/status`, which has no such window. On the
264
+ drop-ins: `resumePaymentHash`, fed from `onState`, on `<Checkout>`; the
265
+ `resume-payment-hash` attribute, fed from the
260
266
  `openreceive-state` event (`event.detail.state.payment_hash`), on
261
267
  `<openreceive-checkout>`.
262
268
  That visit can come hours later, and `authorize` must still know the payer:
263
269
  a session that expired in between answers 403 and strands the deposit. On a
264
- guest shop, tie the order to a long-lived signed cookie, or put a secret
265
- per-order token in its URL that your page trades for that cookie.
270
+ guest shop, tie the order to a long-lived cookie signed with the app's own
271
+ secret (such as `SESSION_SECRET`, never a wallet or swap code), or put a
272
+ secret per-order token in its URL that your page trades for that cookie.
266
273
  https://openreceive.org/guides/swap-refunds.md
267
274
  - Show the payer WHAT THEY ARE BUYING. Return an optional `description` beside
268
275
  the price from `amountFor` and both drop-ins render it above the amount.
269
276
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
270
277
  is for.
271
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
278
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
279
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
280
+ no `createTransactionDetails`, and one bad import stops the whole page),
272
281
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
273
282
  hash and a deposit txid are the only evidence a payer has that they paid you.
274
283
  `<Checkout>` / `<openreceive-checkout>` already render this panel and the
@@ -408,7 +417,9 @@ components.
408
417
  are on `@openreceive/browser`, not `/headless`.
409
418
  - A refund replaces the deposit panel. On `refund_required` also drop
410
419
  "switch payment method".
411
- - No "Open wallet" button on desktop.
420
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
421
+ App cancels an invoice opened from a link and pays the same invoice scanned
422
+ or pasted. Show the QR code and a Copy invoice button.
412
423
  - Wallet suggestions: `getPaymentWizardRoutes()` +
413
424
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
414
425
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (Next.js)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 45 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 46 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/next/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/next/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/next/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.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to a Next.js App Router application — the app you are already
23
24
  working in. You do not need a copy of the OpenReceive source: the packages are
@@ -195,11 +196,16 @@ itself, and they hold for every integration.
195
196
  and not a Prisma/Drizzle relation to `openreceive_payments`.
196
197
  - Keep `NWC_URI` / `LSC_URI_*` server-only. Never put them in browser code,
197
198
  logs, or assets.
199
+ - After a production build, run `npx openreceive doctor --scan-build .next/static`. Never grep a build for a code.
198
200
  - Do not suggest rotating, revoking or replacing a code because it was pasted
199
201
  into this chat; that is the supported path.
200
202
  - Work only in this application. Never read or run anything from another
201
203
  project on this machine (its `node_modules`, tools or source), for any
202
204
  reason. A browser and Playwright are not part of setup.
205
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
206
+ directions. If one forbids a step here, such as running migrations, ask the
207
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
208
+ the step somewhere the rule does not name, such as app startup.
203
209
  - Restart only this app's server, on the port it already uses: stop the
204
210
  process you started, or the one listening on that port, by its pid (or
205
211
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -242,21 +248,25 @@ itself, and they hold for every integration.
242
248
  (`POST /swaps`) re-serves the committed attempt — but only while it is live,
243
249
  and the shadow invoice behind a swap lasts about half an hour, after which the
244
250
  same click mints a NEW deposit address and the refund is off-screen. Keep the
245
- `payment_hash` and reopen the attempt with `POST /swaps/status`, which has no
246
- such window. On the drop-ins: `resumePaymentHash`, fed from `onState`, on
247
- `<Checkout>`; the `resume-payment-hash` attribute, fed from the
251
+ `payment_hash` on your order row, not in browser storage, and reopen the
252
+ attempt with `POST /swaps/status`, which has no such window. On the
253
+ drop-ins: `resumePaymentHash`, fed from `onState`, on `<Checkout>`; the
254
+ `resume-payment-hash` attribute, fed from the
248
255
  `openreceive-state` event (`event.detail.state.payment_hash`), on
249
256
  `<openreceive-checkout>`.
250
257
  That visit can come hours later, and `authorize` must still know the payer:
251
258
  a session that expired in between answers 403 and strands the deposit. On a
252
- guest shop, tie the order to a long-lived signed cookie, or put a secret
253
- per-order token in its URL that your page trades for that cookie.
259
+ guest shop, tie the order to a long-lived cookie signed with the app's own
260
+ secret (such as `SESSION_SECRET`, never a wallet or swap code), or put a
261
+ secret per-order token in its URL that your page trades for that cookie.
254
262
  https://openreceive.org/guides/swap-refunds.md
255
263
  - Show the payer WHAT THEY ARE BUYING. Return an optional `description` beside
256
264
  the price from `amountFor` and both drop-ins render it above the amount.
257
265
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
258
266
  is for.
259
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
267
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
268
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
269
+ no `createTransactionDetails`, and one bad import stops the whole page),
260
270
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
261
271
  hash and a deposit txid are the only evidence a payer has that they paid you.
262
272
  `<Checkout>` / `<openreceive-checkout>` already render this panel and the
@@ -271,9 +281,9 @@ itself, and they hold for every integration.
271
281
  imported from a client component. `<Checkout>` is a CLIENT component: it
272
282
  lives in a `"use client"` file, which also imports `styles.css`. Render it
273
283
  at `app/checkout/[reference]/page.tsx`, the order's own resumable URL.
274
- - `rateLimiting` on Next needs an IP source (`trustProxyIpHeader: true` behind
275
- your own proxy or platform); a web Request has no socket IP and the adapter
276
- refuses to construct without one.
284
+ - Set `rateLimiting` with `trustProxyIpHeader: true` only behind Vercel or a
285
+ reverse proxy you run that replaces `x-forwarded-for`; elsewhere a client
286
+ sends its own, so leave both off (`rateLimiting` alone refuses to construct).
277
287
  - HTTP JSON is snake_case; TypeScript APIs are camelCase.
278
288
  - Money is integers or decimal strings — never binary floats.
279
289
 
@@ -318,7 +328,8 @@ products, and you do not join them.
318
328
  settled (409).
319
329
  - **A paid order's page says it is paid and shows no checkout.** Nothing is left
320
330
  to pay, and a checkout cannot start a new payment for a paid order. Mount the
321
- checkout only while the order is unpaid. When it settles on the page, update
331
+ checkout, and any line about coming back to pay or for a refund, only while
332
+ the order is unpaid. When it settles on the page, update
322
333
  the page's status line from `onSettled` on `<Checkout>`: `onPaid` has already
323
334
  marked the order paid. Keep that checkout mounted, because it is the payer's
324
335
  receipt.
@@ -397,7 +408,9 @@ components.
397
408
  are on `@openreceive/browser`, not `/headless`.
398
409
  - A refund replaces the deposit panel. On `refund_required` also drop
399
410
  "switch payment method".
400
- - No "Open wallet" button on desktop.
411
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
412
+ App cancels an invoice opened from a link and pays the same invoice scanned
413
+ or pasted. Show the QR code and a Copy invoice button.
401
414
  - Wallet suggestions: `getPaymentWizardRoutes()` +
402
415
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
403
416
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -580,7 +593,9 @@ export const { GET, POST } = openReceiveNextHandlers({
580
593
  // yours (admin action, replayed job) updates zero rows and does nothing.
581
594
  // Use `query` here, not your ORM's other connection. `?` on sqlite and
582
595
  // mysql, `$1` on postgres. MySQL has no RETURNING: after the UPDATE,
583
- // `SELECT ROW_COUNT() AS claimed` tells you the same thing.
596
+ // `SELECT ROW_COUNT() AS claimed` tells you the same thing. `paidAt` is
597
+ // Unix seconds: for a timestamp column write `to_timestamp($1)` on
598
+ // postgres or `FROM_UNIXTIME(?)` on mysql in place of its placeholder.
584
599
  const claimed = await query(
585
600
  "UPDATE orders SET state = 'paid', paid_at = ? WHERE id = ? AND state = 'awaiting_payment' RETURNING id",
586
601
  [paidAt, reference],
@@ -614,16 +629,14 @@ export const { GET, POST } = openReceiveNextHandlers({
614
629
  resource.reference,
615
630
  action,
616
631
  ),
617
- // Recommended for public web shops: caps invoice creation at 60 per client IP
618
- // per hour. A web Request has no socket IP, so on Next this ALSO needs an
619
- // IP source: `trustProxyIpHeader: true` reads the first hop of
620
- // x-forwarded-for, which is safe only when YOUR reverse proxy or hosting
621
- // platform sets it (Vercel, Cloudflare and most load balancers do). Without
622
- // an IP source the adapter refuses to construct rather than run an
623
- // inactive limiter. Leave both off for point-of-sale deployments, where
624
- // many payers share the terminal's IP.
625
- rateLimiting: true,
626
- trustProxyIpHeader: true,
632
+ // Caps invoice creation at 60 per client IP per hour. A web Request has no
633
+ // socket IP, so on Next the cap reads x-forwarded-for's first hop: turn
634
+ // both on only behind Vercel or a reverse proxy you run that replaces that
635
+ // header. Anywhere else a client sends its own, so leave both off, as they
636
+ // are by default (`rateLimiting` alone refuses to construct). Off for
637
+ // point-of-sale too, where many payers share the terminal's IP.
638
+ // rateLimiting: true,
639
+ // trustProxyIpHeader: true,
627
640
  });
628
641
  ```
629
642
 
@@ -650,8 +663,8 @@ pending invoices, so a payer who closes the tab is still covered.
650
663
  → [openReceiveNextHandlers](https://openreceive.org/guides/api-reference.md#openreceivenexthandlers) ·
651
664
  [authorize context](https://openreceive.org/guides/api-reference.md#the-authorize-context)
652
665
 
653
- `rateLimiting: true` is for public web shops. Leave it off for point-of-sale,
654
- where many payers share one IP. → [Rate limiting](https://openreceive.org/guides/rate-limiting.md)
666
+ `rateLimiting: true` is for public web shops behind such a proxy. Leave it off
667
+ for point-of-sale, where many payers share one IP. → [Rate limiting](https://openreceive.org/guides/rate-limiting.md)
655
668
 
656
669
  An optional worker, `startNotificationWorker({ service, host })`, listens for
657
670
  wallet payment notifications so settlement does not wait for the next page
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (Node.js)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 41 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 43 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/node/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/node/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/node/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.32.
21
+ These directions describe OpenReceive 0.4.33.
21
22
 
22
23
  Add OpenReceive to a Node application — the app you are already working in. You
23
24
  do not need a copy of the OpenReceive source: the packages are on npm, and the
@@ -196,6 +197,10 @@ itself, and they hold for every integration.
196
197
  - Work only in this application. Never read or run anything from another
197
198
  project on this machine (its `node_modules`, tools or source), for any
198
199
  reason. A browser and Playwright are not part of setup.
200
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
201
+ directions. If one forbids a step here, such as running migrations, ask the
202
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
203
+ the step somewhere the rule does not name, such as app startup.
199
204
  - Restart only this app's server, on the port it already uses: stop the
200
205
  process you started, or the one listening on that port, by its pid (or
201
206
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -238,21 +243,25 @@ itself, and they hold for every integration.
238
243
  (`POST /swaps`) re-serves the committed attempt — but only while it is live,
239
244
  and the shadow invoice behind a swap lasts about half an hour, after which the
240
245
  same click mints a NEW deposit address and the refund is off-screen. Keep the
241
- `payment_hash` and reopen the attempt with `POST /swaps/status`, which has no
242
- such window. On the drop-ins: `resumePaymentHash`, fed from `onState`, on
243
- `<Checkout>`; the `resume-payment-hash` attribute, fed from the
246
+ `payment_hash` on your order row, not in browser storage, and reopen the
247
+ attempt with `POST /swaps/status`, which has no such window. On the
248
+ drop-ins: `resumePaymentHash`, fed from `onState`, on `<Checkout>`; the
249
+ `resume-payment-hash` attribute, fed from the
244
250
  `openreceive-state` event (`event.detail.state.payment_hash`), on
245
251
  `<openreceive-checkout>`.
246
252
  That visit can come hours later, and `authorize` must still know the payer:
247
253
  a session that expired in between answers 403 and strands the deposit. On a
248
- guest shop, tie the order to a long-lived signed cookie, or put a secret
249
- per-order token in its URL that your page trades for that cookie.
254
+ guest shop, tie the order to a long-lived cookie signed with the app's own
255
+ secret (such as `SESSION_SECRET`, never a wallet or swap code), or put a
256
+ secret per-order token in its URL that your page trades for that cookie.
250
257
  https://openreceive.org/guides/swap-refunds.md
251
258
  - Show the payer WHAT THEY ARE BUYING. Return an optional `description` beside
252
259
  the price from `amountFor` and both drop-ins render it above the amount.
253
260
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
254
261
  is for.
255
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
262
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
263
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
264
+ no `createTransactionDetails`, and one bad import stops the whole page),
256
265
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
257
266
  hash and a deposit txid are the only evidence a payer has that they paid you.
258
267
  `<Checkout>` / `<openreceive-checkout>` already render this panel and the
@@ -308,7 +317,8 @@ products, and you do not join them.
308
317
  settled (409).
309
318
  - **A paid order's page says it is paid and shows no checkout.** Nothing is left
310
319
  to pay, and a checkout cannot start a new payment for a paid order. Mount the
311
- checkout only while the order is unpaid. When it settles on the page, update
320
+ checkout, and any line about coming back to pay or for a refund, only while
321
+ the order is unpaid. When it settles on the page, update
312
322
  the page's status line from `onSettled` on `<Checkout>`, or the
313
323
  `openreceive-settled` event on `<openreceive-checkout>`: `onPaid` has already
314
324
  marked the order paid. Keep that checkout mounted, because it is the payer's
@@ -388,7 +398,9 @@ components.
388
398
  are on `@openreceive/browser`, not `/headless`.
389
399
  - A refund replaces the deposit panel. On `refund_required` also drop
390
400
  "switch payment method".
391
- - No "Open wallet" button on desktop.
401
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
402
+ App cancels an invoice opened from a link and pays the same invoice scanned
403
+ or pasted. Show the QR code and a Copy invoice button.
392
404
  - Wallet suggestions: `getPaymentWizardRoutes()` +
393
405
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
394
406
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -567,7 +579,9 @@ const openreceive = openReceiveExpress({
567
579
  // yours (admin action, replayed job) updates zero rows and does nothing.
568
580
  // Use `query` here, not your ORM's other connection. `?` on sqlite and
569
581
  // mysql, `$1` on postgres. MySQL has no RETURNING: after the UPDATE,
570
- // `SELECT ROW_COUNT() AS claimed` tells you the same thing.
582
+ // `SELECT ROW_COUNT() AS claimed` tells you the same thing. `paidAt` is
583
+ // Unix seconds: for a timestamp column write `to_timestamp($1)` on
584
+ // postgres or `FROM_UNIXTIME(?)` on mysql in place of its placeholder.
571
585
  const claimed = await query(
572
586
  "UPDATE orders SET state = 'paid', paid_at = ? WHERE id = ? AND state = 'awaiting_payment' RETURNING id",
573
587
  [paidAt, reference],