openreceive 0.4.11 → 0.4.14
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 +19 -0
- data/lib/openreceive/version.rb +1 -1
- data/skills/debug-openreceive-payment/SKILL.md +1 -1
- data/skills/integrate-openreceive/SKILL.md +4 -3
- data/skills/integrate-openreceive/references/btcpay.md +65 -36
- data/skills/integrate-openreceive/references/django.md +295 -246
- data/skills/integrate-openreceive/references/fastapi.md +210 -157
- data/skills/integrate-openreceive/references/fastify.md +206 -149
- data/skills/integrate-openreceive/references/laravel.md +298 -236
- data/skills/integrate-openreceive/references/next.md +216 -164
- data/skills/integrate-openreceive/references/node.md +194 -140
- data/skills/integrate-openreceive/references/php.md +248 -193
- data/skills/integrate-openreceive/references/rails.md +266 -220
- data/skills/integrate-openreceive/references/woocommerce.md +66 -51
- metadata +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (Node.js)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.14.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a Node application — the app you are already working in. You
|
|
6
6
|
do not need a copy of the OpenReceive source: the packages are on npm, and the
|
|
@@ -31,62 +31,90 @@ The one required credential is a receive-only NWC code (Nostr Wallet Connect):
|
|
|
31
31
|
a string from the merchant's wallet that can create invoices and read their
|
|
32
32
|
status, and cannot spend. A swap provider (an "LSC" code) optionally lets the
|
|
33
33
|
payer send USDT, USDC, ETH or SOL instead, converted into that same
|
|
34
|
-
Lightning payment.
|
|
34
|
+
Lightning payment. Step 0 collects those credentials from the user; you write three hooks — `authorize`, `amountFor`,
|
|
35
35
|
`onPaid`;
|
|
36
36
|
OpenReceive supplies invoices, polling, settlement and the checkout UI. It never
|
|
37
37
|
owns orders, users, prices, or fulfillment.
|
|
38
38
|
|
|
39
|
-
## Step 0 —
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
39
|
+
## Step 0 — ask for the two codes, one question at a time
|
|
40
|
+
|
|
41
|
+
Before anything else, look at one file: the project's `.env`, if it exists.
|
|
42
|
+
Read it only far enough to see whether `NWC_URI` and `LSC_URI_PRIMARY` are
|
|
43
|
+
there and non-empty, and never print the values. A code that is already
|
|
44
|
+
set is not asked for again; if both are set, skip to step 5
|
|
45
|
+
(making the server load the file), then the quickstart.
|
|
46
|
+
|
|
47
|
+
Otherwise your next action is a question to the user. Do not install packages,
|
|
48
|
+
edit the app, write `.env.example`, or search anywhere else before asking
|
|
49
|
+
it. Do not read deploy config (compose files, platform secrets), Docker containers, or process environments, and never run
|
|
50
|
+
`printenv`. A new shop has neither code yet: hunting for one burns the turn and
|
|
51
|
+
can leak other secrets into the transcript.
|
|
52
|
+
|
|
53
|
+
Two server-only URIs are needed before the quickstart:
|
|
54
|
+
|
|
55
|
+
- `NWC_URI` — a receive-only Nostr Wallet Connect code,
|
|
56
|
+
`nostr+walletconnect://…`. Required for Bitcoin.
|
|
57
|
+
- `LSC_URI_PRIMARY` — a Lightning Swap Connect URI,
|
|
58
|
+
`lightning+swapconnect://…`. Required for USDT, USDC, ETH and SOL. Skip it
|
|
59
|
+
only when the user says they want Bitcoin alone.
|
|
60
|
+
|
|
61
|
+
The user never edits an environment file. They paste each code into the chat;
|
|
62
|
+
you store it. Ask one question per message.
|
|
63
|
+
|
|
64
|
+
1. **First message — the NWC code, and nothing else.** Ask for it and walk them
|
|
65
|
+
through getting it:
|
|
66
|
+
|
|
67
|
+
> To receive payments I need a receive-only wallet code. In Rizful: open
|
|
68
|
+
> the menu, tap NWC, choose Receive-only NWC code, and tap Copy
|
|
69
|
+
> (https://openreceive.org/get_a_nwc_code_to_receive_payments). If you would
|
|
70
|
+
> rather run your own wallet, Alby Hub works too: Connections → Add
|
|
71
|
+
> Connection → Read Only. Paste the code here and I will store it.
|
|
72
|
+
|
|
73
|
+
Do not mention `.env`, exports, or "tell me when it's set".
|
|
74
|
+
2. **When they paste it.** If it does not start with `nostr+walletconnect://`,
|
|
75
|
+
ask them to copy the receive-only code again. Otherwise write
|
|
76
|
+
`NWC_URI=<paste>` into the project's `.env`, creating the file if needed.
|
|
77
|
+
Make sure `.gitignore` covers `.env` (and `.dockerignore`, if the app has
|
|
78
|
+
one). Never echo the value, commit it, or put it in client code. Reply only
|
|
79
|
+
that it is saved, then ask the next question.
|
|
80
|
+
3. **Second message — swaps.** If the user already asked for stablecoins or
|
|
81
|
+
altcoins, skip the yes/no and go straight to the walkthrough. Otherwise ask
|
|
82
|
+
whether payers should also be able to pay with USDT, USDC, ETH or SOL. The
|
|
83
|
+
walkthrough:
|
|
84
|
+
|
|
85
|
+
> Go to https://lightning-swap.com, sign in for API keys, create a key, and
|
|
86
|
+
> copy the whole URI (https://openreceive.org/set_up_swap_provider). Paste
|
|
87
|
+
> it here and I will store it — or say "Bitcoin only" and I will continue
|
|
88
|
+
> without it.
|
|
89
|
+
|
|
90
|
+
Mention FixedFloat only if they already use it.
|
|
91
|
+
4. **When they paste it.** If it does not start with
|
|
92
|
+
`lightning+swapconnect://`, ask them to copy it again. Otherwise add
|
|
93
|
+
`LSC_URI_PRIMARY=<paste>` to the same `.env`, without echoing it. Swaps
|
|
94
|
+
are now on, so build the refund route back (the swap non-negotiable below) as
|
|
95
|
+
part of this integration. If they chose Bitcoin only, leave
|
|
96
|
+
`LSC_URI_PRIMARY` unset and skip that route.
|
|
97
|
+
5. **Make the server load the file — yourself.** OpenReceive reads
|
|
98
|
+
`process.env`, and a `.env` file on disk is not in it. Put
|
|
99
|
+
`import "dotenv/config";` at the top of the server entry, as the quickstart
|
|
100
|
+
does. When the app is started with Docker Compose, give the service
|
|
101
|
+
`env_file: .env`. Restart the server after writing the file.
|
|
102
|
+
|
|
103
|
+
Do not invent placeholder URIs. Start the quickstart only once `NWC_URI` is
|
|
104
|
+
saved and `LSC_URI_PRIMARY` is saved or explicitly declined. The first boot
|
|
105
|
+
runs the receive-only preflight: if it reports spend methods such as
|
|
106
|
+
`pay_invoice`, remove `NWC_URI` from `.env` and ask for a receive-only code
|
|
107
|
+
again. Never set the spend-capable override to get past it.
|
|
108
|
+
|
|
109
|
+
### Upgrading an existing install
|
|
110
|
+
|
|
111
|
+
This is not the opening move of a new integration. When OpenReceive is ALREADY
|
|
112
|
+
installed here, `npx openreceive doctor` reports every credential as set/unset
|
|
113
|
+
(never the value) and probes the wallet. Check the installed
|
|
114
|
+
`@openreceive/node` and `@openreceive/browser` against the release named at the
|
|
115
|
+
top of this file: the headless display models below do not exist in older
|
|
116
|
+
versions, and the first tile click throws with nothing saying why. Upgrade
|
|
117
|
+
first.
|
|
90
118
|
|
|
91
119
|
Only then start the quickstart.
|
|
92
120
|
|
|
@@ -118,15 +146,19 @@ itself, and they hold for every integration.
|
|
|
118
146
|
late becomes `refund_required`, and the payer claims it on a SECOND VISIT,
|
|
119
147
|
after leaving your page to fetch an address from another wallet. Three things
|
|
120
148
|
must exist or that money is unreachable through your UI: a per-order URL your
|
|
121
|
-
server serves (`/checkout/:reference` — `syncUrl` on
|
|
122
|
-
|
|
149
|
+
server serves (`/checkout/:reference` — `syncUrl` on `<Checkout>`, `sync-url`
|
|
150
|
+
or `resumable` on `<openreceive-checkout>`), your own order-summary route to
|
|
151
|
+
restore the order from, and the ATTEMPT.
|
|
123
152
|
`/checkouts/prepare` returns no attempts, so a checkout rebuilt from the
|
|
124
153
|
reference alone opens on the method grid. Re-picking the same coin
|
|
125
154
|
(`POST /swaps`) re-serves the committed attempt — but only while it is live,
|
|
126
155
|
and the shadow invoice behind a swap lasts about half an hour, after which the
|
|
127
156
|
same click mints a NEW deposit address and the refund is off-screen. Keep the
|
|
128
157
|
`payment_hash` and reopen the attempt with `POST /swaps/status`, which has no
|
|
129
|
-
such window.
|
|
158
|
+
such window. On the drop-ins: `resumePaymentHash`, fed from `onState`, on
|
|
159
|
+
`<Checkout>`; the `resume-payment-hash` attribute, fed from the
|
|
160
|
+
`openreceive-state` event (`event.detail.state.payment_hash`), on
|
|
161
|
+
`<openreceive-checkout>`. https://openreceive.org/guides/swap-refunds.md
|
|
130
162
|
- Show the payer WHAT THEY ARE BUYING. Return an optional `description` beside
|
|
131
163
|
the price from `amountFor` and both drop-ins render it above the amount.
|
|
132
164
|
Without it the checkout is a QR and "$1.00" with no sign of what the dollar
|
|
@@ -295,11 +327,11 @@ Express + React. Requires Node ≥ 22.
|
|
|
295
327
|
npm install @openreceive/express @openreceive/react
|
|
296
328
|
```
|
|
297
329
|
|
|
298
|
-
Install the adapter for your server and the UI package for your frontend
|
|
330
|
+
Install the adapter for your server and the UI package for your frontend. The
|
|
299
331
|
wallet client, HTTP handler, and contracts come along as dependencies. The
|
|
300
|
-
`openreceive` package is the CLI
|
|
301
|
-
install.
|
|
302
|
-
|
|
332
|
+
`openreceive` package is only the CLI, and `npx openreceive …` below needs no
|
|
333
|
+
install. On a different stack, swap the two packages; the rest of this guide
|
|
334
|
+
stays the same.
|
|
303
335
|
|
|
304
336
|
| | Packages |
|
|
305
337
|
| -------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -309,14 +341,16 @@ identical.
|
|
|
309
341
|
Fastify: [quickstart-fastify.md](https://openreceive.org/guides/quickstart-fastify.md) · Next.js:
|
|
310
342
|
[quickstart-next.md](https://openreceive.org/guides/quickstart-next.md). This page is the Express one.
|
|
311
343
|
|
|
312
|
-
On a fresh project, also install what this guide assumes
|
|
313
|
-
framework and an env loader (`npm install express dotenv`)
|
|
314
|
-
before step 2 (`npm install prisma @prisma/client` on the Prisma path)
|
|
315
|
-
`openreceive scaffold` emits files for the ORM you name but never installs
|
|
344
|
+
On a fresh project, also install what this guide assumes you already have: the
|
|
345
|
+
framework and an env loader (`npm install express dotenv`). Install your ORM
|
|
346
|
+
before step 2 too (`npm install prisma @prisma/client` on the Prisma path).
|
|
347
|
+
`openreceive scaffold` emits files for the ORM you name, but it never installs
|
|
348
|
+
that ORM.
|
|
316
349
|
|
|
317
|
-
|
|
318
|
-
Prisma's engine download and esbuild's binary postinstall
|
|
319
|
-
build
|
|
350
|
+
Some editor sandboxes run npm with `ignore-scripts`. That setting skips
|
|
351
|
+
Prisma's engine download and esbuild's binary postinstall. If a typecheck or
|
|
352
|
+
build fails only in such an environment, the environment is the cause, not
|
|
353
|
+
your code.
|
|
320
354
|
|
|
321
355
|
### 2. Migrate the payment tables
|
|
322
356
|
|
|
@@ -324,19 +358,21 @@ build that fails only there is environmental, not a code problem.
|
|
|
324
358
|
npx openreceive scaffold payments --orm prisma # or drizzle | typeorm | sequelize | knex
|
|
325
359
|
```
|
|
326
360
|
|
|
327
|
-
`openreceive scaffold payments`
|
|
328
|
-
|
|
361
|
+
`openreceive scaffold payments` writes one schema or migration file for your
|
|
362
|
+
ORM, plus a wiring guide. It never touches a database.
|
|
329
363
|
→ [openreceive scaffold payments](https://openreceive.org/guides/api-reference.md#openreceive-scaffold-payments)
|
|
330
364
|
|
|
331
|
-
Then run the
|
|
332
|
-
`npx prisma migrate dev`). OpenReceive
|
|
333
|
-
is nothing else to generate. Details:
|
|
365
|
+
Then run the generated migration the way you normally do (for example
|
|
366
|
+
`npx prisma migrate dev`). OpenReceive runs the tables' logic at runtime, so
|
|
367
|
+
there is nothing else to generate. Details:
|
|
334
368
|
[Payment storage](https://openreceive.org/guides/storage.md), [Node ORM recipes](https://openreceive.org/guides/node-orms.md).
|
|
335
369
|
|
|
336
|
-
No ORM?
|
|
337
|
-
|
|
338
|
-
same DDL once yourself
|
|
339
|
-
`@openreceive/http
|
|
370
|
+
No ORM? You can pass a bare driver handle (`pg`, `node:sqlite`,
|
|
371
|
+
`better-sqlite3`) as the `db` in step 4. The scaffold has no flavor for it.
|
|
372
|
+
Instead of scaffolding, run the same DDL once yourself, using
|
|
373
|
+
`paymentsSchemaSql(dialect)` from `@openreceive/http`. Your adapter already
|
|
374
|
+
pulls that package in, but this import is yours, so install it too:
|
|
375
|
+
`npm install @openreceive/http`.
|
|
340
376
|
|
|
341
377
|
### 3. Add wallet credentials
|
|
342
378
|
|
|
@@ -349,25 +385,27 @@ LSC_URI_BACKUP=
|
|
|
349
385
|
```
|
|
350
386
|
|
|
351
387
|
1. Get a receive-only NWC code from a compatible wallet
|
|
352
|
-
([get one here](https://openreceive.org/get_a_nwc_code_to_receive_payments))
|
|
353
|
-
|
|
354
|
-
2.
|
|
355
|
-
|
|
388
|
+
([get one here](https://openreceive.org/get_a_nwc_code_to_receive_payments)).
|
|
389
|
+
Put it in `NWC_URI`.
|
|
390
|
+
2. Optional: set up a [swap provider](https://openreceive.org/set_up_swap_provider).
|
|
391
|
+
Put its connection string in `LSC_URI_PRIMARY`, and a second one in
|
|
392
|
+
`LSC_URI_BACKUP` if you have one.
|
|
356
393
|
|
|
357
|
-
Never put these values in browser code. Your
|
|
358
|
-
|
|
359
|
-
receive-only code ([Security](https://openreceive.org/guides/security.md)).
|
|
394
|
+
Never put these values in browser code. Your app refuses to start if the NWC
|
|
395
|
+
code also advertises spend methods such as `pay_invoice`. Create a
|
|
396
|
+
receive-only code instead ([Security](https://openreceive.org/guides/security.md)).
|
|
360
397
|
|
|
361
|
-
OpenReceive reads `process.env
|
|
362
|
-
own.
|
|
363
|
-
|
|
364
|
-
|
|
398
|
+
OpenReceive reads `process.env`, so creating a `.env` file is not enough on
|
|
399
|
+
its own. [Environment variables](https://openreceive.org/guides/environment-variables.md) explains how that
|
|
400
|
+
file or your production secrets get into the process: `dotenv` on
|
|
401
|
+
Express/Fastify, auto-load on Next.js, and secret managers in production.
|
|
365
402
|
|
|
366
403
|
### 4. Wire OpenReceive
|
|
367
404
|
|
|
368
|
-
One factory
|
|
369
|
-
wallet client and the host
|
|
370
|
-
|
|
405
|
+
One factory call takes your hooks and a database handle. The adapter builds
|
|
406
|
+
the wallet client and the host. There is no background reconciler, meaning no job that checks pending
|
|
407
|
+
payments on a timer. Settlement runs during normal requests instead, through
|
|
408
|
+
the durable reconcile gate.
|
|
371
409
|
|
|
372
410
|
```ts
|
|
373
411
|
import "dotenv/config"; // loads .env into process.env; nothing else does
|
|
@@ -444,25 +482,34 @@ An optional worker, `startNotificationWorker({ service, host })`, listens for
|
|
|
444
482
|
wallet payment notifications so settlement does not wait for the next page
|
|
445
483
|
load. → [startNotificationWorker](https://openreceive.org/guides/api-reference.md#startnotificationworker)
|
|
446
484
|
|
|
447
|
-
|
|
448
|
-
|
|
485
|
+
You can also compose the pieces yourself (`createOpenReceive` + `createHost`)
|
|
486
|
+
when you need a shared wallet client or a custom repository.
|
|
449
487
|
→ [createOpenReceive](https://openreceive.org/guides/api-reference.md#createopenreceive) ·
|
|
450
488
|
[createHost](https://openreceive.org/guides/api-reference.md#createhost)
|
|
451
489
|
|
|
452
|
-
Your app also needs an ordinary
|
|
453
|
-
|
|
454
|
-
the `reference`. OpenReceive never
|
|
490
|
+
Your app also needs an ordinary route that creates the order. It validates the
|
|
491
|
+
cart, computes the price with exact decimal math, and returns the order id.
|
|
492
|
+
The page passes that id as the `reference`. OpenReceive never takes a price
|
|
493
|
+
from payer input.
|
|
455
494
|
|
|
456
|
-
The `reference` is a string you choose, and it
|
|
457
|
-
your order id
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
495
|
+
The `reference` is a string you choose, and it identifies what gets fulfilled.
|
|
496
|
+
Use your order id. Make it:
|
|
497
|
+
|
|
498
|
+
- one per thing you fulfill,
|
|
499
|
+
- created before checkout,
|
|
500
|
+
- kept across retries,
|
|
501
|
+
- never reused.
|
|
502
|
+
|
|
503
|
+
OpenReceive never looks inside the `reference`, but it relies on it:
|
|
504
|
+
|
|
505
|
+
- `onPaid` commits fulfillment once per reference.
|
|
506
|
+
- A new checkout under a reference that already settled is refused with 409.
|
|
507
|
+
- A fresh id on every page load would let one order be paid twice.
|
|
462
508
|
|
|
463
509
|
Naming boundary: TypeScript APIs use camelCase fields (`paymentHash`,
|
|
464
|
-
`amountMsats`)
|
|
465
|
-
|
|
510
|
+
`amountMsats`). Everything on the wire is snake_case (`payment_hash`,
|
|
511
|
+
`amount_msats`). The wire means the mounted HTTP routes and the browser
|
|
512
|
+
snapshots.
|
|
466
513
|
|
|
467
514
|
### 5. Render checkout
|
|
468
515
|
|
|
@@ -473,45 +520,51 @@ import "@openreceive/react/styles.css";
|
|
|
473
520
|
<Checkout reference={order.id} prefix="/openreceive" />;
|
|
474
521
|
```
|
|
475
522
|
|
|
476
|
-
The checkout renders, polls, and settles itself.
|
|
477
|
-
|
|
478
|
-
|
|
523
|
+
The checkout renders, polls, and settles itself.
|
|
524
|
+
|
|
525
|
+
`@openreceive/react` and `@openreceive/elements` each ship a compiled
|
|
526
|
+
`styles.css`. Each sheet is self-contained, so a plain
|
|
527
|
+
`<link rel="stylesheet">` works with no build step. Each is also scoped: every
|
|
479
528
|
rule applies only inside what OpenReceive renders.
|
|
480
529
|
|
|
481
|
-
Serve the compiled `styles.css` without Tailwind processing
|
|
482
|
-
JavaScript
|
|
483
|
-
Do not `@import` it into
|
|
484
|
-
|
|
530
|
+
Serve the compiled `styles.css` without Tailwind processing. Import it from
|
|
531
|
+
JavaScript if your bundler handles CSS, or use a plain
|
|
532
|
+
`<link rel="stylesheet">`. Do not `@import` it into your app's Tailwind entry.
|
|
533
|
+
Its rules have zero specificity, so your page's styles can override checkout
|
|
534
|
+
styles. Scoping does not prevent that.
|
|
485
535
|
|
|
486
|
-
`<Checkout>` is complete as rendered
|
|
536
|
+
`<Checkout>` is complete as rendered. It already shows the `description` from
|
|
487
537
|
`amountFor` and the collapsed transaction-details panel. Do not build a custom
|
|
488
|
-
UI to
|
|
489
|
-
drop-in ([Checkout UX](https://openreceive.org/guides/checkout-ux.md)).
|
|
538
|
+
UI to show them. The display rules for them become your job only if you
|
|
539
|
+
replace the drop-in component ([Checkout UX](https://openreceive.org/guides/checkout-ux.md)).
|
|
490
540
|
|
|
491
|
-
Match the host page's theme
|
|
492
|
-
stored choice, then the system scheme. If this page
|
|
493
|
-
it
|
|
494
|
-
|
|
495
|
-
variables under `data-theme
|
|
496
|
-
the
|
|
541
|
+
Match the host page's theme. By default the checkout follows the payer's
|
|
542
|
+
stored choice, then the system color scheme. If this page always uses one
|
|
543
|
+
theme, lock it with `<Checkout theme="dark" … />`. On the custom element, set
|
|
544
|
+
the `theme` attribute. Locking the theme keeps a white card off a dark page.
|
|
545
|
+
CSS variables under `data-theme` style the checkout.
|
|
546
|
+
[Frontend checkout](https://openreceive.org/guides/frontend-checkout.md) lists the settings you can change.
|
|
497
547
|
|
|
498
548
|
Everything the checkout draws ships inside the JavaScript: the payment-method
|
|
499
|
-
icons, the wallet logos and the pay tutorials. There is no image file to copy
|
|
500
|
-
or serve and no asset option to set. Deploy your normal JavaScript and CSS
|
|
549
|
+
icons, the wallet logos, and the pay tutorials. There is no image file to copy
|
|
550
|
+
or serve, and no asset option to set. Deploy your normal JavaScript and CSS
|
|
501
551
|
build output, including any generated JavaScript chunks. Bundlers with code
|
|
502
|
-
splitting can
|
|
503
|
-
|
|
504
|
-
Content-Security-Policy has a strict `img-src`, allow `data:`
|
|
552
|
+
splitting can wait to load tutorial screenshots until a tutorial first opens.
|
|
553
|
+
Single-file builds, including the standalone checkout, include them from the
|
|
554
|
+
start. If your Content-Security-Policy has a strict `img-src`, allow `data:`
|
|
505
555
|
([Provider registry](https://openreceive.org/guides/provider-registry.md#assets)).
|
|
506
556
|
|
|
507
|
-
That is the whole loop
|
|
508
|
-
an invoice
|
|
557
|
+
That is the whole loop. Your server owns the price and the order. The payer
|
|
558
|
+
gets an invoice. `onPaid` runs inside the settlement transaction. If that
|
|
559
|
+
transaction rolls back, the callback may run again. For delivery to outside
|
|
560
|
+
systems, use an outbox in your app: record the message in the transaction and
|
|
561
|
+
send it after commit.
|
|
509
562
|
|
|
510
|
-
|
|
511
|
-
is Buy a Button
|
|
563
|
+
Buy a Button is a runnable illustration of this boundary
|
|
512
564
|
(`examples/buttons/server/node-express`).
|
|
513
|
-
It
|
|
514
|
-
|
|
565
|
+
It is not a template to copy models from. It has products, visitors, and
|
|
566
|
+
orders, and the three hooks are the only bridge to OpenReceive. Map that shape
|
|
567
|
+
onto the models in THIS app.
|
|
515
568
|
|
|
516
569
|
### 6. Verify
|
|
517
570
|
|
|
@@ -519,16 +572,17 @@ Map that shape onto the models in THIS app.
|
|
|
519
572
|
npx openreceive doctor
|
|
520
573
|
```
|
|
521
574
|
|
|
522
|
-
`openreceive doctor` checks Node, `NWC_URI`, and swap-provider
|
|
523
|
-
|
|
524
|
-
`--db <file-or-url>` to confirm the migration ran
|
|
525
|
-
`--url http://localhost:3000` to confirm the routes are mounted
|
|
575
|
+
`openreceive doctor` checks Node, `NWC_URI`, and the swap-provider
|
|
576
|
+
configuration. It also probes the wallet relay to confirm the code is
|
|
577
|
+
receive-only. Add `--db <file-or-url>` to confirm the migration ran. Add
|
|
578
|
+
`--url http://localhost:3000` to confirm the routes are mounted. Every failing
|
|
526
579
|
line states its own fix.
|
|
527
580
|
→ [openreceive doctor](https://openreceive.org/guides/api-reference.md#openreceive-doctor)
|
|
528
581
|
|
|
529
|
-
Then open the checkout in a browser
|
|
530
|
-
wallet logos render
|
|
531
|
-
If an image is missing,
|
|
532
|
-
panel for failed JavaScript chunks.
|
|
533
|
-
complete build output. Do not add image routes
|
|
534
|
-
use registry `icon_path`
|
|
582
|
+
Then open the checkout in a browser. Confirm the payment-method icons and
|
|
583
|
+
wallet logos render. Open a wallet's pay tutorial to check its screenshots.
|
|
584
|
+
If an image is missing, look in the console for CSP violations and in the
|
|
585
|
+
Network panel for failed JavaScript chunks. To fix it, allow `data:` in
|
|
586
|
+
`img-src` and deploy the complete build output. Do not add image routes or
|
|
587
|
+
copy package source images. Do not use registry `icon_path` or tutorial
|
|
588
|
+
`path` keys as browser URLs.
|