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
@@ -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 23 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/odoo/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/odoo/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/odoo/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 provider in the Odoo you are
23
24
  working in. Preserve its website, customers, products, orders, invoices and
@@ -102,7 +103,7 @@ manager, so build an image that adds it:
102
103
  FROM odoo:<tag>
103
104
  USER root
104
105
  RUN pip3 install --no-cache-dir --break-system-packages --ignore-installed typing_extensions h11 \
105
- && pip3 install --no-cache-dir --break-system-packages openreceive==0.4.31
106
+ && pip3 install --no-cache-dir --break-system-packages openreceive==0.4.33
106
107
  USER odoo
107
108
  ```
108
109
 
@@ -113,9 +114,9 @@ manager, so build an image that adds it:
113
114
  (the folder that holds the Dockerfile). Change nothing else in the file.
114
115
  3. Run `docker compose up -d --build`.
115
116
 
116
- On a server, install `openreceive==0.4.31` with the pip of the Python
117
+ On a server, install `openreceive==0.4.33` with the pip of the Python
117
118
  that runs Odoo (its virtualenv when it has one). On Odoo.sh, add
118
- `openreceive==0.4.31` to the repository's `requirements.txt`. If you
119
+ `openreceive==0.4.33` to the repository's `requirements.txt`. If you
119
120
  cannot tell which Python runs Odoo, say so and stop.
120
121
 
121
122
  The module is the ZIP attached to this GitHub release, with its folder,
@@ -126,8 +127,8 @@ folder on the config file's `addons_path`. Never install the GitHub
126
127
  source-code ZIP or a ZIP from an older release.
127
128
 
128
129
  ```sh
129
- curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-odoo-0.4.31.zip
130
- unzip -oq openreceive-odoo-0.4.31.zip -d <that folder> && rm openreceive-odoo-0.4.31.zip
130
+ curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-odoo-0.4.33.zip
131
+ unzip -oq openreceive-odoo-0.4.33.zip -d <that folder> && rm openreceive-odoo-0.4.33.zip
131
132
  ```
132
133
 
133
134
  Then install it into the database and restart Odoo:
@@ -184,7 +185,7 @@ To use a transaction that already exists, pass `--reference <its reference>`
184
185
  instead of `--new`. `test-invoice` goes through the same route as the
185
186
  checkout page. It prints the amount in sats, the BOLT11 invoice and the
186
187
  methods the checkout offers, each swap asset marked available or followed by
187
- the reason it is not. That reason is the answer; report it. A reason about the
188
+ 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. A reason about the
188
189
  provider's minimum or maximum is about this amount, not a fault. `test-invoice`
189
190
  and `doctor` are the whole check.
190
191
 
@@ -281,16 +282,16 @@ from a terminal:
281
282
 
282
283
  ```sh
283
284
  cd /path/to/your/addons
284
- curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-odoo-0.4.31.zip
285
- unzip -oq openreceive-odoo-0.4.31.zip && rm openreceive-odoo-0.4.31.zip
285
+ curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-odoo-0.4.33.zip
286
+ unzip -oq openreceive-odoo-0.4.33.zip && rm openreceive-odoo-0.4.33.zip
286
287
  odoo -d <database> -i payment_openreceive --stop-after-init
287
288
  ```
288
289
 
289
290
  How the Python package gets in depends on how Odoo runs:
290
291
 
291
292
  - **Odoo.sh**: commit the `payment_openreceive` folder to your repository and
292
- add `openreceive==0.4.31` to the repository's `requirements.txt`.
293
- - **A source install with a virtualenv**: `pip install openreceive==0.4.31`
293
+ add `openreceive==0.4.33` to the repository's `requirements.txt`.
294
+ - **A source install with a virtualenv**: `pip install openreceive==0.4.33`
294
295
  in Odoo's virtualenv.
295
296
  - **Odoo's Docker image** or **its Debian package**: see below.
296
297
 
@@ -310,7 +311,7 @@ manager. Build your own image on top of it: put this `Dockerfile` next to your
310
311
  FROM odoo:19.0
311
312
  USER root
312
313
  RUN pip3 install --no-cache-dir --break-system-packages --ignore-installed typing_extensions h11 \
313
- && pip3 install --no-cache-dir --break-system-packages openreceive==0.4.31
314
+ && pip3 install --no-cache-dir --break-system-packages openreceive==0.4.33
314
315
  USER odoo
315
316
  ```
316
317
 
@@ -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 19 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/paymenter/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/paymenter/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/paymenter/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 Paymenter billing
23
24
  panel you are working in. Preserve its theme, clients, products, invoices and
@@ -97,7 +98,7 @@ release. With Paymenter's official Docker image, download and unpack it inside
97
98
  the container, as the web user:
98
99
 
99
100
  ```sh
100
- docker compose exec -T -u nginx paymenter sh -c 'cd /app/extensions/Gateways && curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-paymenter-0.4.31.zip && unzip -q openreceive-paymenter-0.4.31.zip && rm openreceive-paymenter-0.4.31.zip'
101
+ docker compose exec -T -u nginx paymenter sh -c 'cd /app/extensions/Gateways && curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-paymenter-0.4.33.zip && unzip -q openreceive-paymenter-0.4.33.zip && rm openreceive-paymenter-0.4.33.zip'
101
102
  docker compose exec -T -u nginx paymenter php artisan app:extension:install gateway OpenReceive
102
103
  ```
103
104
 
@@ -140,14 +141,17 @@ Create a small unpaid test invoice, billed to the first admin account without
140
141
  Paymenter's new-invoice email, and mint its Lightning invoice:
141
142
 
142
143
  ```sh
143
- php artisan openreceive:test-invoice --new
144
+ php artisan openreceive:test-invoice --new --amount 20.00
144
145
  ```
145
146
 
147
+ `--amount 20.00` (in the shop's currency) keeps the test invoice above the swap
148
+ providers' minimums, so the user can try every method on the link you give them.
149
+
146
150
  To use an invoice that already exists, pass its id instead of `--new`.
147
151
  `test-invoice` goes through the same route as the invoice's payment dialog. It
148
152
  prints the amount in sats, the BOLT11 invoice, the invoice page and the
149
153
  methods the dialog offers, each swap asset marked available or followed by
150
- the reason it is not. That reason is the answer; report it. "Below the
154
+ 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
151
155
  provider minimum" or "above the provider maximum" is about this invoice's
152
156
  amount, not a fault. Only when the reason says the provider is unreachable
153
157
  does doctor's "Swap provider" line have more detail. `test-invoice` and
@@ -242,9 +246,9 @@ directory, next to Stripe and PayPal:
242
246
 
243
247
  ```sh
244
248
  cd /var/www/paymenter
245
- curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-paymenter-0.4.31.zip
246
- unzip -q openreceive-paymenter-0.4.31.zip -d extensions/Gateways
247
- rm openreceive-paymenter-0.4.31.zip
249
+ curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-paymenter-0.4.33.zip
250
+ unzip -q openreceive-paymenter-0.4.33.zip -d extensions/Gateways
251
+ rm openreceive-paymenter-0.4.33.zip
248
252
  chown -R www-data:www-data extensions/Gateways/OpenReceive
249
253
  sudo -u www-data php artisan app:extension:install gateway OpenReceive
250
254
  ```
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (PHP)
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/php/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/php/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/php/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 PHP application — the app you are already working in. You
23
24
  do not need a copy of the OpenReceive source: the engine is on Packagist
@@ -63,8 +64,9 @@ Before anything else, check one file: the project's `.env`, if it exists.
63
64
  `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
64
65
  it sets without printing them. Check with that, here and after each write,
65
66
  not by reading the file, and never print the values. A code that is already
66
- set is not asked for again; if both are set, skip to step 5 (making the
67
- server load the file), then the quickstart.
67
+ set is not asked for again; if both are set, make sure `.gitignore` covers
68
+ `.env` (and `.dockerignore`, if the app has one), then skip to step 5
69
+ (making the server load the file), then the quickstart.
68
70
 
69
71
  Otherwise your next action is a question to the user. Do not run `composer require`,
70
72
  edit the app, write `.env.example`, or search anywhere else before asking
@@ -136,8 +138,8 @@ again. Never set the spend-capable override to get past it.
136
138
  Then check the PHP runtime: `php -m` must list `gmp`, `sodium`, `mbstring`,
137
139
  `json`, `pdo` and one PDO driver. `ext-gmp` is REQUIRED — the NWC transport
138
140
  signs every request with it — and `php:*-cli`/`-fpm` images do not ship it:
139
- install `libgmp-dev` first, then `docker-php-ext-install gmp`, in the
140
- Dockerfile. Never pass `--ignore-platform-req=ext-gmp` to Composer. PHP must
141
+ install `libgmp-dev` first (on Alpine, `apk add gmp` plus `$PHPIZE_DEPS
142
+ gmp-dev` for the build), then `docker-php-ext-install gmp`, in the Dockerfile. Never pass `--ignore-platform-req=ext-gmp` to Composer. PHP must
141
143
  be ≥ 8.2 and 64-bit.
142
144
 
143
145
  ### Upgrading an existing install
@@ -201,6 +203,10 @@ itself, and they hold for every integration.
201
203
  - Work only in this application. Never read or run anything from another
202
204
  project on this machine (its `node_modules`, tools or source), for any
203
205
  reason. A browser and Playwright are not part of setup.
206
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
207
+ directions. If one forbids a step here, such as running migrations, ask the
208
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
209
+ the step somewhere the rule does not name, such as app startup.
204
210
  - Restart only this app's server, on the port it already uses: stop the
205
211
  process you started, or the one listening on that port, by its pid (or
206
212
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -217,7 +223,8 @@ itself, and they hold for every integration.
217
223
  environment (`printenv`, `env`, `docker compose config`), even filtered to
218
224
  names.
219
225
  - The host owns the price. `amountFor` reads it from your own data; reject
220
- payer-supplied amounts.
226
+ payer-supplied amounts. A donation is no exception: its amount is saved
227
+ by your own route first (Donations, below).
221
228
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
222
229
  the payer made, not proof. Read this app's session or signed cookie from the
223
230
  PSR-7 request; never trust a body field. The `Hosts\AllowAllAuthorize` trait
@@ -257,7 +264,9 @@ itself, and they hold for every integration.
257
264
  the price from `amountFor` and the drop-in renders it above the amount.
258
265
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
259
266
  is for.
260
- - 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),
261
270
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
262
271
  hash and a deposit txid are the only evidence a payer has that they paid you.
263
272
  `<openreceive-checkout>` already renders this panel and the `description` —
@@ -295,6 +304,15 @@ not replace your orders, users, or products, and you do not join them.
295
304
  live catalog lookup that could re-price a cart already placed. Return
296
305
  `['currency' => …, 'value' => …]` as a decimal STRING, plus a `description`
297
306
  of what they are buying.
307
+ - **Donations and pay-what-you-want are fine.** The amount is the payer's
308
+ choice, so it enters through YOUR route, never OpenReceive's: the donate form
309
+ posts it to your own handler, which checks it and saves it on a new donation
310
+ row, made like an order. That row's id is the `reference`, and `amountFor`
311
+ reads the amount from the row, as it does for an order. Check it in that
312
+ handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
313
+ at most two decimal places. Refuse an amount outside them with a message;
314
+ never round it. Small amounts may be Lightning-only for some coins: the
315
+ checkout says which coins an amount is too small for.
298
316
  - **Users own the order; OpenReceive never sees them.** `authorize` uses the
299
317
  same ownership check this app already uses on the order show / pay page —
300
318
  `$_SESSION['user_id']`, a signed cookie, a session library, whatever it is —
@@ -362,7 +380,9 @@ of https://openreceive.org/guides/checkout-ux.md, for a UI built on
362
380
  are on `@openreceive/browser`, not `/headless`.
363
381
  - A refund replaces the deposit panel. On `refund_required` also drop
364
382
  "switch payment method".
365
- - No "Open wallet" button on desktop.
383
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
384
+ App cancels an invoice opened from a link and pays the same invoice scanned
385
+ or pasted. Show the QR code and a Copy invoice button.
366
386
  - Wallet suggestions: `getPaymentWizardRoutes()` +
367
387
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
368
388
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -431,7 +451,10 @@ thin adapter over this engine).
431
451
  Requires PHP ≥ 8.2 (64-bit) with `ext-gmp`, `ext-sodium`, `ext-mbstring`,
432
452
  `ext-json`, `ext-pdo` and one PDO driver (`pdo_pgsql`, `pdo_sqlite` or
433
453
  `pdo_mysql`). `ext-gmp` is **required**, not optional. The NWC transport signs
434
- every wallet request with it.
454
+ every wallet request with it. The official `php` Docker images do not ship it.
455
+ On Debian images, install `libgmp-dev` and then run `docker-php-ext-install gmp`.
456
+ On Alpine images, run `apk add gmp` and install `$PHPIZE_DEPS gmp-dev` for the
457
+ build.
435
458
 
436
459
  ### 1. Install
437
460
 
@@ -566,6 +589,8 @@ $host = new class($orders) implements Host {
566
589
  // same commit as the payment record. The WHERE clause is the lock: a second
567
590
  // fulfillment path of yours updates zero rows. Database writes only here;
568
591
  // emails and webhooks go after commit (implement Hosts\AfterPaid for that).
592
+ // `paidAt` is Unix seconds: for a timestamp column write `FROM_UNIXTIME(?)`
593
+ // (MySQL) or `to_timestamp(?)` (Postgres) in place of its placeholder.
569
594
  public function onPaid(PaymentSettlement $settlement): void
570
595
  {
571
596
  $settlement->connection->execute(
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (PrestaShop)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 25 KB and a summary drops required steps. Download it whole:
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/prestashop/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/prestashop/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/prestashop/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 module in the PrestaShop store
23
24
  you are working in. Preserve its theme, customers, products, orders and
@@ -123,7 +124,7 @@ With the Docker image, download and unpack it inside the container, as the
123
124
  web user, then install the module with PrestaShop's own console:
124
125
 
125
126
  ```sh
126
- docker compose exec -T -u www-data prestashop sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-prestashop-0.4.31.zip && unzip -oq openreceive-prestashop-0.4.31.zip -d modules && rm openreceive-prestashop-0.4.31.zip'
127
+ docker compose exec -T -u www-data prestashop sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-prestashop-0.4.33.zip && unzip -oq openreceive-prestashop-0.4.33.zip -d modules && rm openreceive-prestashop-0.4.33.zip'
127
128
  docker compose exec -T -u www-data prestashop php bin/console prestashop:module install openreceive
128
129
  ```
129
130
 
@@ -166,15 +167,18 @@ real customer sees it and no email reaches anyone), and mint its Lightning
166
167
  invoice:
167
168
 
168
169
  ```sh
169
- php bin/console openreceive:test-invoice --new
170
+ php bin/console openreceive:test-invoice --new --amount 20.00
170
171
  ```
171
172
 
173
+ `--amount 20.00` (in the shop's currency) keeps the test order above the swap
174
+ providers' minimums, so the user can try every method on the link you give them.
175
+
172
176
  To use an order that already awaits its OpenReceive payment, pass its id
173
177
  instead of `--new`. `test-invoice` goes through the same route as the order's
174
178
  confirmation page. It prints the amount in sats, the BOLT11 invoice, the
175
179
  order's confirmation page and the methods the checkout offers, each swap asset
176
- marked available or followed by the reason it is not. That reason is the
177
- answer; report it. "Below the provider minimum" or "above the provider
180
+ marked available or followed by the reason it is not. That reason is for you, not the user: it says whether
181
+ anything is wrong, and the last message names no minimum. "Below the provider minimum" or "above the provider
178
182
  maximum" is about this order's amount, not a fault. Only when the reason says
179
183
  the provider is unreachable does doctor's "Swap provider" line have more
180
184
  detail. `test-invoice` and `doctor` are the whole check.
@@ -192,17 +196,20 @@ pay from the order's page with their own wallet; afterwards the order reads
192
196
  Setup ends here. Once doctor is clean and the user has the link, your last
193
197
  message starts "Setup is finished" and has at most six short lines: the
194
198
  order's page, the methods the checkout offers (Bitcoin, plus USDT, USDC, ETH
195
- and SOL when the swap code is saved), the cron line below, and one line of
199
+ and SOL when the swap code is saved), the crontab entry below, and one line of
196
200
  what to look at. Do not list each coin's availability, mention a minimum, or
197
201
  say a coin will not work: a provider minimum depends on the order total, and
198
202
  real orders will differ. Do not list what you changed or what doctor checked.
199
203
  Send nothing after it.
200
204
 
201
205
  PrestaShop has no scheduler, so the module's pass for customers who leave the
202
- page before their payment settles needs one cron line, every five minutes:
203
- `php bin/console openreceive:reconcile` as the web user. Give the user that
204
- line in your last message; do not add it yourself, and do not add containers,
205
- services or workers.
206
+ page before their payment settles needs one crontab entry. Give the user the
207
+ whole entry in your last message, with this shop's real folder, and
208
+ do not add it yourself, or any containers, services or workers. Under Docker,
209
+ for the host's crontab:
210
+ `*/5 * * * * cd /path/to/shop && docker compose exec -T -u www-data prestashop php bin/console openreceive:reconcile`.
211
+ Otherwise, for the web user's crontab:
212
+ `*/5 * * * * php /path/to/prestashop/bin/console openreceive:reconcile`.
206
213
 
207
214
  ## Non-negotiables
208
215
 
@@ -285,9 +292,9 @@ install it with PrestaShop's own console, in the folder that holds `bin/console`
285
292
 
286
293
  ```sh
287
294
  cd /var/www/html
288
- curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-prestashop-0.4.31.zip
289
- unzip -oq openreceive-prestashop-0.4.31.zip -d modules
290
- rm openreceive-prestashop-0.4.31.zip
295
+ curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-prestashop-0.4.33.zip
296
+ unzip -oq openreceive-prestashop-0.4.33.zip -d modules
297
+ rm openreceive-prestashop-0.4.33.zip
291
298
  chown -R www-data:www-data modules/openreceive
292
299
  sudo -u www-data php bin/console prestashop:module install openreceive
293
300
  ```
@@ -323,7 +330,7 @@ Run every command inside the container, in `/var/www/html`, as its web user
323
330
  `www-data`. Unpack the release there too:
324
331
 
325
332
  ```sh
326
- docker compose exec -T -u www-data prestashop sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.31/openreceive-prestashop-0.4.31.zip && unzip -oq openreceive-prestashop-0.4.31.zip -d modules && rm openreceive-prestashop-0.4.31.zip'
333
+ docker compose exec -T -u www-data prestashop sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.33/openreceive-prestashop-0.4.33.zip && unzip -oq openreceive-prestashop-0.4.33.zip -d modules && rm openreceive-prestashop-0.4.33.zip'
327
334
  docker compose exec -T -u www-data prestashop php bin/console prestashop:module install openreceive
328
335
  ```
329
336
 
@@ -378,9 +385,12 @@ from cron, as the web server's user:
378
385
 
379
386
  That line goes in `/etc/cron.d/`; in the web user's own crontab, leave out
380
387
  `www-data`. On hosting with a control panel, add a cron job with the same
381
- `php …/bin/console openreceive:reconcile` command. With Docker, the host's cron
382
- runs `docker compose exec -T -u www-data prestashop php bin/console openreceive:reconcile`
383
- from the Compose project's folder.
388
+ `php …/bin/console openreceive:reconcile` command. With Docker, add this to
389
+ the host's crontab, with your Compose project's folder:
390
+
391
+ ```cron
392
+ */5 * * * * cd /path/to/shop && docker compose exec -T -u www-data prestashop php bin/console openreceive:reconcile
393
+ ```
384
394
 
385
395
  Each pass also finishes any order whose payment settled but which did not
386
396
  move to "Payment accepted", and every checkout request runs one pass too.
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (Rails)
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/rails/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/rails/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/rails/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 Rails application — the app you are already working in. You
23
24
  do not need a copy of the OpenReceive source: the gem is on RubyGems, the
@@ -61,8 +62,9 @@ Before anything else, check one file: the project's `.env`, if it exists.
61
62
  `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
62
63
  it sets without printing them. Check with that, here and after each write,
63
64
  not by reading the file, and never print the values. A code that is already
64
- set is not asked for again; if both are set, skip to step 5 (making the
65
- server load the file), then the quickstart.
65
+ set is not asked for again; if both are set, make sure `.gitignore` covers
66
+ `.env` (and `.dockerignore`, if the app has one), then skip to step 5
67
+ (making the server load the file), then the quickstart.
66
68
 
67
69
  Otherwise your next action is a question to the user. Do not install the gem,
68
70
  edit the app, write `.env.example`, or search anywhere else before asking
@@ -191,6 +193,10 @@ itself, and they hold for every integration.
191
193
  - Work only in this application. Never read or run anything from another
192
194
  project on this machine (its `node_modules`, tools or source), for any
193
195
  reason. A browser and Playwright are not part of setup.
196
+ - The project's own rules (its `AGENTS.md`, contributing guide) win over these
197
+ directions. If one forbids a step here, such as running migrations, ask the
198
+ owner and wait for the answer, even if doctor cannot pass yet. Do not move
199
+ the step somewhere the rule does not name, such as app startup.
194
200
  - Restart only this app's server, on the port it already uses: stop the
195
201
  process you started, or the one listening on that port, by its pid (or
196
202
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -207,7 +213,8 @@ itself, and they hold for every integration.
207
213
  environment (`printenv`, `env`, `docker compose config`), even filtered to
208
214
  names.
209
215
  - The host owns the price. `config.amount_for` reads it from your own data;
210
- reject payer-supplied amounts.
216
+ reject payer-supplied amounts. A donation is no exception: its amount is saved
217
+ by your own route first (Donations, below).
211
218
  - `config.authorize` runs on every request, and the `resource` it receives is a
212
219
  CLAIM the payer made, not proof. Read the framework session; never trust a
213
220
  body field. The generator installs `OpenReceive::ALLOW_ALL_AUTHORIZE`, a
@@ -249,7 +256,9 @@ itself, and they hold for every integration.
249
256
  the price from `config.amount_for` and both drop-ins render it above the
250
257
  amount. Without it the checkout is a QR and "$1.00" with no sign of what the
251
258
  dollar is for.
252
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
259
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
260
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
261
+ no `createTransactionDetails`, and one bad import stops the whole page),
253
262
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
254
263
  hash and a deposit txid are the only evidence a payer has that they paid you.
255
264
  `<openreceive-checkout>` / React's `<Checkout>` already render this panel and
@@ -280,6 +289,15 @@ not replace your orders, users, or products, and you do not join them.
280
289
  never a live catalog lookup that could re-price a cart already placed. Return
281
290
  `{ currency:, value: }` as a decimal STRING, plus a `description` of what they
282
291
  are buying.
292
+ - **Donations and pay-what-you-want are fine.** The amount is the payer's
293
+ choice, so it enters through YOUR route, never OpenReceive's: the donate form
294
+ posts it to your own handler, which checks it and saves it on a new donation
295
+ row, made like an order. That row's id is the `reference`, and `config.amount_for`
296
+ reads the amount from the row, as it does for an order. Check it in that
297
+ handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
298
+ at most two decimal places. Refuse an amount outside them with a message;
299
+ never round it. Small amounts may be Lightning-only for some coins: the
300
+ checkout says which coins an amount is too small for.
283
301
  - **Users own the order; OpenReceive never sees them.** `config.authorize` uses
284
302
  the same ownership check this app already uses on the order show / pay page —
285
303
  `session[:user_id]`, Devise's `current_user`, a signed cookie, whatever it is.
@@ -291,7 +309,8 @@ not replace your orders, users, or products, and you do not join them.
291
309
  settled (409).
292
310
  - **A paid order's page says it is paid and shows no checkout.** Nothing is left
293
311
  to pay, and a checkout cannot start a new payment for a paid order. Mount the
294
- checkout only while the order is unpaid. When it settles on the page, update
312
+ checkout, and any line about coming back to pay or for a refund, only while
313
+ the order is unpaid. When it settles on the page, update
295
314
  the page's status line from the `openreceive-settled` event on
296
315
  `<openreceive-checkout>`: `on_paid` has already marked the order paid. Keep
297
316
  that checkout mounted, because it is the payer's receipt.
@@ -343,7 +362,9 @@ built on `@openreceive/browser/headless`. Read that before writing components.
343
362
  are on `@openreceive/browser`, not `/headless`.
344
363
  - A refund replaces the deposit panel. On `refund_required` also drop
345
364
  "switch payment method".
346
- - No "Open wallet" button on desktop.
365
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
366
+ App cancels an invoice opened from a link and pays the same invoice scanned
367
+ or pasted. Show the QR code and a Copy invoice button.
347
368
  - Wallet suggestions: `getPaymentWizardRoutes()` +
348
369
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
349
370
  images load from a JavaScript chunk. For a custom headless UI, load it when
@@ -433,6 +454,13 @@ Docker builds) have neither. Install them before bundling:
433
454
  apt-get install -y autoconf automake libtool build-essential pkg-config libssl-dev
434
455
  ```
435
456
 
457
+ On Alpine (`ruby:*-alpine`), install these instead. `tzdata` is for Rails itself,
458
+ which will not boot without it there:
459
+
460
+ ```sh
461
+ apk add --no-cache build-base autoconf automake libtool pkgconf openssl-dev tzdata
462
+ ```
463
+
436
464
  Full Ruby images and typical developer machines already have these.
437
465
 
438
466
  Then run:
@@ -669,11 +697,14 @@ share one IP. → [Rate limiting](https://openreceive.org/guides/rate-limiting.m
669
697
 
670
698
  In production, the engine builds the wallet client when your app boots. It
671
699
  also runs the receive-only preflight right away: it reaches the wallet and
672
- checks that the code cannot spend. A missing `NWC_URI`, a dead relay, or a
673
- spend-capable wallet then stops the deploy. Otherwise those problems would
674
- show up as 500 errors for customers on the first checkout. Outside production
675
- (tests, consoles), the engine builds the client lazily, on first use, so no
676
- live wallet is needed.
700
+ checks that the code cannot spend. A missing `NWC_URI` or a spend-capable
701
+ wallet then stops the deploy. Otherwise those problems would show up as errors
702
+ for customers on the first checkout. A relay that does not answer at boot does
703
+ not stop it: the app boots, logs one line, and checkouts get a retryable
704
+ `503 WALLET_UNAVAILABLE` until the wallet answers. The first checkout after a
705
+ short wait (1 s, doubling to 60 s) checks again, so payments come back without
706
+ a restart. Outside production (tests, consoles), the engine builds the client
707
+ lazily, on first use, so no live wallet is needed.
677
708
 
678
709
  ### Render the checkout
679
710
 
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
3
3
  # OpenReceive agent directions (React Router)
4
4
 
5
5
  ```sh
6
- # READ THIS FIRST: this file is 34 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 36 KB and a summary drops required steps. Download it whole:
7
7
  curl -fsSL https://openreceive.org/agent-directions/react-router/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/react-router/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/react-router/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 React Router application in framework mode — the app
23
24
  you are already working in, on Node. OpenReceive ships no React Router
@@ -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
@@ -198,11 +200,16 @@ itself, and they hold for every integration.
198
200
  and not a Prisma/Drizzle relation to `openreceive_payments`.
199
201
  - Keep `NWC_URI` / `LSC_URI_*` server-only. Never put them in browser code,
200
202
  logs, or assets.
203
+ - After a production build, run `npx openreceive doctor --scan-build build/client`. Never grep a build for a code.
201
204
  - Do not suggest rotating, revoking or replacing a code because it was pasted
202
205
  into this chat; that is the supported path.
203
206
  - Work only in this application. Never read or run anything from another
204
207
  project on this machine (its `node_modules`, tools or source), for any
205
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.
206
213
  - Restart only this app's server, on the port it already uses: stop the
207
214
  process you started, or the one listening on that port, by its pid (or
208
215
  restart its Compose service). Never `pkill` or `killall` by name: that
@@ -219,7 +226,8 @@ itself, and they hold for every integration.
219
226
  environment (`printenv`, `env`, `docker compose config`), even filtered to
220
227
  names.
221
228
  - The host owns the price. `amountFor` reads it from your own data; reject
222
- payer-supplied amounts.
229
+ payer-supplied amounts. A donation is no exception: its amount is saved
230
+ by your own route first (Donations, below).
223
231
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
224
232
  the payer made, not proof. Read a framework session; never trust a body field.
225
233
  - `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
@@ -244,21 +252,25 @@ itself, and they hold for every integration.
244
252
  (`POST /swaps`) re-serves the committed attempt — but only while it is live,
245
253
  and the shadow invoice behind a swap lasts about half an hour, after which the
246
254
  same click mints a NEW deposit address and the refund is off-screen. Keep the
247
- `payment_hash` and reopen the attempt with `POST /swaps/status`, which has no
248
- such window. On the drop-ins: `resumePaymentHash`, fed from `onState`, on
249
- `<Checkout>`; the `resume-payment-hash` attribute, fed from the
255
+ `payment_hash` on your order row, not in browser storage, and reopen the
256
+ attempt with `POST /swaps/status`, which has no such window. On the
257
+ drop-ins: `resumePaymentHash`, fed from `onState`, on `<Checkout>`; the
258
+ `resume-payment-hash` attribute, fed from the
250
259
  `openreceive-state` event (`event.detail.state.payment_hash`), on
251
260
  `<openreceive-checkout>`.
252
261
  That visit can come hours later, and `authorize` must still know the payer:
253
262
  a session that expired in between answers 403 and strands the deposit. On a
254
- guest shop, tie the order to a long-lived signed cookie, or put a secret
255
- per-order token in its URL that your page trades for that cookie.
263
+ guest shop, tie the order to a long-lived cookie signed with the app's own
264
+ secret (such as `SESSION_SECRET`, never a wallet or swap code), or put a
265
+ secret per-order token in its URL that your page trades for that cookie.
256
266
  https://openreceive.org/guides/swap-refunds.md
257
267
  - Show the payer WHAT THEY ARE BUYING. Return an optional `description` beside
258
268
  the price from `amountFor` and both drop-ins render it above the amount.
259
269
  Without it the checkout is a QR and "$1.00" with no sign of what the dollar
260
270
  is for.
261
- - Show the payer the transaction record: `createTransactionDetails(...)` rows,
271
+ - Show the payer the transaction record: `createTransactionDetails(...)` rows
272
+ (with no bundler use `renderTransactionDetailsHtml`: the standalone file has
273
+ no `createTransactionDetails`, and one bad import stops the whole page),
262
274
  collapsed behind a caret, on the live checkout AND on the receipt. A payment
263
275
  hash and a deposit txid are the only evidence a payer has that they paid you.
264
276
  `<Checkout>` / `<openreceive-checkout>` already render this panel and the
@@ -304,6 +316,15 @@ products, and you do not join them.
304
316
  live catalog lookup that could re-price a cart already placed. Return
305
317
  `{ currency, value }` as a decimal STRING, plus a `description` of what they
306
318
  are buying.
319
+ - **Donations and pay-what-you-want are fine.** The amount is the payer's
320
+ choice, so it enters through YOUR route, never OpenReceive's: the donate form
321
+ posts it to your own handler, which checks it and saves it on a new donation
322
+ row, made like an order. That row's id is the `reference`, and `amountFor`
323
+ reads the amount from the row, as it does for an order. Check it in that
324
+ handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
325
+ at most two decimal places. Refuse an amount outside them with a message;
326
+ never round it. Small amounts may be Lightning-only for some coins: the
327
+ checkout says which coins an amount is too small for.
307
328
  - **Users own the order; OpenReceive never sees them.** `authorize` uses the
308
329
  same ownership check this app already uses on the order show / pay page —
309
330
  `getSession(request.headers.get("cookie"))`, a cookie, whatever it is.
@@ -370,7 +391,9 @@ components.
370
391
  are on `@openreceive/browser`, not `/headless`.
371
392
  - A refund replaces the deposit panel. On `refund_required` also drop
372
393
  "switch payment method".
373
- - No "Open wallet" button on desktop.
394
+ - No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
395
+ App cancels an invoice opened from a link and pays the same invoice scanned
396
+ or pasted. Show the QR code and a Copy invoice button.
374
397
  - Wallet suggestions: `getPaymentWizardRoutes()` +
375
398
  `createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
376
399
  images load from a JavaScript chunk. For a custom headless UI, load it when