openreceive 0.4.21 → 0.4.22

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.
@@ -3,7 +3,7 @@ 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 42 KB and a summary drops required steps. Download it whole:
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/laravel/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/laravel/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.21.
20
+ These directions describe OpenReceive 0.4.22.
21
21
 
22
22
  Add OpenReceive to a Laravel application — the app you are already working in.
23
23
  You do not need a copy of the OpenReceive source: the package is on Packagist
@@ -59,11 +59,12 @@ owns orders, users, prices, or fulfillment.
59
59
 
60
60
  ## Step 0 — ask for the two codes, one question at a time
61
61
 
62
- Before anything else, look at one file: the project's `.env`, if it exists.
63
- Read it only far enough to see whether `NWC_URI` and `LSC_URI_PRIMARY` are
64
- there and non-empty, and never print the values. A code that is already
65
- set is not asked for again; if both are set, skip to step 5
66
- (making the server load the file), then the quickstart.
62
+ Before anything else, check one file: the project's `.env`, if it exists.
63
+ `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
64
+ it sets without printing them. Check with that, here and after each write,
65
+ 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
68
 
68
69
  Otherwise your next action is a question to the user. Do not install the package,
69
70
  edit the app, write `.env.example`, or search anywhere else before asking
@@ -94,14 +95,17 @@ you store it. Ask one question per message.
94
95
  Do not mention `.env`, exports, or "tell me when it's set".
95
96
  2. **When they paste it.** If it does not start with `nostr+walletconnect://`,
96
97
  ask them to copy the receive-only code again. Otherwise write
97
- `NWC_URI=<paste>` into the project's `.env`, creating the file if needed.
98
- Make sure `.gitignore` covers `.env` (and `.dockerignore`, if the app has
99
- one). Never echo the value, commit it, or put it in client code. Reply only
100
- that it is saved, then ask the next question.
101
- 3. **Second message — swaps.** If the user already asked for stablecoins or
102
- altcoins, skip the yes/no and go straight to the walkthrough. Otherwise ask
103
- whether payers should also be able to pay with USDT, USDC, ETH or SOL. The
104
- walkthrough:
98
+ `NWC_URI=<paste>` into the project's `.env` with your file-editing tool,
99
+ creating the file if needed. Never write it with a shell command (`echo`,
100
+ `printf`, a heredoc, `python -c`): the command line shows the code. Make
101
+ sure `.gitignore` covers `.env` (and `.dockerignore`, if the app has one).
102
+ Never echo the value, commit it, or put it in client code. Reply only that
103
+ it is saved, then ask the next question.
104
+ 3. **Second message — swaps.** If the user asked for stablecoins, USDT, USDC,
105
+ ETH, SOL, altcoins or "crypto" (as in "Bitcoin and stablecoin payments"),
106
+ this message IS the walkthrough below: send it as it is, and do not ask yes
107
+ or no first. Otherwise ask whether payers should also be able to pay with
108
+ USDT, USDC, ETH or SOL, then give the walkthrough. The walkthrough:
105
109
 
106
110
  > Go to https://lightning-swap.com, sign in for API keys, create a key, and
107
111
  > copy the whole URI (https://openreceive.org/set_up_swap_provider). Paste
@@ -111,16 +115,21 @@ you store it. Ask one question per message.
111
115
  Mention FixedFloat only if they already use it.
112
116
  4. **When they paste it.** If it does not start with
113
117
  `lightning+swapconnect://`, ask them to copy it again. Otherwise add
114
- `LSC_URI_PRIMARY=<paste>` to the same `.env`, without echoing it. Swaps
115
- are now on, so build the refund route back (the swap non-negotiable below) as
116
- part of this integration. If they chose Bitcoin only, leave
117
- `LSC_URI_PRIMARY` unset and skip that route.
118
+ `LSC_URI_PRIMARY=<paste>` to the same `.env` with the file-editing tool,
119
+ never a shell command. Swaps are now on, so build the refund route back
120
+ (the swap non-negotiable below) as part of this integration. If they chose
121
+ Bitcoin only, leave `LSC_URI_PRIMARY` unset and skip that route.
118
122
  5. **Make the server load the file — yourself.** Laravel loads
119
123
  `.env` itself. If the app runs `php artisan config:cache`, run
120
124
  `php artisan config:clear` (or re-cache) after writing the file: a cached
121
125
  config never reads `.env` again. When the app is started with Docker
122
- Compose, give the service `env_file: .env`. Restart the server after
123
- writing the file.
126
+ Compose, give the service `env_file: .env`. A Compose variable reaches
127
+ artisan commands, but not the web server: `php artisan serve` hands
128
+ requests only what `.env` holds, and php-fpm clears the environment by
129
+ default. So make the running app read the codes too: keep them in the
130
+ `.env` the server reads (an image that copies `.env.example` over it
131
+ drops them), start `php artisan serve` with `--no-reload`, or set
132
+ `clear_env = no` for php-fpm. Restart the server after writing the file.
124
133
 
125
134
  Do not invent placeholder URIs. Start the quickstart only once `NWC_URI` is
126
135
  saved and `LSC_URI_PRIMARY` is saved or explicitly declined. The first boot
@@ -151,22 +160,28 @@ check; fix it before going on.
151
160
 
152
161
  Give the user that checkout link. The browser check in the quickstart's
153
162
  "Render the checkout" section (payment-method icons, wallet logos, a pay
154
- tutorial) is theirs: tell them what to look at, and do not run it yourself.
163
+ tutorial) is theirs: name it in one line of your closing message, and do not
164
+ run it yourself.
155
165
 
156
166
  You cannot pay the invoice: the code is receive-only. Do not pay, settle or
157
167
  mark an order paid, and do not look for a way to (a wallet control port, a
158
168
  test endpoint, another wallet). If the user wants a real settlement test, they
159
169
  pay on that link from their own wallet, and `onPaid` marks the order paid.
160
170
 
161
- Setup ends here. Say "Setup is finished" in one message of at most five
162
- lines, with the link and what to check. Do not list what changed, offer more
163
- work, or end the message on a question.
171
+ Setup ends here. Your last message starts "Setup is finished" and has at most
172
+ five short lines (about 80 characters each): the link, the methods it offers,
173
+ and one line of what to look at. Send nothing after it. Do not list what
174
+ changed, copy out the quickstart's browser checklist, offer more work, or end
175
+ the message on a question.
164
176
 
165
177
  - The link is to a real unpaid order. Keep that order; do not delete it.
178
+ - When this app's orders belong to a session or cookie, the user's browser
179
+ cannot open the order you made. Then the link is the shop's own page:
180
+ "Open <shop url> and click Buy: it opens the checkout." Do not explain order
181
+ ownership or mention your test order.
166
182
  - Name the methods it offers: Bitcoin, plus USDT, USDC, ETH and SOL when
167
- `LSC_URI_PRIMARY` is saved. Never say a coin will not work or will not be
168
- offered. Swap minimums apply per order, and a coin whose minimum is above an
169
- order's total says so on its own tile.
183
+ `LSC_URI_PRIMARY` is saved. Do not mention minimums, and never say a coin
184
+ will not work or will not be offered.
170
185
 
171
186
  ## Non-negotiables
172
187
 
@@ -183,6 +198,22 @@ itself, and they hold for every integration.
183
198
  - Work only in this application. Never read or run anything from another
184
199
  project on this machine (its `node_modules`, tools or source), for any
185
200
  reason. A browser and Playwright are not part of setup.
201
+ - Restart only this app's server, on the port it already uses: stop the
202
+ process you started, or the one listening on that port, by its pid (or
203
+ restart its Compose service). Never `pkill` or `killall` by name: that
204
+ stops other people's servers too. Start it the way this project already
205
+ does (its README, Procfile, compose file or package script), on its own
206
+ port, not a port you pick.
207
+ - Run commands where the app runs. When a compose file builds it, run its
208
+ package manager, generators, migrations and doctor inside that service
209
+ (`docker compose exec` or `run`), and rebuild the image after adding a
210
+ package. This machine's language version and database path are not the
211
+ app's.
212
+ - To check that the running app sees the codes, run doctor: it reports each
213
+ one as present or missing and never prints a value. Never print the
214
+ environment (`printenv`, `env`, `docker compose config`), even filtered to
215
+ names. Doctor runs as an artisan command, so also open the checkout page:
216
+ the web server can miss a code that doctor sees (step 5).
186
217
  - The host owns the price. `amountFor` reads it from your own data; reject
187
218
  payer-supplied amounts.
188
219
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
@@ -392,10 +423,12 @@ PHP extensions:
392
423
  Add the Laravel package:
393
424
 
394
425
  ```sh
395
- composer require openreceive/laravel
426
+ composer require openreceive/laravel -W
396
427
  ```
397
428
 
398
- That is the whole install. `openreceive/laravel` depends on
429
+ `-W` lets Composer move Guzzle to 7.x: the wallet client's WebSocket
430
+ middleware needs Guzzle 7, and a Laravel 13 app can lock Guzzle 8. That is
431
+ the whole install. `openreceive/laravel` depends on
399
432
  `openreceive/openreceive`, the engine. So the default wallet client works with
400
433
  nothing else added. It is built from `NWC_URI`. Package discovery registers the
401
434
  service provider. If your app brings its own NWC client, bind
@@ -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 39 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 41 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.21.
20
+ These directions describe OpenReceive 0.4.22.
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
@@ -58,11 +58,12 @@ owns orders, users, prices, or fulfillment.
58
58
 
59
59
  ## Step 0 — ask for the two codes, one question at a time
60
60
 
61
- Before anything else, look at one file: the project's `.env.local`, if it exists.
62
- Read it only far enough to see whether `NWC_URI` and `LSC_URI_PRIMARY` are
63
- there and non-empty, 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
65
- (making the server load the file), then the quickstart.
61
+ Before anything else, check one file: the project's `.env.local`, if it exists.
62
+ `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env.local | cut -d= -f1` names the codes
63
+ it sets without printing them. Check with that, here and after each write,
64
+ 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, skip to step 5 (making the
66
+ server load the file), then the quickstart.
66
67
 
67
68
  On a hosted builder (v0, Vercel, Replit, Lovable), the user may say instead
68
69
  that both codes are already set as the project's environment variables or
@@ -98,14 +99,17 @@ you store it. Ask one question per message.
98
99
  Do not mention `.env`, exports, or "tell me when it's set".
99
100
  2. **When they paste it.** If it does not start with `nostr+walletconnect://`,
100
101
  ask them to copy the receive-only code again. Otherwise write
101
- `NWC_URI=<paste>` into the project's `.env.local`, creating the file if needed.
102
- Make sure `.gitignore` covers `.env.local` (and `.dockerignore`, if the app has
103
- one). Never echo the value, commit it, or put it in client code. Reply only
104
- that it is saved, then ask the next question.
105
- 3. **Second message — swaps.** If the user already asked for stablecoins or
106
- altcoins, skip the yes/no and go straight to the walkthrough. Otherwise ask
107
- whether payers should also be able to pay with USDT, USDC, ETH or SOL. The
108
- walkthrough:
102
+ `NWC_URI=<paste>` into the project's `.env.local` with your file-editing
103
+ tool, creating the file if needed. Never write it with a shell command
104
+ (`echo`, `printf`, a heredoc, `python -c`): the command line shows the
105
+ code. Make sure `.gitignore` covers `.env.local` (and `.dockerignore`, if
106
+ the app has one). Never echo the value, commit it, or put it in client
107
+ code. Reply only that it is saved, then ask the next question.
108
+ 3. **Second message — swaps.** If the user asked for stablecoins, USDT, USDC,
109
+ ETH, SOL, altcoins or "crypto" (as in "Bitcoin and stablecoin payments"),
110
+ this message IS the walkthrough below: send it as it is, and do not ask yes
111
+ or no first. Otherwise ask whether payers should also be able to pay with
112
+ USDT, USDC, ETH or SOL, then give the walkthrough. The walkthrough:
109
113
 
110
114
  > Go to https://lightning-swap.com, sign in for API keys, create a key, and
111
115
  > copy the whole URI (https://openreceive.org/set_up_swap_provider). Paste
@@ -115,10 +119,10 @@ you store it. Ask one question per message.
115
119
  Mention FixedFloat only if they already use it.
116
120
  4. **When they paste it.** If it does not start with
117
121
  `lightning+swapconnect://`, ask them to copy it again. Otherwise add
118
- `LSC_URI_PRIMARY=<paste>` to the same `.env.local`, without echoing it. Swaps
119
- are now on, so build the refund route back (the swap non-negotiable below) as
120
- part of this integration. If they chose Bitcoin only, leave
121
- `LSC_URI_PRIMARY` unset and skip that route.
122
+ `LSC_URI_PRIMARY=<paste>` to the same `.env.local` with the file-editing
123
+ tool, never a shell command. Swaps are now on, so build the refund route
124
+ back (the swap non-negotiable below) as part of this integration. If they
125
+ chose Bitcoin only, leave `LSC_URI_PRIMARY` unset and skip that route.
122
126
  5. **Make the server load the file — yourself.** Next loads
123
127
  `.env.local` into `process.env` on its own: do not add `dotenv`, and never
124
128
  give a credential a `NEXT_PUBLIC_` prefix, which inlines it into the browser
@@ -153,23 +157,28 @@ Doctor reads `.env.local` itself. Never source it into a shell: the `&` in a
153
157
  code splits the value and prints the pieces.
154
158
 
155
159
  Give the user that checkout link. The browser check in the quickstart's step 6
156
- (payment-method icons, wallet logos, a pay tutorial) is theirs: tell them what
157
- to look at, and do not run it yourself.
160
+ (payment-method icons, wallet logos, a pay tutorial) is theirs: name it in one
161
+ line of your closing message, and do not run it yourself.
158
162
 
159
163
  You cannot pay the invoice: the code is receive-only. Do not pay, settle or
160
164
  mark an order paid, and do not look for a way to (a wallet control port, a
161
165
  test endpoint, another wallet). If the user wants a real settlement test, they
162
166
  pay on that link from their own wallet, and `onPaid` marks the order paid.
163
167
 
164
- Setup ends here. Say "Setup is finished" in one message of at most five
165
- lines, with the link and what to check. Do not list what changed, offer more
166
- work, or end the message on a question.
168
+ Setup ends here. Your last message starts "Setup is finished" and has at most
169
+ five short lines (about 80 characters each): the link, the methods it offers,
170
+ and one line of what to look at. Send nothing after it. Do not list what
171
+ changed, copy out the quickstart's browser checklist, offer more work, or end
172
+ the message on a question.
167
173
 
168
174
  - The link is to a real unpaid order. Keep that order; do not delete it.
175
+ - When this app's orders belong to a session or cookie, the user's browser
176
+ cannot open the order you made. Then the link is the shop's own page:
177
+ "Open <shop url> and click Buy: it opens the checkout." Do not explain order
178
+ ownership or mention your test order.
169
179
  - Name the methods it offers: Bitcoin, plus USDT, USDC, ETH and SOL when
170
- `LSC_URI_PRIMARY` is saved. Never say a coin will not work or will not be
171
- offered. Swap minimums apply per order, and a coin whose minimum is above an
172
- order's total says so on its own tile.
180
+ `LSC_URI_PRIMARY` is saved. Do not mention minimums, and never say a coin
181
+ will not work or will not be offered.
173
182
 
174
183
  ## Non-negotiables
175
184
 
@@ -186,6 +195,21 @@ itself, and they hold for every integration.
186
195
  - Work only in this application. Never read or run anything from another
187
196
  project on this machine (its `node_modules`, tools or source), for any
188
197
  reason. A browser and Playwright are not part of setup.
198
+ - Restart only this app's server, on the port it already uses: stop the
199
+ process you started, or the one listening on that port, by its pid (or
200
+ restart its Compose service). Never `pkill` or `killall` by name: that
201
+ stops other people's servers too. Start it the way this project already
202
+ does (its README, Procfile, compose file or package script), on its own
203
+ port, not a port you pick.
204
+ - Run commands where the app runs. When a compose file builds it, run its
205
+ package manager, generators, migrations and doctor inside that service
206
+ (`docker compose exec` or `run`), and rebuild the image after adding a
207
+ package. This machine's language version and database path are not the
208
+ app's.
209
+ - To check that the running app sees the codes, run doctor: it reports each
210
+ one as present or missing and never prints a value. Never print the
211
+ environment (`printenv`, `env`, `docker compose config`), even filtered to
212
+ names.
189
213
  - The host owns the price. `amountFor` reads it from your own data; reject
190
214
  payer-supplied amounts.
191
215
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
@@ -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 35 KB and a summary drops required steps. Download it whole:
6
+ # READ THIS FIRST: this file is 37 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.21.
20
+ These directions describe OpenReceive 0.4.22.
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
@@ -55,11 +55,12 @@ owns orders, users, prices, or fulfillment.
55
55
 
56
56
  ## Step 0 — ask for the two codes, one question at a time
57
57
 
58
- Before anything else, look at one file: the project's `.env`, if it exists.
59
- Read it only far enough to see whether `NWC_URI` and `LSC_URI_PRIMARY` are
60
- there and non-empty, and never print the values. A code that is already
61
- set is not asked for again; if both are set, skip to step 5
62
- (making the server load the file), then the quickstart.
58
+ Before anything else, check one file: the project's `.env`, if it exists.
59
+ `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
60
+ it sets without printing them. Check with that, here and after each write,
61
+ not by reading the file, and never print the values. A code that is already
62
+ set is not asked for again; if both are set, skip to step 5 (making the
63
+ server load the file), then the quickstart.
63
64
 
64
65
  On a hosted builder (v0, Vercel, Replit, Lovable), the user may say instead
65
66
  that both codes are already set as the project's environment variables or
@@ -95,14 +96,17 @@ you store it. Ask one question per message.
95
96
  Do not mention `.env`, exports, or "tell me when it's set".
96
97
  2. **When they paste it.** If it does not start with `nostr+walletconnect://`,
97
98
  ask them to copy the receive-only code again. Otherwise write
98
- `NWC_URI=<paste>` into the project's `.env`, creating the file if needed.
99
- Make sure `.gitignore` covers `.env` (and `.dockerignore`, if the app has
100
- one). Never echo the value, commit it, or put it in client code. Reply only
101
- that it is saved, then ask the next question.
102
- 3. **Second message — swaps.** If the user already asked for stablecoins or
103
- altcoins, skip the yes/no and go straight to the walkthrough. Otherwise ask
104
- whether payers should also be able to pay with USDT, USDC, ETH or SOL. The
105
- walkthrough:
99
+ `NWC_URI=<paste>` into the project's `.env` with your file-editing tool,
100
+ creating the file if needed. Never write it with a shell command (`echo`,
101
+ `printf`, a heredoc, `python -c`): the command line shows the code. Make
102
+ sure `.gitignore` covers `.env` (and `.dockerignore`, if the app has one).
103
+ Never echo the value, commit it, or put it in client code. Reply only that
104
+ it is saved, then ask the next question.
105
+ 3. **Second message — swaps.** If the user asked for stablecoins, USDT, USDC,
106
+ ETH, SOL, altcoins or "crypto" (as in "Bitcoin and stablecoin payments"),
107
+ this message IS the walkthrough below: send it as it is, and do not ask yes
108
+ or no first. Otherwise ask whether payers should also be able to pay with
109
+ USDT, USDC, ETH or SOL, then give the walkthrough. The walkthrough:
106
110
 
107
111
  > Go to https://lightning-swap.com, sign in for API keys, create a key, and
108
112
  > copy the whole URI (https://openreceive.org/set_up_swap_provider). Paste
@@ -112,10 +116,10 @@ you store it. Ask one question per message.
112
116
  Mention FixedFloat only if they already use it.
113
117
  4. **When they paste it.** If it does not start with
114
118
  `lightning+swapconnect://`, ask them to copy it again. Otherwise add
115
- `LSC_URI_PRIMARY=<paste>` to the same `.env`, without echoing it. Swaps
116
- are now on, so build the refund route back (the swap non-negotiable below) as
117
- part of this integration. If they chose Bitcoin only, leave
118
- `LSC_URI_PRIMARY` unset and skip that route.
119
+ `LSC_URI_PRIMARY=<paste>` to the same `.env` with the file-editing tool,
120
+ never a shell command. Swaps are now on, so build the refund route back
121
+ (the swap non-negotiable below) as part of this integration. If they chose
122
+ Bitcoin only, leave `LSC_URI_PRIMARY` unset and skip that route.
119
123
  5. **Make the server load the file — yourself.** OpenReceive reads
120
124
  `process.env`, and a `.env` file on disk is not in it. Put
121
125
  `import "dotenv/config";` at the top of the server entry, as the quickstart
@@ -148,24 +152,29 @@ names any failed check and exits nonzero; fix it before going on.
148
152
  Doctor reads `.env` itself. Never source it into a shell: the `&` in a
149
153
  code splits the value and prints the pieces.
150
154
 
151
- Give the user that checkout link. The browser check in the quickstart's
152
- step 6 (payment-method icons, wallet logos, a pay tutorial) is theirs: tell
153
- them what to look at, and do not run it yourself.
155
+ Give the user that checkout link. The browser check in the quickstart's step 6
156
+ (payment-method icons, wallet logos, a pay tutorial) is theirs: name it in one
157
+ line of your closing message, and do not run it yourself.
154
158
 
155
159
  You cannot pay the invoice: the code is receive-only. Do not pay, settle or
156
160
  mark an order paid, and do not look for a way to (a wallet control port, a
157
161
  test endpoint, another wallet). If the user wants a real settlement test, they
158
162
  pay on that link from their own wallet, and `onPaid` marks the order paid.
159
163
 
160
- Setup ends here. Say "Setup is finished" in one message of at most five
161
- lines, with the link and what to check. Do not list what changed, offer more
162
- work, or end the message on a question.
164
+ Setup ends here. Your last message starts "Setup is finished" and has at most
165
+ five short lines (about 80 characters each): the link, the methods it offers,
166
+ and one line of what to look at. Send nothing after it. Do not list what
167
+ changed, copy out the quickstart's browser checklist, offer more work, or end
168
+ the message on a question.
163
169
 
164
170
  - The link is to a real unpaid order. Keep that order; do not delete it.
171
+ - When this app's orders belong to a session or cookie, the user's browser
172
+ cannot open the order you made. Then the link is the shop's own page:
173
+ "Open <shop url> and click Buy: it opens the checkout." Do not explain order
174
+ ownership or mention your test order.
165
175
  - Name the methods it offers: Bitcoin, plus USDT, USDC, ETH and SOL when
166
- `LSC_URI_PRIMARY` is saved. Never say a coin will not work or will not be
167
- offered. Swap minimums apply per order, and a coin whose minimum is above an
168
- order's total says so on its own tile.
176
+ `LSC_URI_PRIMARY` is saved. Do not mention minimums, and never say a coin
177
+ will not work or will not be offered.
169
178
 
170
179
  ## Non-negotiables
171
180
 
@@ -182,6 +191,21 @@ itself, and they hold for every integration.
182
191
  - Work only in this application. Never read or run anything from another
183
192
  project on this machine (its `node_modules`, tools or source), for any
184
193
  reason. A browser and Playwright are not part of setup.
194
+ - Restart only this app's server, on the port it already uses: stop the
195
+ process you started, or the one listening on that port, by its pid (or
196
+ restart its Compose service). Never `pkill` or `killall` by name: that
197
+ stops other people's servers too. Start it the way this project already
198
+ does (its README, Procfile, compose file or package script), on its own
199
+ port, not a port you pick.
200
+ - Run commands where the app runs. When a compose file builds it, run its
201
+ package manager, generators, migrations and doctor inside that service
202
+ (`docker compose exec` or `run`), and rebuild the image after adding a
203
+ package. This machine's language version and database path are not the
204
+ app's.
205
+ - To check that the running app sees the codes, run doctor: it reports each
206
+ one as present or missing and never prints a value. Never print the
207
+ environment (`printenv`, `env`, `docker compose config`), even filtered to
208
+ names.
185
209
  - The host owns the price. `amountFor` reads it from your own data; reject
186
210
  payer-supplied amounts.
187
211
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM
@@ -252,7 +276,10 @@ products, and you do not join them.
252
276
  are buying.
253
277
  - **Users own the order; OpenReceive never sees them.** `authorize` uses the
254
278
  same ownership check this app already uses on the order show / pay page —
255
- `sessions.currentUser(request)`, a cookie, whatever it is.
279
+ `sessions.currentUser(native)`, a cookie, whatever it is. Pass `native` (the
280
+ Express request) to this app's own cookie and session helpers, never
281
+ `request`: that one is a Web Request, a helper that reads
282
+ `req.headers.cookie` finds nothing on it, and every payer gets a 403.
256
283
  `resource.reference` is a claim the payer sent, not proof.
257
284
  - **The order is unpaid or paid.** Do not copy `pending` / `expired` / `failed`
258
285
  / `attention` onto it. Those are attempt statuses on `openreceive_payments`. An
@@ -505,9 +532,12 @@ const openreceive = openReceiveExpress({
505
532
  // Your own access check: may this caller do this action to this reference?
506
533
  // `resource.reference` is your own order id, sent back by the payer's
507
534
  // browser — a claim, not proof — already validated as a non-empty string.
508
- authorize: async ({ action, request, resource }) =>
535
+ // `native` is the untouched Express request: pass it to this app's own
536
+ // cookie and session helpers. `request` is a Web Request, so a helper that
537
+ // reads `req.headers.cookie` finds nothing on it and every payer gets a 403.
538
+ authorize: async ({ action, native, resource }) =>
509
539
  orders.viewerMay(
510
- await sessions.currentUser(request),
540
+ await sessions.currentUser(native),
511
541
  resource.reference,
512
542
  action,
513
543
  ),
@@ -3,7 +3,7 @@ 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 39 KB and a summary drops required steps. Download it whole:
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/php/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/php/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.21.
20
+ These directions describe OpenReceive 0.4.22.
21
21
 
22
22
  Add OpenReceive to a PHP application — the app you are already working in. You
23
23
  do not need a copy of the OpenReceive source: the engine is on Packagist
@@ -59,11 +59,12 @@ owns orders, users, prices, or fulfillment.
59
59
 
60
60
  ## Step 0 — ask for the two codes, one question at a time
61
61
 
62
- Before anything else, look at one file: the project's `.env`, if it exists.
63
- Read it only far enough to see whether `NWC_URI` and `LSC_URI_PRIMARY` are
64
- there and non-empty, and never print the values. A code that is already
65
- set is not asked for again; if both are set, skip to step 5
66
- (making the server load the file), then the quickstart.
62
+ Before anything else, check one file: the project's `.env`, if it exists.
63
+ `grep -E '^(NWC_URI|LSC_URI_PRIMARY)=.' .env | cut -d= -f1` names the codes
64
+ it sets without printing them. Check with that, here and after each write,
65
+ 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
68
 
68
69
  Otherwise your next action is a question to the user. Do not run `composer require`,
69
70
  edit the app, write `.env.example`, or search anywhere else before asking
@@ -94,14 +95,17 @@ you store it. Ask one question per message.
94
95
  Do not mention `.env`, exports, or "tell me when it's set".
95
96
  2. **When they paste it.** If it does not start with `nostr+walletconnect://`,
96
97
  ask them to copy the receive-only code again. Otherwise write
97
- `NWC_URI=<paste>` into the project's `.env`, creating the file if needed.
98
- Make sure `.gitignore` covers `.env` (and `.dockerignore`, if the app has
99
- one). Never echo the value, commit it, or put it in client code. Reply only
100
- that it is saved, then ask the next question.
101
- 3. **Second message — swaps.** If the user already asked for stablecoins or
102
- altcoins, skip the yes/no and go straight to the walkthrough. Otherwise ask
103
- whether payers should also be able to pay with USDT, USDC, ETH or SOL. The
104
- walkthrough:
98
+ `NWC_URI=<paste>` into the project's `.env` with your file-editing tool,
99
+ creating the file if needed. Never write it with a shell command (`echo`,
100
+ `printf`, a heredoc, `python -c`): the command line shows the code. Make
101
+ sure `.gitignore` covers `.env` (and `.dockerignore`, if the app has one).
102
+ Never echo the value, commit it, or put it in client code. Reply only that
103
+ it is saved, then ask the next question.
104
+ 3. **Second message — swaps.** If the user asked for stablecoins, USDT, USDC,
105
+ ETH, SOL, altcoins or "crypto" (as in "Bitcoin and stablecoin payments"),
106
+ this message IS the walkthrough below: send it as it is, and do not ask yes
107
+ or no first. Otherwise ask whether payers should also be able to pay with
108
+ USDT, USDC, ETH or SOL, then give the walkthrough. The walkthrough:
105
109
 
106
110
  > Go to https://lightning-swap.com, sign in for API keys, create a key, and
107
111
  > copy the whole URI (https://openreceive.org/set_up_swap_provider). Paste
@@ -111,10 +115,10 @@ you store it. Ask one question per message.
111
115
  Mention FixedFloat only if they already use it.
112
116
  4. **When they paste it.** If it does not start with
113
117
  `lightning+swapconnect://`, ask them to copy it again. Otherwise add
114
- `LSC_URI_PRIMARY=<paste>` to the same `.env`, without echoing it. Swaps
115
- are now on, so build the refund route back (the swap non-negotiable below) as
116
- part of this integration. If they chose Bitcoin only, leave
117
- `LSC_URI_PRIMARY` unset and skip that route.
118
+ `LSC_URI_PRIMARY=<paste>` to the same `.env` with the file-editing tool,
119
+ never a shell command. Swaps are now on, so build the refund route back
120
+ (the swap non-negotiable below) as part of this integration. If they chose
121
+ Bitcoin only, leave `LSC_URI_PRIMARY` unset and skip that route.
118
122
  5. **Make the server load the file — yourself.** Nothing in PHP
119
123
  reads `.env` on its own. Add `vlucas/phpdotenv` and load the file in the
120
124
  front controller before `Service::fromEnvironment()`. When the app is started
@@ -155,23 +159,28 @@ this app serves the checkout page for one of its orders. Doctor names any
155
159
  failed check; fix it before going on.
156
160
 
157
161
  Give the user that checkout link. The browser check in the quickstart's step 6
158
- (payment-method icons, wallet logos, a pay tutorial) is theirs: tell them what
159
- to look at, and do not run it yourself.
162
+ (payment-method icons, wallet logos, a pay tutorial) is theirs: name it in one
163
+ line of your closing message, and do not run it yourself.
160
164
 
161
165
  You cannot pay the invoice: the code is receive-only. Do not pay, settle or
162
166
  mark an order paid, and do not look for a way to (a wallet control port, a
163
167
  test endpoint, another wallet). If the user wants a real settlement test, they
164
168
  pay on that link from their own wallet, and `onPaid` marks the order paid.
165
169
 
166
- Setup ends here. Say "Setup is finished" in one message of at most five
167
- lines, with the link and what to check. Do not list what changed, offer more
168
- work, or end the message on a question.
170
+ Setup ends here. Your last message starts "Setup is finished" and has at most
171
+ five short lines (about 80 characters each): the link, the methods it offers,
172
+ and one line of what to look at. Send nothing after it. Do not list what
173
+ changed, copy out the quickstart's browser checklist, offer more work, or end
174
+ the message on a question.
169
175
 
170
176
  - The link is to a real unpaid order. Keep that order; do not delete it.
177
+ - When this app's orders belong to a session or cookie, the user's browser
178
+ cannot open the order you made. Then the link is the shop's own page:
179
+ "Open <shop url> and click Buy: it opens the checkout." Do not explain order
180
+ ownership or mention your test order.
171
181
  - Name the methods it offers: Bitcoin, plus USDT, USDC, ETH and SOL when
172
- `LSC_URI_PRIMARY` is saved. Never say a coin will not work or will not be
173
- offered. Swap minimums apply per order, and a coin whose minimum is above an
174
- order's total says so on its own tile.
182
+ `LSC_URI_PRIMARY` is saved. Do not mention minimums, and never say a coin
183
+ will not work or will not be offered.
175
184
 
176
185
  ## Non-negotiables
177
186
 
@@ -188,6 +197,21 @@ itself, and they hold for every integration.
188
197
  - Work only in this application. Never read or run anything from another
189
198
  project on this machine (its `node_modules`, tools or source), for any
190
199
  reason. A browser and Playwright are not part of setup.
200
+ - Restart only this app's server, on the port it already uses: stop the
201
+ process you started, or the one listening on that port, by its pid (or
202
+ restart its Compose service). Never `pkill` or `killall` by name: that
203
+ stops other people's servers too. Start it the way this project already
204
+ does (its README, Procfile, compose file or package script), on its own
205
+ port, not a port you pick.
206
+ - Run commands where the app runs. When a compose file builds it, run its
207
+ package manager, generators, migrations and doctor inside that service
208
+ (`docker compose exec` or `run`), and rebuild the image after adding a
209
+ package. This machine's language version and database path are not the
210
+ app's.
211
+ - To check that the running app sees the codes, run doctor: it reports each
212
+ one as present or missing and never prints a value. Never print the
213
+ environment (`printenv`, `env`, `docker compose config`), even filtered to
214
+ names.
191
215
  - The host owns the price. `amountFor` reads it from your own data; reject
192
216
  payer-supplied amounts.
193
217
  - `authorize` runs on every request, and the `resource` it receives is a CLAIM