openreceive 0.4.26 → 0.4.28
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 +14 -0
- data/lib/openreceive/version.rb +1 -1
- data/skills/integrate-openreceive/SKILL.md +37 -5
- data/skills/integrate-openreceive/references/astro.md +653 -0
- data/skills/integrate-openreceive/references/bolt.md +580 -0
- data/skills/integrate-openreceive/references/btcpay.md +1 -1
- data/skills/integrate-openreceive/references/django.md +23 -2
- data/skills/integrate-openreceive/references/edd.md +407 -0
- data/skills/integrate-openreceive/references/fastapi.md +23 -2
- data/skills/integrate-openreceive/references/fastify.md +31 -6
- data/skills/integrate-openreceive/references/flask.md +23 -2
- data/skills/integrate-openreceive/references/fossbilling.md +433 -0
- data/skills/integrate-openreceive/references/laravel.md +1 -1
- data/skills/integrate-openreceive/references/lovable.md +6 -2
- data/skills/integrate-openreceive/references/medusa.md +468 -0
- data/skills/integrate-openreceive/references/mobile.md +492 -0
- data/skills/integrate-openreceive/references/nestjs.md +41 -16
- data/skills/integrate-openreceive/references/next.md +34 -7
- data/skills/integrate-openreceive/references/node.md +34 -7
- data/skills/integrate-openreceive/references/nuxt.md +606 -0
- data/skills/integrate-openreceive/references/paymenter.md +369 -0
- data/skills/integrate-openreceive/references/php.md +7 -4
- data/skills/integrate-openreceive/references/rails.md +14 -9
- data/skills/integrate-openreceive/references/react-router.md +617 -0
- data/skills/integrate-openreceive/references/sveltekit.md +650 -0
- data/skills/integrate-openreceive/references/tanstack-start.md +734 -0
- data/skills/integrate-openreceive/references/woocommerce.md +8 -6
- metadata +12 -1
|
@@ -3,7 +3,7 @@ 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
|
|
6
|
+
# READ THIS FIRST: this file is 44 KB and a summary drops required steps. Download it whole:
|
|
7
7
|
curl -fsSL https://openreceive.org/agent-directions/next/full.md
|
|
8
8
|
# Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
|
|
9
9
|
```
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/next/full.md
|
|
|
17
17
|
- Do not suggest rotating or revoking a code because it was pasted here.
|
|
18
18
|
- Start the quickstart only once the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
|
|
19
19
|
|
|
20
|
-
These directions describe OpenReceive 0.4.
|
|
20
|
+
These directions describe OpenReceive 0.4.28.
|
|
21
21
|
|
|
22
22
|
Add OpenReceive to a Next.js App Router application — the app you are already
|
|
23
23
|
working in. You do not need a copy of the OpenReceive source: the packages are
|
|
@@ -68,7 +68,9 @@ server load the file), then the quickstart.
|
|
|
68
68
|
On a hosted builder (v0, Vercel, Replit, Lovable), the user may say instead
|
|
69
69
|
that both codes are already set as the project's environment variables or
|
|
70
70
|
secrets. Believe them: do not ask for the codes, do not write `.env.local`, and
|
|
71
|
-
do not read or print the variables. Next reads them from the environment.
|
|
71
|
+
do not read or print the variables. Next reads them from the environment. Do not add them to a compose file or any other deploy config
|
|
72
|
+
either: they already reach the app, and a line such as `NWC_URI: ${NWC_URI}`
|
|
73
|
+
replaces them with an empty value.
|
|
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
|
|
@@ -317,7 +319,31 @@ products, and you do not join them.
|
|
|
317
319
|
app's equivalent) through the `query` the library hands you, on that same
|
|
318
320
|
settlement transaction, not a second connection from your ORM. Database writes
|
|
319
321
|
only in the hook; emails, jobs, and pushes after commit. Placeholder style is
|
|
320
|
-
the dialect you declared: `?` on sqlite, `$1` on postgres.
|
|
322
|
+
the dialect you declared: `?` on sqlite and mysql, `$1` on postgres.
|
|
323
|
+
|
|
324
|
+
### If the database is Supabase
|
|
325
|
+
|
|
326
|
+
Supabase is Postgres, so the tables above go there like any others. Three
|
|
327
|
+
things differ; https://openreceive.org/guides/supabase.md has each in full.
|
|
328
|
+
|
|
329
|
+
- Connect through its transaction pooler (port `6543`, user
|
|
330
|
+
`postgres.<project-ref>`). Run migrations through the session pooler
|
|
331
|
+
(port `5432` on the same host).
|
|
332
|
+
- Verify Supabase's certificate authority: delete `sslmode` from the URL and
|
|
333
|
+
give `pg` `ssl: { ca }`, the text of the project's `prod-ca-2021.crt` (an
|
|
334
|
+
environment variable such as `SUPABASE_CA_CERT`; it is not a secret). Never
|
|
335
|
+
`rejectUnauthorized: false`.
|
|
336
|
+
- After the migration, close both tables to Supabase's Data API, or anyone
|
|
337
|
+
with the project's anon key can read `swap_data`:
|
|
338
|
+
|
|
339
|
+
```sql
|
|
340
|
+
alter table openreceive_payments enable row level security;
|
|
341
|
+
alter table openreceive_meta enable row level security;
|
|
342
|
+
revoke all on table openreceive_payments, openreceive_meta from anon, authenticated;
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
`npx openreceive scaffold payments --supabase` writes the HTTPS-API route,
|
|
346
|
+
which is for Cloudflare Workers only. A Node server uses the connection above.
|
|
321
347
|
|
|
322
348
|
## If you build your own checkout UI
|
|
323
349
|
|
|
@@ -535,13 +561,14 @@ export const dynamic = "force-dynamic";
|
|
|
535
561
|
export const { GET, POST } = openReceiveNextHandlers({
|
|
536
562
|
wallet: { nwc: process.env.NWC_URI! }, // receive-only NWC code; your app refuses to start otherwise
|
|
537
563
|
storage: {
|
|
538
|
-
db, // pg Pool/Client, node:sqlite, better-sqlite3, or a custom adapter
|
|
564
|
+
db, // pg Pool/Client, mysql2 Pool, node:sqlite, better-sqlite3, or a custom adapter
|
|
539
565
|
onPaid: async ({ reference, paidAt, query }) => {
|
|
540
566
|
// Settlement transaction; runs only for the first settled attempt for a
|
|
541
567
|
// reference. The WHERE clause is the lock: a second fulfillment path of
|
|
542
568
|
// yours (admin action, replayed job) updates zero rows and does nothing.
|
|
543
|
-
// Use `query` here, not your ORM's other connection. `?` on sqlite
|
|
544
|
-
// on postgres.
|
|
569
|
+
// Use `query` here, not your ORM's other connection. `?` on sqlite and
|
|
570
|
+
// mysql, `$1` on postgres. MySQL has no RETURNING: after the UPDATE,
|
|
571
|
+
// `SELECT ROW_COUNT() AS claimed` tells you the same thing.
|
|
545
572
|
const claimed = await query(
|
|
546
573
|
"UPDATE orders SET state = 'paid', paid_at = ? WHERE id = ? AND state = 'awaiting_payment' RETURNING id",
|
|
547
574
|
[paidAt, reference],
|
|
@@ -3,7 +3,7 @@ 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
|
|
6
|
+
# READ THIS FIRST: this file is 40 KB and a summary drops required steps. Download it whole:
|
|
7
7
|
curl -fsSL https://openreceive.org/agent-directions/node/full.md
|
|
8
8
|
# Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
|
|
9
9
|
```
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/node/full.md
|
|
|
17
17
|
- Do not suggest rotating or revoking a code because it was pasted here.
|
|
18
18
|
- Start the quickstart only once the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
|
|
19
19
|
|
|
20
|
-
These directions describe OpenReceive 0.4.
|
|
20
|
+
These directions describe OpenReceive 0.4.28.
|
|
21
21
|
|
|
22
22
|
Add OpenReceive to a Node application — the app you are already working in. You
|
|
23
23
|
do not need a copy of the OpenReceive source: the packages are on npm, and the
|
|
@@ -65,7 +65,9 @@ server load the file), then the quickstart.
|
|
|
65
65
|
On a hosted builder (v0, Vercel, Replit, Lovable), the user may say instead
|
|
66
66
|
that both codes are already set as the project's environment variables or
|
|
67
67
|
secrets. Believe them: do not ask for the codes, do not write `.env`, and
|
|
68
|
-
do not read or print the variables. Skip step 5's file loading: the platform already puts them in `process.env`.
|
|
68
|
+
do not read or print the variables. Skip step 5's file loading: the platform already puts them in `process.env`. Do not add them to a compose file or any other deploy config
|
|
69
|
+
either: they already reach the app, and a line such as `NWC_URI: ${NWC_URI}`
|
|
70
|
+
replaces them with an empty value.
|
|
69
71
|
|
|
70
72
|
Otherwise your next action is a question to the user. Do not install packages,
|
|
71
73
|
edit the app, write `.env.example`, or search anywhere else before asking
|
|
@@ -308,7 +310,31 @@ products, and you do not join them.
|
|
|
308
310
|
app's equivalent) through the `query` the library hands you, on that same
|
|
309
311
|
settlement transaction, not a second connection from your ORM. Database writes
|
|
310
312
|
only in the hook; emails, jobs, and pushes after commit. Placeholder style is
|
|
311
|
-
the dialect you declared: `?` on sqlite, `$1` on postgres.
|
|
313
|
+
the dialect you declared: `?` on sqlite and mysql, `$1` on postgres.
|
|
314
|
+
|
|
315
|
+
### If the database is Supabase
|
|
316
|
+
|
|
317
|
+
Supabase is Postgres, so the tables above go there like any others. Three
|
|
318
|
+
things differ; https://openreceive.org/guides/supabase.md has each in full.
|
|
319
|
+
|
|
320
|
+
- Connect through its transaction pooler (port `6543`, user
|
|
321
|
+
`postgres.<project-ref>`). Run migrations through the session pooler
|
|
322
|
+
(port `5432` on the same host).
|
|
323
|
+
- Verify Supabase's certificate authority: delete `sslmode` from the URL and
|
|
324
|
+
give `pg` `ssl: { ca }`, the text of the project's `prod-ca-2021.crt` (an
|
|
325
|
+
environment variable such as `SUPABASE_CA_CERT`; it is not a secret). Never
|
|
326
|
+
`rejectUnauthorized: false`.
|
|
327
|
+
- After the migration, close both tables to Supabase's Data API, or anyone
|
|
328
|
+
with the project's anon key can read `swap_data`:
|
|
329
|
+
|
|
330
|
+
```sql
|
|
331
|
+
alter table openreceive_payments enable row level security;
|
|
332
|
+
alter table openreceive_meta enable row level security;
|
|
333
|
+
revoke all on table openreceive_payments, openreceive_meta from anon, authenticated;
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`npx openreceive scaffold payments --supabase` writes the HTTPS-API route,
|
|
337
|
+
which is for Cloudflare Workers only. A Node server uses the connection above.
|
|
312
338
|
|
|
313
339
|
## If you build your own checkout UI
|
|
314
340
|
|
|
@@ -517,13 +543,14 @@ app.use(express.json());
|
|
|
517
543
|
const openreceive = openReceiveExpress({
|
|
518
544
|
wallet: { nwc: process.env.NWC_URI! }, // receive-only NWC code; your app refuses to start otherwise
|
|
519
545
|
storage: {
|
|
520
|
-
db, // pg Pool/Client, node:sqlite, better-sqlite3, or a custom adapter
|
|
546
|
+
db, // pg Pool/Client, mysql2 Pool, node:sqlite, better-sqlite3, or a custom adapter
|
|
521
547
|
onPaid: async ({ reference, paidAt, query }) => {
|
|
522
548
|
// Settlement transaction; runs only for the first settled attempt for a
|
|
523
549
|
// reference. The WHERE clause is the lock: a second fulfillment path of
|
|
524
550
|
// yours (admin action, replayed job) updates zero rows and does nothing.
|
|
525
|
-
// Use `query` here, not your ORM's other connection. `?` on sqlite
|
|
526
|
-
// on postgres.
|
|
551
|
+
// Use `query` here, not your ORM's other connection. `?` on sqlite and
|
|
552
|
+
// mysql, `$1` on postgres. MySQL has no RETURNING: after the UPDATE,
|
|
553
|
+
// `SELECT ROW_COUNT() AS claimed` tells you the same thing.
|
|
527
554
|
const claimed = await query(
|
|
528
555
|
"UPDATE orders SET state = 'paid', paid_at = ? WHERE id = ? AND state = 'awaiting_payment' RETURNING id",
|
|
529
556
|
[paidAt, reference],
|