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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/openreceive/nwc_ruby.rb +27 -0
- data/lib/openreceive/version.rb +1 -1
- data/skills/debug-openreceive-payment/SKILL.md +1 -0
- data/skills/integrate-openreceive/references/astro.md +35 -12
- data/skills/integrate-openreceive/references/bolt.md +3 -3
- data/skills/integrate-openreceive/references/btcpay.md +2 -1
- data/skills/integrate-openreceive/references/django.md +28 -8
- data/skills/integrate-openreceive/references/edd.md +12 -10
- data/skills/integrate-openreceive/references/fastapi.md +54 -30
- data/skills/integrate-openreceive/references/fastify.md +39 -13
- data/skills/integrate-openreceive/references/flask.md +38 -12
- data/skills/integrate-openreceive/references/fossbilling.md +25 -15
- data/skills/integrate-openreceive/references/laravel.md +36 -7
- data/skills/integrate-openreceive/references/lovable.md +2 -2
- data/skills/integrate-openreceive/references/medusa.md +2 -1
- data/skills/integrate-openreceive/references/mobile.md +2 -1
- data/skills/integrate-openreceive/references/nestjs.md +36 -12
- data/skills/integrate-openreceive/references/next.md +55 -29
- data/skills/integrate-openreceive/references/node.md +46 -14
- data/skills/integrate-openreceive/references/nuxt.md +35 -12
- data/skills/integrate-openreceive/references/odoo.md +13 -12
- data/skills/integrate-openreceive/references/paymenter.md +11 -7
- data/skills/integrate-openreceive/references/php.md +35 -10
- data/skills/integrate-openreceive/references/prestashop.md +28 -18
- data/skills/integrate-openreceive/references/rails.md +44 -13
- data/skills/integrate-openreceive/references/react-router.md +35 -12
- data/skills/integrate-openreceive/references/sveltekit.md +43 -14
- data/skills/integrate-openreceive/references/tanstack-start.md +35 -12
- data/skills/integrate-openreceive/references/vendure.md +2 -1
- data/skills/integrate-openreceive/references/woocommerce.md +17 -11
- metadata +1 -1
|
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
|
|
|
3
3
|
# OpenReceive agent directions (Fastify)
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
# READ THIS FIRST: this file is
|
|
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/fastify/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/fastify/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/fastify/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.
|
|
21
|
+
These directions describe OpenReceive 0.4.33.
|
|
21
22
|
|
|
22
23
|
Add OpenReceive to a Fastify application — the app you are already working in.
|
|
23
24
|
You do not need a copy of the OpenReceive source: the packages are on npm, and
|
|
@@ -62,8 +63,9 @@ Before anything else, check one file: the project's `.env`, if it exists.
|
|
|
62
63
|
`grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
|
|
63
64
|
it sets without printing them. Check with that, here and after each write,
|
|
64
65
|
not by reading the file, and never print the values. A code that is already
|
|
65
|
-
set is not asked for again; if both are set,
|
|
66
|
-
|
|
66
|
+
set is not asked for again; if both are set, make sure `.gitignore` covers
|
|
67
|
+
`.env` (and `.dockerignore`, if the app has one), then skip to step 5
|
|
68
|
+
(making the server load the file), then the quickstart.
|
|
67
69
|
|
|
68
70
|
Otherwise your next action is a question to the user. Do not install packages,
|
|
69
71
|
edit the app, write `.env.example`, or search anywhere else before asking
|
|
@@ -192,6 +194,10 @@ itself, and they hold for every integration.
|
|
|
192
194
|
- Work only in this application. Never read or run anything from another
|
|
193
195
|
project on this machine (its `node_modules`, tools or source), for any
|
|
194
196
|
reason. A browser and Playwright are not part of setup.
|
|
197
|
+
- The project's own rules (its `AGENTS.md`, contributing guide) win over these
|
|
198
|
+
directions. If one forbids a step here, such as running migrations, ask the
|
|
199
|
+
owner and wait for the answer, even if doctor cannot pass yet. Do not move
|
|
200
|
+
the step somewhere the rule does not name, such as app startup.
|
|
195
201
|
- Restart only this app's server, on the port it already uses: stop the
|
|
196
202
|
process you started, or the one listening on that port, by its pid (or
|
|
197
203
|
restart its Compose service). Never `pkill` or `killall` by name: that
|
|
@@ -208,7 +214,8 @@ itself, and they hold for every integration.
|
|
|
208
214
|
environment (`printenv`, `env`, `docker compose config`), even filtered to
|
|
209
215
|
names.
|
|
210
216
|
- The host owns the price. `amountFor` reads it from your own data; reject
|
|
211
|
-
payer-supplied amounts.
|
|
217
|
+
payer-supplied amounts. A donation is no exception: its amount is saved
|
|
218
|
+
by your own route first (Donations, below).
|
|
212
219
|
- `authorize` runs on every request, and the `resource` it receives is a CLAIM
|
|
213
220
|
the payer made, not proof. Read a framework session; never trust a body field.
|
|
214
221
|
- `onPaid` must be idempotent. Its database fulfillment commits once per `reference` — your order id, one
|
|
@@ -233,21 +240,25 @@ itself, and they hold for every integration.
|
|
|
233
240
|
(`POST /swaps`) re-serves the committed attempt — but only while it is live,
|
|
234
241
|
and the shadow invoice behind a swap lasts about half an hour, after which the
|
|
235
242
|
same click mints a NEW deposit address and the refund is off-screen. Keep the
|
|
236
|
-
`payment_hash`
|
|
237
|
-
|
|
238
|
-
|
|
243
|
+
`payment_hash` on your order row, not in browser storage, and reopen the
|
|
244
|
+
attempt with `POST /swaps/status`, which has no such window. On the
|
|
245
|
+
drop-ins: `resumePaymentHash`, fed from `onState`, on `<Checkout>`; the
|
|
246
|
+
`resume-payment-hash` attribute, fed from the
|
|
239
247
|
`openreceive-state` event (`event.detail.state.payment_hash`), on
|
|
240
248
|
`<openreceive-checkout>`.
|
|
241
249
|
That visit can come hours later, and `authorize` must still know the payer:
|
|
242
250
|
a session that expired in between answers 403 and strands the deposit. On a
|
|
243
|
-
guest shop, tie the order to a long-lived signed
|
|
244
|
-
|
|
251
|
+
guest shop, tie the order to a long-lived cookie signed with the app's own
|
|
252
|
+
secret (such as `SESSION_SECRET`, never a wallet or swap code), or put a
|
|
253
|
+
secret per-order token in its URL that your page trades for that cookie.
|
|
245
254
|
https://openreceive.org/guides/swap-refunds.md
|
|
246
255
|
- Show the payer WHAT THEY ARE BUYING. Return an optional `description` beside
|
|
247
256
|
the price from `amountFor` and both drop-ins render it above the amount.
|
|
248
257
|
Without it the checkout is a QR and "$1.00" with no sign of what the dollar
|
|
249
258
|
is for.
|
|
250
|
-
- 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),
|
|
251
262
|
collapsed behind a caret, on the live checkout AND on the receipt. A payment
|
|
252
263
|
hash and a deposit txid are the only evidence a payer has that they paid you.
|
|
253
264
|
`<Checkout>` / `<openreceive-checkout>` already render this panel and the
|
|
@@ -285,6 +296,15 @@ products, and you do not join them.
|
|
|
285
296
|
live catalog lookup that could re-price a cart already placed. Return
|
|
286
297
|
`{ currency, value }` as a decimal STRING, plus a `description` of what they
|
|
287
298
|
are buying.
|
|
299
|
+
- **Donations and pay-what-you-want are fine.** The amount is the payer's
|
|
300
|
+
choice, so it enters through YOUR route, never OpenReceive's: the donate form
|
|
301
|
+
posts it to your own handler, which checks it and saves it on a new donation
|
|
302
|
+
row, made like an order. That row's id is the `reference`, and `amountFor`
|
|
303
|
+
reads the amount from the row, as it does for an order. Check it in that
|
|
304
|
+
handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
|
|
305
|
+
at most two decimal places. Refuse an amount outside them with a message;
|
|
306
|
+
never round it. Small amounts may be Lightning-only for some coins: the
|
|
307
|
+
checkout says which coins an amount is too small for.
|
|
288
308
|
- **Users own the order; OpenReceive never sees them.** `authorize` uses the
|
|
289
309
|
same ownership check this app already uses on the order show / pay page —
|
|
290
310
|
`sessions.currentUser(native)`, a cookie, whatever it is. Pass `native` (the
|
|
@@ -379,7 +399,9 @@ components.
|
|
|
379
399
|
are on `@openreceive/browser`, not `/headless`.
|
|
380
400
|
- A refund replaces the deposit panel. On `refund_required` also drop
|
|
381
401
|
"switch payment method".
|
|
382
|
-
- No "Open wallet" button
|
|
402
|
+
- No "Open wallet" or "Pay in wallet" button, and no `lightning:` link. Cash
|
|
403
|
+
App cancels an invoice opened from a link and pays the same invoice scanned
|
|
404
|
+
or pasted. Show the QR code and a Copy invoice button.
|
|
383
405
|
- Wallet suggestions: `getPaymentWizardRoutes()` +
|
|
384
406
|
`createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
|
|
385
407
|
images load from a JavaScript chunk. For a custom headless UI, load it when
|
|
@@ -495,6 +517,8 @@ there is nothing else to generate. Details:
|
|
|
495
517
|
|
|
496
518
|
No ORM? You can pass a bare driver handle (`pg`, `node:sqlite`,
|
|
497
519
|
`better-sqlite3`) as the `db` in step 4. The scaffold has no flavor for it.
|
|
520
|
+
`node:sqlite` needs Node 22.13 or newer: before that it sits behind
|
|
521
|
+
`--experimental-sqlite`.
|
|
498
522
|
Instead of scaffolding, run the same DDL once yourself, using
|
|
499
523
|
`paymentsSchemaSql(dialect)` from `@openreceive/http`. Your adapter already
|
|
500
524
|
pulls that package in, but this import is yours, so install it too:
|
|
@@ -562,7 +586,9 @@ await app.register(openReceiveFastify, {
|
|
|
562
586
|
// yours (admin action, replayed job) updates zero rows and does nothing.
|
|
563
587
|
// Use `query` here, not your ORM's other connection. `?` on sqlite and
|
|
564
588
|
// mysql, `$1` on postgres. MySQL has no RETURNING: after the UPDATE,
|
|
565
|
-
// `SELECT ROW_COUNT() AS claimed` tells you the same thing.
|
|
589
|
+
// `SELECT ROW_COUNT() AS claimed` tells you the same thing. `paidAt` is
|
|
590
|
+
// Unix seconds: for a timestamp column write `to_timestamp($1)` on
|
|
591
|
+
// postgres or `FROM_UNIXTIME(?)` on mysql in place of its placeholder.
|
|
566
592
|
const claimed = await query(
|
|
567
593
|
"UPDATE orders SET state = 'paid', paid_at = ? WHERE id = ? AND state = 'awaiting_payment' RETURNING id",
|
|
568
594
|
[paidAt, reference],
|
|
@@ -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
|
|
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.
|
|
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
|
|
@@ -67,8 +68,9 @@ Before anything else, check one file: the project's `.env`, if it exists.
|
|
|
67
68
|
`grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
|
|
68
69
|
it sets without printing them. Check with that, here and after each write,
|
|
69
70
|
not by reading the file, and never print the values. A code that is already
|
|
70
|
-
set is not asked for again; if both are set,
|
|
71
|
-
|
|
71
|
+
set is not asked for again; if both are set, make sure `.gitignore` covers
|
|
72
|
+
`.env` (and `.dockerignore`, if the app has one), then skip to step 5
|
|
73
|
+
(making the server load the file), then the quickstart.
|
|
72
74
|
|
|
73
75
|
Otherwise your next action is a question to the user. Do not install packages,
|
|
74
76
|
edit the app, write `.env.example`, or search anywhere else before asking
|
|
@@ -208,6 +210,10 @@ itself, and they hold for every integration.
|
|
|
208
210
|
- Work only in this application. Never read or run anything from another
|
|
209
211
|
project on this machine (its `node_modules`, tools or source), for any
|
|
210
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.
|
|
211
217
|
- Restart only this app's server, on the port it already uses: stop the
|
|
212
218
|
process you started, or the one listening on that port, by its pid (or
|
|
213
219
|
restart its Compose service). Never `pkill` or `killall` by name: that
|
|
@@ -224,7 +230,8 @@ itself, and they hold for every integration.
|
|
|
224
230
|
environment (`printenv`, `env`, `docker compose config`), even filtered to
|
|
225
231
|
names.
|
|
226
232
|
- The host owns the price. `amount_for` reads it from your own data; reject
|
|
227
|
-
payer-supplied amounts.
|
|
233
|
+
payer-supplied amounts. A donation is no exception: its amount is saved
|
|
234
|
+
by your own route first (Donations, below).
|
|
228
235
|
- `authorize` runs on every request, and the `resource` it receives is a CLAIM
|
|
229
236
|
the payer made, not proof. Read Flask's `session` or Flask-Login's
|
|
230
237
|
`current_user`; never trust a body field.
|
|
@@ -264,7 +271,9 @@ itself, and they hold for every integration.
|
|
|
264
271
|
the price from `amount_for` and both drop-ins render it above the amount.
|
|
265
272
|
Without it the checkout is a QR and "$1.00" with no sign of what the dollar
|
|
266
273
|
is for.
|
|
267
|
-
- 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),
|
|
268
277
|
collapsed behind a caret, on the live checkout AND on the receipt. A payment
|
|
269
278
|
hash and a deposit txid are the only evidence a payer has that they paid you.
|
|
270
279
|
`<Checkout>` / `<openreceive-checkout>` already render this panel and the
|
|
@@ -312,6 +321,15 @@ orders, users, or products, and you do not join them.
|
|
|
312
321
|
live catalog lookup that could re-price a cart already placed. Return
|
|
313
322
|
`{"currency", "value"}` as a decimal STRING, plus a `description` of what
|
|
314
323
|
they are buying.
|
|
324
|
+
- **Donations and pay-what-you-want are fine.** The amount is the payer's
|
|
325
|
+
choice, so it enters through YOUR route, never OpenReceive's: the donate form
|
|
326
|
+
posts it to your own handler, which checks it and saves it on a new donation
|
|
327
|
+
row, made like an order. That row's id is the `reference`, and `amount_for`
|
|
328
|
+
reads the amount from the row, as it does for an order. Check it in that
|
|
329
|
+
handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
|
|
330
|
+
at most two decimal places. Refuse an amount outside them with a message;
|
|
331
|
+
never round it. Small amounts may be Lightning-only for some coins: the
|
|
332
|
+
checkout says which coins an amount is too small for.
|
|
315
333
|
- **Users own the order; OpenReceive never sees them.** `authorize` uses the
|
|
316
334
|
same ownership check this app already uses on the order show / pay page —
|
|
317
335
|
Flask-Login's `current_user`, an id in `session`, whatever it is. It runs
|
|
@@ -400,7 +418,9 @@ components.
|
|
|
400
418
|
are on `@openreceive/browser`, not `/headless`.
|
|
401
419
|
- A refund replaces the deposit panel. On `refund_required` also drop
|
|
402
420
|
"switch payment method".
|
|
403
|
-
- No "Open wallet" button
|
|
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.
|
|
404
424
|
- Wallet suggestions: `getPaymentWizardRoutes()` +
|
|
405
425
|
`createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
|
|
406
426
|
images load from a JavaScript chunk. For a custom headless UI, load it when
|
|
@@ -487,8 +507,8 @@ wallet client (websockets, coincurve, cryptography), the HTTP engine, the
|
|
|
487
507
|
with Jinja templates needs no npm. Add your database driver if the app does
|
|
488
508
|
not have one yet, such as `psycopg[binary]` for Postgres.
|
|
489
509
|
|
|
490
|
-
Use `uv` or a virtualenv on Python 3.10
|
|
491
|
-
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.
|
|
492
512
|
|
|
493
513
|
### 2. Create the payment tables
|
|
494
514
|
|
|
@@ -604,7 +624,8 @@ class OpenReceiveFlask:
|
|
|
604
624
|
|
|
605
625
|
def start(self):
|
|
606
626
|
"""Build the stack once. Raises ConfigurationError when NWC_URI is
|
|
607
|
-
missing
|
|
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."""
|
|
608
629
|
with self._lock:
|
|
609
630
|
if self._app is None:
|
|
610
631
|
nwc = os.environ.get("NWC_URI", "").strip()
|
|
@@ -722,11 +743,16 @@ payments_engine = create_engine(os.environ["DATABASE_URL"])
|
|
|
722
743
|
openreceive = OpenReceiveFlask(host, payments_engine, rate_limiting=True)
|
|
723
744
|
app.register_blueprint(openreceive.blueprint()) # serves /openreceive/...
|
|
724
745
|
|
|
725
|
-
# The receive-only wallet check, where the app boots: a missing
|
|
726
|
-
#
|
|
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.
|
|
727
748
|
openreceive.start()
|
|
728
749
|
```
|
|
729
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
|
+
|
|
730
756
|
`openreceive.start()` runs once per process. A command that imports the app
|
|
731
757
|
with no wallet access, such as a build step, can skip it: the first payment
|
|
732
758
|
request then runs the check, and the routes answer `503 WALLET_UNAVAILABLE`
|
|
@@ -3,8 +3,9 @@ This is the full file; follow it from Step 0.
|
|
|
3
3
|
# OpenReceive agent directions (FOSSBilling)
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
# READ THIS FIRST: this file is
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
201
|
-
|
|
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.
|
|
280
|
-
unzip -oq openreceive-fossbilling-0.4.
|
|
281
|
-
rm openreceive-fossbilling-0.4.
|
|
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
|
```
|
|
@@ -304,10 +311,13 @@ installable extension.
|
|
|
304
311
|
|
|
305
312
|
Each release also attaches `openreceive-fossbilling-module-<version>.zip`:
|
|
306
313
|
the module alone, with its files at the top of the ZIP rather than inside
|
|
307
|
-
`modules/Openreceive`. That is the package
|
|
308
|
-
|
|
309
|
-
and
|
|
310
|
-
|
|
314
|
+
`modules/Openreceive`. That is the package
|
|
315
|
+
[FOSSBilling's extension directory](https://extensions.fossbilling.org/extension/openreceive)
|
|
316
|
+
lists and installs. Its **Install** button unpacks the ZIP into
|
|
317
|
+
`modules/Openreceive`, and activating OpenReceive under **Extensions** then
|
|
318
|
+
writes the payment gateway, as above. Both ZIPs hold the same module. The
|
|
319
|
+
directory gets a new version only when a release matters to FOSSBilling
|
|
320
|
+
sites, so it can list an older version than the latest release.
|
|
311
321
|
|
|
312
322
|
#### FOSSBilling in Docker
|
|
313
323
|
|
|
@@ -330,7 +340,7 @@ Run every command inside the container, in `/var/www/html`, as its web user
|
|
|
330
340
|
`www-data`. Unpack the release there too:
|
|
331
341
|
|
|
332
342
|
```sh
|
|
333
|
-
docker compose exec -T -u www-data fossbilling sh -c 'curl -fsSLO https://github.com/OpenReceive/openreceive/releases/download/v0.4.
|
|
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'
|
|
334
344
|
docker compose exec -T -u www-data fossbilling php modules/Openreceive/activate.php
|
|
335
345
|
```
|
|
336
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
|
|
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.
|
|
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
|
|
@@ -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,
|
|
67
|
-
|
|
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 install the package,
|
|
70
72
|
edit the app, write `.env.example`, or search anywhere else before asking
|
|
@@ -200,6 +202,10 @@ itself, and they hold for every integration.
|
|
|
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
|
|
@@ -217,7 +223,8 @@ itself, and they hold for every integration.
|
|
|
217
223
|
names. Doctor runs as an artisan command, so also open the checkout page:
|
|
218
224
|
the web server can miss a code that doctor sees (step 5).
|
|
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 the Illuminate request it is handed — the
|
|
223
230
|
session, `$request->user()`; never trust a body field. `openreceive:install`
|
|
@@ -260,7 +267,9 @@ itself, and they hold for every integration.
|
|
|
260
267
|
the price from `amountFor` and both drop-ins render it above the
|
|
261
268
|
amount. Without it the checkout is a QR and "$1.00" with no sign of what the
|
|
262
269
|
dollar is for.
|
|
263
|
-
- 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),
|
|
264
273
|
collapsed behind a caret, on the live checkout AND on the receipt. A payment
|
|
265
274
|
hash and a deposit txid are the only evidence a payer has that they paid you.
|
|
266
275
|
`<openreceive-checkout>` / React's `<Checkout>` already render this panel and
|
|
@@ -291,6 +300,15 @@ not replace your orders, users, or products, and you do not join them.
|
|
|
291
300
|
live catalog lookup that could re-price a cart already placed. Return
|
|
292
301
|
`['currency' => …, 'value' => …]` with `value` a decimal STRING, plus a
|
|
293
302
|
`description` of what they are buying.
|
|
303
|
+
- **Donations and pay-what-you-want are fine.** The amount is the payer's
|
|
304
|
+
choice, so it enters through YOUR route, never OpenReceive's: the donate form
|
|
305
|
+
posts it to your own handler, which checks it and saves it on a new donation
|
|
306
|
+
row, made like an order. That row's id is the `reference`, and `amountFor`
|
|
307
|
+
reads the amount from the row, as it does for an order. Check it in that
|
|
308
|
+
handler: a floor and a cap ($1 and $10,000 unless the owner gave others) and
|
|
309
|
+
at most two decimal places. Refuse an amount outside them with a message;
|
|
310
|
+
never round it. Small amounts may be Lightning-only for some coins: the
|
|
311
|
+
checkout says which coins an amount is too small for.
|
|
294
312
|
- **Users own the order; OpenReceive never sees them.** `authorize` uses the
|
|
295
313
|
same ownership check this app already uses on the order show / pay page —
|
|
296
314
|
`$request->user()`, a policy, a session key, an encrypted cookie, whatever
|
|
@@ -355,7 +373,9 @@ built on `@openreceive/browser/headless`. Read that before writing components.
|
|
|
355
373
|
are on `@openreceive/browser`, not `/headless`.
|
|
356
374
|
- A refund replaces the deposit panel. On `refund_required` also drop
|
|
357
375
|
"switch payment method".
|
|
358
|
-
- No "Open wallet" button
|
|
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.
|
|
359
379
|
- Wallet suggestions: `getPaymentWizardRoutes()` +
|
|
360
380
|
`createWizardRouteDisplays`. Lightning only. Logos are data URIs; tutorial
|
|
361
381
|
images load from a JavaScript chunk. For a custom headless UI, load it when
|
|
@@ -441,6 +461,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends libgmp-dev \
|
|
|
441
461
|
&& rm -rf /var/lib/apt/lists/*
|
|
442
462
|
```
|
|
443
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
|
+
|
|
444
473
|
Run `composer require` with a PHP that has gmp. On a machine without one,
|
|
445
474
|
use the rebuilt image with the project mounted, then rebuild again so the
|
|
446
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|