openreceive 0.4.27 → 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 +6 -0
- data/lib/openreceive/version.rb +1 -1
- data/skills/integrate-openreceive/SKILL.md +18 -1
- data/skills/integrate-openreceive/references/astro.md +2 -2
- 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 +1 -1
- data/skills/integrate-openreceive/references/edd.md +407 -0
- data/skills/integrate-openreceive/references/fastapi.md +1 -1
- data/skills/integrate-openreceive/references/fastify.md +6 -5
- data/skills/integrate-openreceive/references/flask.md +1 -1
- 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 +2 -2
- data/skills/integrate-openreceive/references/medusa.md +468 -0
- data/skills/integrate-openreceive/references/mobile.md +1 -1
- data/skills/integrate-openreceive/references/nestjs.md +3 -3
- data/skills/integrate-openreceive/references/next.md +7 -6
- data/skills/integrate-openreceive/references/node.md +6 -5
- data/skills/integrate-openreceive/references/nuxt.md +2 -2
- data/skills/integrate-openreceive/references/paymenter.md +369 -0
- data/skills/integrate-openreceive/references/php.md +1 -1
- data/skills/integrate-openreceive/references/rails.md +1 -1
- data/skills/integrate-openreceive/references/react-router.md +2 -2
- data/skills/integrate-openreceive/references/sveltekit.md +2 -2
- data/skills/integrate-openreceive/references/tanstack-start.md +2 -2
- data/skills/integrate-openreceive/references/woocommerce.md +8 -6
- metadata +6 -1
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/btcpay/full.md
|
|
|
17
17
|
- Never tick the spend-capable override to make a save succeed.
|
|
18
18
|
- Do not suggest rotating or revoking a code because it was pasted here.
|
|
19
19
|
|
|
20
|
-
These directions describe OpenReceive 0.4.
|
|
20
|
+
These directions describe OpenReceive 0.4.28.
|
|
21
21
|
|
|
22
22
|
Connect a BTCPay Server store to a receive-only NWC wallet with the OpenReceive
|
|
23
23
|
plugin, and optionally let payers pay BTCPay invoices with USDT, USDC, ETH or
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/django/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 Django project — the app you are already working in. You
|
|
23
23
|
do not need a copy of the OpenReceive source: the Python package is on PyPI
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
This is the full file; follow it from Step 0.
|
|
2
|
+
|
|
3
|
+
# OpenReceive agent directions (WordPress + Easy Digital Downloads)
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
# READ THIS FIRST: this file is 21 KB and a summary drops required steps. Download it whole:
|
|
7
|
+
curl -fsSL https://openreceive.org/agent-directions/edd/full.md
|
|
8
|
+
# Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Step 0 in brief** (Step 0 below has the details):
|
|
12
|
+
|
|
13
|
+
- Before installing or editing anything, ask the user for a receive-only NWC code. One question per message.
|
|
14
|
+
- Next ask for the LSC code. If the user wants stablecoins, USDT, USDC, ETH, SOL or crypto, do not ask yes/no first.
|
|
15
|
+
- The user only pastes codes into this chat. Never ask them to run a command, edit a file or use an admin page.
|
|
16
|
+
- Store each code yourself as Step 2 says. Never put a code in a shell command.
|
|
17
|
+
- Do not suggest rotating or revoking a code because it was pasted here.
|
|
18
|
+
- Setup is done only when the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
|
|
19
|
+
|
|
20
|
+
These directions describe OpenReceive 0.4.28.
|
|
21
|
+
|
|
22
|
+
Install and configure the OpenReceive payment gateway in the Easy Digital
|
|
23
|
+
Downloads (EDD) store you are working in. Preserve its theme, checkout,
|
|
24
|
+
customer accounts, products and prices. The plugin bundles the PHP engine and
|
|
25
|
+
checkout assets: do not install npm or Composer packages on the WordPress
|
|
26
|
+
server, and do not clone the OpenReceive repository.
|
|
27
|
+
|
|
28
|
+
The one required credential is a receive-only NWC code (Nostr Wallet Connect):
|
|
29
|
+
a string from the merchant's wallet that can create invoices and read their
|
|
30
|
+
status, and cannot spend. A swap provider (an "LSC" code) optionally lets
|
|
31
|
+
customers pay with USDT, USDC, ETH or SOL instead; the provider converts the
|
|
32
|
+
payment to BTC over Lightning in the merchant's connected wallet. Available
|
|
33
|
+
assets and networks depend on the provider.
|
|
34
|
+
|
|
35
|
+
Run every `wp` command below where this store's WP-CLI runs. When WordPress
|
|
36
|
+
runs in Docker Compose, prefix it with the service that has WP-CLI, for
|
|
37
|
+
example `docker compose run --rm -T cli wp …` or
|
|
38
|
+
`docker compose exec -T wordpress wp …`. `-T` passes stdin through. If the
|
|
39
|
+
store has no WP-CLI at all (managed hosting without a shell), say so and walk
|
|
40
|
+
the user through the quickstart's admin screens instead.
|
|
41
|
+
|
|
42
|
+
## Step 0 — ask for the two codes, one question at a time
|
|
43
|
+
|
|
44
|
+
Before anything else, check one thing: whether OpenReceive is already
|
|
45
|
+
installed (`wp plugin is-active openreceive`). If it is, run
|
|
46
|
+
`wp openreceive doctor`. It prints `NWC_URI: set` or `unset` (likewise
|
|
47
|
+
`LSC_URI_PRIMARY`), never the values. A code that is already set is not asked
|
|
48
|
+
for again; if both are set, skip to `wp openreceive configure --enable` at
|
|
49
|
+
the end of Step 2.
|
|
50
|
+
|
|
51
|
+
Otherwise your next action is a question to the user. Do not install the
|
|
52
|
+
plugin, edit Docker files or search anywhere else before asking it. PHP
|
|
53
|
+
extensions, Docker images and the database wait until both codes are in this
|
|
54
|
+
chat, or the user said "Bitcoin only"; Step 1 covers them. Do not read
|
|
55
|
+
wp-config.php, deploy config, container environments or other projects
|
|
56
|
+
looking for a code: a new store has neither code yet.
|
|
57
|
+
|
|
58
|
+
The user never runs a command and never edits a file. They paste each code
|
|
59
|
+
into this chat; you store it. That is the supported path: do not ask them to
|
|
60
|
+
run the save command themselves, and do not tell them to revoke or replace a
|
|
61
|
+
code because it was pasted here. Ask one question per message.
|
|
62
|
+
|
|
63
|
+
1. **First message — the NWC code, and nothing else.**
|
|
64
|
+
|
|
65
|
+
> To receive payments I need a receive-only wallet code. In Rizful: open
|
|
66
|
+
> the menu, tap NWC, choose Receive-only NWC code, and tap Copy
|
|
67
|
+
> (https://openreceive.org/get_a_nwc_code_to_receive_payments). If you would
|
|
68
|
+
> rather run your own wallet, Alby Hub works too: Connections → Add
|
|
69
|
+
> Connection → Read Only. Paste the code here and I will store it.
|
|
70
|
+
|
|
71
|
+
2. **When they paste it.** If it does not start with `nostr+walletconnect://`,
|
|
72
|
+
ask them to copy the receive-only code again. Otherwise do not repeat it:
|
|
73
|
+
reply only that you have it, then ask the next question. You store it in
|
|
74
|
+
Step 2.
|
|
75
|
+
3. **Second message — swaps.** If the user asked for stablecoins, USDT, USDC,
|
|
76
|
+
ETH, SOL, altcoins or "crypto" (as in "Bitcoin and stablecoin payments"),
|
|
77
|
+
this message IS the walkthrough below: do not skip it, and do not ask yes
|
|
78
|
+
or no first. Otherwise ask whether customers should also be able to pay
|
|
79
|
+
with USDT, USDC, ETH or SOL, then give the walkthrough. The walkthrough:
|
|
80
|
+
|
|
81
|
+
> Go to https://lightning-swap.com, sign in for API keys, create a key, and
|
|
82
|
+
> copy the whole URI (https://openreceive.org/set_up_swap_provider). Paste
|
|
83
|
+
> it here and I will store it — or say "Bitcoin only" and I will continue
|
|
84
|
+
> without it.
|
|
85
|
+
|
|
86
|
+
Mention FixedFloat only if they already use it.
|
|
87
|
+
4. **When they paste it.** If it does not start with
|
|
88
|
+
`lightning+swapconnect://`, ask them to copy it again. Swaps are now on,
|
|
89
|
+
so keep the route back (the swap non-negotiable below).
|
|
90
|
+
|
|
91
|
+
Do not report setup as complete until the NWC code is saved, and the LSC code
|
|
92
|
+
is saved or the user said "Bitcoin only". Never invent a placeholder code.
|
|
93
|
+
|
|
94
|
+
## Step 1 — install the plugin
|
|
95
|
+
|
|
96
|
+
Install this release from the WordPress.org plugin directory:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
wp plugin install openreceive --version=0.4.28 --activate
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
If that fails because WordPress.org does not have this version yet, install
|
|
103
|
+
the ZIP attached to the same GitHub release. Never install the GitHub
|
|
104
|
+
source-code ZIP or a ZIP from an older release:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
wp plugin install https://github.com/OpenReceive/openreceive/releases/download/v0.4.28/openreceive-wordpress-0.4.28.zip --activate
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
It needs Easy Digital Downloads active, and PHP 8.2+ with GMP and sodium in
|
|
111
|
+
BOTH the web PHP and the WP-CLI PHP. On the official `wordpress` and
|
|
112
|
+
`wordpress:cli` Docker images, activation warns "OpenReceive is not running:
|
|
113
|
+
this site needs the PHP GMP extension" and the plugin stays idle: add GMP to
|
|
114
|
+
both images with the two Dockerfiles and `build:` keys in the quickstart's
|
|
115
|
+
"Enable GMP in both PHP runtimes", rebuild both, then install again. Add no
|
|
116
|
+
other service.
|
|
117
|
+
|
|
118
|
+
## Step 2 — store the codes, then turn the gateway on
|
|
119
|
+
|
|
120
|
+
Store each code yourself, one per command, and never as a shell argument:
|
|
121
|
+
|
|
122
|
+
1. Write the code with your file-editing tool, not a shell command (no
|
|
123
|
+
`echo`, `printf` or heredoc), to a new file outside the repository, such
|
|
124
|
+
as `/tmp/openreceive-code`.
|
|
125
|
+
2. Run `wp openreceive configure --nwc-uri=- < /tmp/openreceive-code`. In
|
|
126
|
+
Docker: `docker compose run --rm -T cli wp openreceive configure --nwc-uri=- < /tmp/openreceive-code`.
|
|
127
|
+
For the LSC code, use `--lsc-uri-primary=-`.
|
|
128
|
+
3. Delete the file (`rm /tmp/openreceive-code`), whether the command passed
|
|
129
|
+
or not.
|
|
130
|
+
|
|
131
|
+
The command runs the receive-only wallet preflight, encrypts the code and
|
|
132
|
+
prints only "Settings saved; wallet preflight passed."; a failure keeps the
|
|
133
|
+
previous settings. If it reports spend methods such as `pay_invoice`, ask the
|
|
134
|
+
user for a receive-only code again. Never turn on the spend-capable override.
|
|
135
|
+
Never write a code into EDD's settings, `wp option` or wp-config.php yourself.
|
|
136
|
+
|
|
137
|
+
Then run `wp openreceive configure --enable`, which adds OpenReceive to EDD's
|
|
138
|
+
active gateways, and `wp openreceive doctor`. Doctor names any failed check and
|
|
139
|
+
exits nonzero; fix it before going on. Its first line says which store it
|
|
140
|
+
found: "Store: Easy Digital Downloads active".
|
|
141
|
+
|
|
142
|
+
## Step 3 — mint a test invoice, then stop
|
|
143
|
+
|
|
144
|
+
Create a pending test order for the first published download, billed to the
|
|
145
|
+
first administrator, and mint its Lightning invoice from the terminal:
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
wp openreceive test-invoice --new
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
To use an order that already exists, pass `edd-<order id>` instead of
|
|
152
|
+
`--new`. `test-invoice` goes through the same checkout route as the purchase
|
|
153
|
+
confirmation page. It prints the amount in sats, the BOLT11 invoice, the
|
|
154
|
+
receipt page and the methods that page offers, each swap asset marked
|
|
155
|
+
available or followed by the reason it is not. That reason is the answer;
|
|
156
|
+
report it. "Below the provider minimum" or "above the provider maximum" is
|
|
157
|
+
about this order's amount, not a fault: a small test order is often under a
|
|
158
|
+
swap minimum. Only when the reason says the provider is unreachable does
|
|
159
|
+
doctor's "Swap provider" line have more detail. `test-invoice` and `doctor`
|
|
160
|
+
are the whole checkout check. If it says the store has no published download,
|
|
161
|
+
say so: the user adds products, you do not.
|
|
162
|
+
|
|
163
|
+
Give the user the receipt page, to open in a browser where they are signed in
|
|
164
|
+
to WordPress as the shop manager; it shows the checkout on this same invoice.
|
|
165
|
+
Tell them the test order is theirs to delete under Downloads → Orders.
|
|
166
|
+
|
|
167
|
+
You cannot pay the invoice: the code is receive-only. Do not pay, settle or
|
|
168
|
+
mark the order complete, and do not look for a way to (a wallet control port,
|
|
169
|
+
a test endpoint, another wallet). If the user wants a real settlement test,
|
|
170
|
+
they pay on the receipt page from their own wallet; afterwards the order reads
|
|
171
|
+
Completed.
|
|
172
|
+
|
|
173
|
+
Setup ends here. Once doctor is clean and the user has the link, your last
|
|
174
|
+
message starts "Setup is finished" and has at most six short lines: the
|
|
175
|
+
receipt page, the methods the checkout offers (Bitcoin, plus USDT, USDC, ETH
|
|
176
|
+
and SOL when the swap code is saved), and one line of what to look at. Do not
|
|
177
|
+
list each coin's availability, mention a minimum, or say a coin will not work:
|
|
178
|
+
a provider minimum depends on the order total, and the user's own orders will
|
|
179
|
+
differ. Do not list what you changed or what doctor checked. Send nothing
|
|
180
|
+
after it. Do not install mail software, add containers or services, or set up
|
|
181
|
+
cron. If doctor's "Reconcile scheduled" check fails, fix that. On a store with
|
|
182
|
+
little traffic, add one sentence to that message: a system cron for WordPress
|
|
183
|
+
scheduled work settles orders sooner, and this setup does not add one. State
|
|
184
|
+
it as a recommendation. Do not offer to set it up or end the message on a
|
|
185
|
+
question.
|
|
186
|
+
|
|
187
|
+
## Non-negotiables
|
|
188
|
+
|
|
189
|
+
- Never print, log or commit a code, never put one in a shell argument, and
|
|
190
|
+
never write one into source files, wp-config.php, the database or browser
|
|
191
|
+
code. Doctor's set/unset is all you report.
|
|
192
|
+
- Do not suggest rotating, revoking or replacing a code because it was pasted
|
|
193
|
+
into this chat; that is the supported path.
|
|
194
|
+
- Work only in this store. Never read or run anything from another project or
|
|
195
|
+
directory on this machine (its `node_modules`, tools or source), for any
|
|
196
|
+
reason. A browser, Playwright, hand-made calls to the checkout's REST routes,
|
|
197
|
+
`wp eval` and reading the plugin's source are not part of setup: when doctor
|
|
198
|
+
or `test-invoice` fails, report its output.
|
|
199
|
+
- Receive-only NWC is required. Never turn on the spend-capable override to
|
|
200
|
+
get past the preflight.
|
|
201
|
+
- The plugin owns only its payment-attempt tables in the WordPress database.
|
|
202
|
+
EDD owns orders, prices, customers, download access and email. Do not add an
|
|
203
|
+
external payment database or custom fulfillment code.
|
|
204
|
+
- IF SWAPS ARE ON, KEEP THE ROUTE BACK. A deposit that arrives short or late
|
|
205
|
+
becomes refundable, and the customer claims it later on the same order's
|
|
206
|
+
purchase confirmation page. Keep that page available, and keep the plugin
|
|
207
|
+
installed while swap orders may still need a refund.
|
|
208
|
+
https://openreceive.org/guides/swap-refunds.md
|
|
209
|
+
- A receive-only wallet cannot send merchant refunds. Refund a settled
|
|
210
|
+
payment manually from the wallet.
|
|
211
|
+
- Settlement runs on checkout requests and an every-minute scheduled job. A
|
|
212
|
+
system cron for WordPress scheduled work helps a low-traffic store, and
|
|
213
|
+
`wp openreceive notifications` is an optional long-running worker: recommend
|
|
214
|
+
them, and set one up only when the user asks for it by name. "Go ahead" is
|
|
215
|
+
not that request.
|
|
216
|
+
|
|
217
|
+
## Further reading
|
|
218
|
+
|
|
219
|
+
- [Easy Digital Downloads Quickstart](https://openreceive.org/guides/quickstart-edd.md)
|
|
220
|
+
- [Automated Swaps](https://openreceive.org/guides/automated-swaps.md)
|
|
221
|
+
- [Swap Refunds](https://openreceive.org/guides/swap-refunds.md)
|
|
222
|
+
- [Lightning Swap Connect URI](https://openreceive.org/guides/lightning-swap-connect.md)
|
|
223
|
+
- [Security](https://openreceive.org/guides/security.md)
|
|
224
|
+
- [Price Feeds](https://openreceive.org/guides/price-feeds.md)
|
|
225
|
+
- [Payment Safety Upgrade](https://openreceive.org/guides/payment-safety-upgrade.md)
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## The quickstart, in full
|
|
230
|
+
|
|
231
|
+
Inlined verbatim so this file needs no network access. Steps 0–3 above are the setup and this is their reference: where the two differ, the steps win, and its wp-admin screens are only for a store with no WP-CLI.
|
|
232
|
+
The page it comes from is https://openreceive.org/guides/quickstart-edd.
|
|
233
|
+
|
|
234
|
+
## Easy Digital Downloads quickstart
|
|
235
|
+
|
|
236
|
+
[Easy Digital Downloads](https://easydigitaldownloads.com) (EDD) sells digital
|
|
237
|
+
products from WordPress. The OpenReceive plugin, the same one WooCommerce
|
|
238
|
+
stores use, adds a payment gateway to it: the customer pays with Bitcoin over
|
|
239
|
+
Lightning, straight into your own wallet. With a swap provider, the same
|
|
240
|
+
checkout also takes USDT, USDC, SOL and ETH, which the provider converts to
|
|
241
|
+
BTC over Lightning into the same wallet.
|
|
242
|
+
|
|
243
|
+
EDD keeps owning products, prices, customers, orders and download access. The
|
|
244
|
+
customer picks the OpenReceive method at EDD's checkout. EDD records a pending
|
|
245
|
+
order, and its purchase confirmation page shows the checkout until the order
|
|
246
|
+
is paid. Once the wallet reports the payment, EDD completes the order, sends
|
|
247
|
+
its receipt and opens the downloads, as it does for any other gateway.
|
|
248
|
+
|
|
249
|
+
Requirements: WordPress 6.6+, Easy Digital Downloads 3+, 64-bit PHP 8.2+ with
|
|
250
|
+
GMP and sodium, and MySQL 8 or MariaDB 10.5+. When you activate the plugin, it
|
|
251
|
+
creates tables for payment attempts in your existing WordPress database. The
|
|
252
|
+
plugin works with EDD alone, with WooCommerce alone, or with both on one site.
|
|
253
|
+
|
|
254
|
+
### Install the plugin
|
|
255
|
+
|
|
256
|
+
In **Plugins → Add New**, search for **OpenReceive**, then install and
|
|
257
|
+
activate it. With WP-CLI, run `wp plugin install openreceive --activate`.
|
|
258
|
+
|
|
259
|
+
Each GitHub release also attaches the plugin as a ZIP, for a site that cannot
|
|
260
|
+
reach WordPress.org:
|
|
261
|
+
[openreceive-wordpress-0.4.28.zip](https://github.com/OpenReceive/openreceive/releases/download/v0.4.28/openreceive-wordpress-0.4.28.zip).
|
|
262
|
+
Install it through **Plugins → Add New → Upload Plugin**. The GitHub
|
|
263
|
+
source-code ZIP is not an installable plugin.
|
|
264
|
+
|
|
265
|
+
### Enable GMP in both PHP runtimes
|
|
266
|
+
|
|
267
|
+
GMP is required by the bundled elliptic-curve code, in the web PHP and in the
|
|
268
|
+
PHP that runs WP-CLI. If the plugin is not running, the Plugins screen says
|
|
269
|
+
which requirement is missing. On managed hosting, ask the host to enable GMP
|
|
270
|
+
and sodium; [WordPress hosting requirements](https://openreceive.org/guides/wordpress-hosting.md) lists what
|
|
271
|
+
common hosts offer. On Debian or Ubuntu, install the package for your PHP
|
|
272
|
+
version, such as `php8.2-gmp`, and restart that PHP.
|
|
273
|
+
|
|
274
|
+
Many Docker sites run the official images straight from Compose, for example
|
|
275
|
+
`image: wordpress:php8.2-apache` and `image: wordpress:cli-php8.2`, and both
|
|
276
|
+
lack GMP. Add two Dockerfiles next to `compose.yml`, keeping your tags:
|
|
277
|
+
|
|
278
|
+
```dockerfile
|
|
279
|
+
# wordpress.Dockerfile
|
|
280
|
+
FROM wordpress:php8.2-apache
|
|
281
|
+
RUN apt-get update && apt-get install -y --no-install-recommends libgmp-dev \
|
|
282
|
+
&& docker-php-ext-install gmp \
|
|
283
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
```dockerfile
|
|
287
|
+
# wp-cli.Dockerfile
|
|
288
|
+
FROM wordpress:cli-php8.2
|
|
289
|
+
USER root
|
|
290
|
+
RUN apk add --no-cache gmp \
|
|
291
|
+
&& apk add --no-cache --virtual .gmp-build $PHPIZE_DEPS gmp-dev \
|
|
292
|
+
&& docker-php-ext-install gmp \
|
|
293
|
+
&& apk del .gmp-build
|
|
294
|
+
USER www-data
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Replace each service's `image:` line with a `build:` key, such as
|
|
298
|
+
`build: { context: ., dockerfile: wordpress.Dockerfile }`, then run
|
|
299
|
+
`docker compose build wordpress cli` and `docker compose up -d wordpress`. Use
|
|
300
|
+
your own service names, and add no other service.
|
|
301
|
+
|
|
302
|
+
### Configure the wallet
|
|
303
|
+
|
|
304
|
+
You need a receive-only NWC code: a Nostr Wallet Connect code that can create
|
|
305
|
+
invoices and read payments but cannot spend. The plugin refuses a code that
|
|
306
|
+
can spend.
|
|
307
|
+
|
|
308
|
+
1. Open **Downloads → Settings → Payments → OpenReceive**.
|
|
309
|
+
2. Paste the code into **NWC code** and save. To accept stablecoins too, paste
|
|
310
|
+
a swap provider code into **Lightning Swap Connect code**.
|
|
311
|
+
3. Open **Payments → General**, tick **OpenReceive (Bitcoin Lightning)** under
|
|
312
|
+
**Active Gateways**, and save.
|
|
313
|
+
|
|
314
|
+
When you save, the plugin checks that the wallet can receive, then stores the
|
|
315
|
+
codes encrypted with keys derived from WordPress's authentication keys. The
|
|
316
|
+
fields never show a saved code; they say only whether one is set. EDD's own
|
|
317
|
+
settings never hold a code. The settings page ends with the OpenReceive
|
|
318
|
+
Doctor, the same checks as `wp openreceive doctor`.
|
|
319
|
+
|
|
320
|
+
With WP-CLI, pipe each code in from your secret manager or a protected file,
|
|
321
|
+
never a code typed into the command:
|
|
322
|
+
|
|
323
|
+
```sh
|
|
324
|
+
wp openreceive configure --nwc-uri=- < /secure/path/wallet-code
|
|
325
|
+
wp openreceive configure --lsc-uri-primary=- < /secure/path/swap-code
|
|
326
|
+
wp openreceive configure --enable
|
|
327
|
+
wp openreceive doctor
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
`--enable` adds OpenReceive to EDD's active gateways (and turns it on in
|
|
331
|
+
WooCommerce, when that runs too). Omit the swap command for Bitcoin-only
|
|
332
|
+
checkout. `doctor` checks the store, GMP and sodium, each code as set or
|
|
333
|
+
unset (never its value), the tables, the wallet, the price feed for the store
|
|
334
|
+
currency, each swap provider and the scheduled pass, and exits nonzero when a
|
|
335
|
+
check fails. Codes set as `OPENRECEIVE_NWC_URI` or
|
|
336
|
+
`OPENRECEIVE_LSC_URI_PRIMARY` constants in `wp-config.php` win over saved ones.
|
|
337
|
+
|
|
338
|
+
### Check it
|
|
339
|
+
|
|
340
|
+
Make a Lightning invoice through the same route the purchase confirmation page
|
|
341
|
+
uses, for a new pending test order:
|
|
342
|
+
|
|
343
|
+
```sh
|
|
344
|
+
wp openreceive test-invoice --new
|
|
345
|
+
wp openreceive test-invoice edd-<order id>
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
`--new` orders your first published download, billed to the first
|
|
349
|
+
administrator; a pending order sends no email. To use an order that already
|
|
350
|
+
exists, pass its id with the `edd-` prefix. It prints the amount in sats, the
|
|
351
|
+
Lightning invoice and the receipt page, then each method the checkout offers:
|
|
352
|
+
Bitcoin Lightning, and each swap asset with its network and whether it is
|
|
353
|
+
available for this amount. A small order is often below a swap provider's
|
|
354
|
+
minimum; that is the amount, not a fault. The receipt page shows the checkout
|
|
355
|
+
to the order's customer, or to you while you are signed in to WordPress as
|
|
356
|
+
the shop manager. Delete the test order under **Downloads → Orders** when you
|
|
357
|
+
are done.
|
|
358
|
+
|
|
359
|
+
### How a payment works
|
|
360
|
+
|
|
361
|
+
1. The customer picks the OpenReceive method at checkout and presses
|
|
362
|
+
**Purchase**. EDD records a pending order and opens its purchase
|
|
363
|
+
confirmation page, which shows the checkout.
|
|
364
|
+
2. The plugin charges the order's total in the store currency, converted to
|
|
365
|
+
sats at the current BTC price. Only the customer, signed in, or the browser
|
|
366
|
+
EDD showed the receipt to (a guest included), can make or follow the
|
|
367
|
+
order's payment.
|
|
368
|
+
3. Once the wallet reports the payment, the plugin records it in the same
|
|
369
|
+
database transaction that settles it. Right after, EDD completes the order
|
|
370
|
+
with the payment hash as its transaction id, sends the receipt and opens
|
|
371
|
+
the downloads. If that step is interrupted, the next request or scheduled
|
|
372
|
+
pass finishes it.
|
|
373
|
+
4. The page reloads to the completed receipt.
|
|
374
|
+
|
|
375
|
+
The checkout asks the wallet while the page is open. If the customer closes
|
|
376
|
+
it before the payment settles, a pass every minute on Action Scheduler (which
|
|
377
|
+
EDD bundles) finds the payment. WordPress runs scheduled work on page visits,
|
|
378
|
+
so on a quiet store a system cron for WordPress settles such orders sooner.
|
|
379
|
+
`wp openreceive reconcile` runs one pass by hand.
|
|
380
|
+
|
|
381
|
+
### Refunds and removal
|
|
382
|
+
|
|
383
|
+
The receive-only wallet cannot send refunds. Send a refund from your own
|
|
384
|
+
wallet, then record it in EDD. A customer whose swap deposit never converted
|
|
385
|
+
reclaims it from the same order's purchase confirmation page. If you turn on
|
|
386
|
+
swaps, you commit to keeping that page available. See
|
|
387
|
+
[swap refunds](https://openreceive.org/guides/swap-refunds.md).
|
|
388
|
+
|
|
389
|
+
Deactivating or deleting the plugin keeps its two payment tables: they are a
|
|
390
|
+
record of payments received. (On a site that also runs WooCommerce, its
|
|
391
|
+
**Remove data on uninstall** setting drops them on deletion.) EDD orders are
|
|
392
|
+
always kept.
|
|
393
|
+
|
|
394
|
+
### Tested, and not tested
|
|
395
|
+
|
|
396
|
+
Tested on 2026-10-16 with WordPress 7.1 and Easy Digital Downloads 3.7.2,
|
|
397
|
+
alone and next to WooCommerce 11.1, on MySQL 8, with a test wallet and a test
|
|
398
|
+
swap provider: install from the built ZIP, configure from stdin and from EDD's
|
|
399
|
+
settings page, the doctor, `test-invoice --new`, and a signed-in customer and
|
|
400
|
+
a guest paying by Lightning and by USDT on Solana in Chromium, after which the
|
|
401
|
+
order reads Completed. Another customer and a visitor were refused. The
|
|
402
|
+
repository's WordPress CI buys a download as a guest on every push.
|
|
403
|
+
|
|
404
|
+
Not tested: EDD's subscriptions (Recurring Payments), multisite, and stores
|
|
405
|
+
whose purchase confirmation page lacks EDD's receipt block or shortcode.
|
|
406
|
+
Lightning cannot pull a payment, so OpenReceive takes no subscription
|
|
407
|
+
renewals.
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/fastapi/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 FastAPI application — the app you are already working in.
|
|
23
23
|
You do not need a copy of the OpenReceive source: the engine is on PyPI
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/fastify/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 Fastify application — the app you are already working in.
|
|
23
23
|
You do not need a copy of the OpenReceive source: the packages are on npm, and
|
|
@@ -312,7 +312,7 @@ products, and you do not join them.
|
|
|
312
312
|
app's equivalent) through the `query` the library hands you, on that same
|
|
313
313
|
settlement transaction, not a second connection from your ORM. Database writes
|
|
314
314
|
only in the hook; emails, jobs, and pushes after commit. Placeholder style is
|
|
315
|
-
the dialect you declared: `?` on sqlite, `$1` on postgres.
|
|
315
|
+
the dialect you declared: `?` on sqlite and mysql, `$1` on postgres.
|
|
316
316
|
|
|
317
317
|
### If the database is Supabase
|
|
318
318
|
|
|
@@ -556,13 +556,14 @@ const app = Fastify({ trustProxy: true });
|
|
|
556
556
|
await app.register(openReceiveFastify, {
|
|
557
557
|
wallet: { nwc: process.env.NWC_URI! }, // receive-only NWC code; your app refuses to start otherwise
|
|
558
558
|
storage: {
|
|
559
|
-
db, // pg Pool/Client, node:sqlite, better-sqlite3, or a custom adapter
|
|
559
|
+
db, // pg Pool/Client, mysql2 Pool, node:sqlite, better-sqlite3, or a custom adapter
|
|
560
560
|
onPaid: async ({ reference, paidAt, query }) => {
|
|
561
561
|
// Settlement transaction; runs only for the first settled attempt for a
|
|
562
562
|
// reference. The WHERE clause is the lock: a second fulfillment path of
|
|
563
563
|
// yours (admin action, replayed job) updates zero rows and does nothing.
|
|
564
|
-
// Use `query` here, not your ORM's other connection. `?` on sqlite
|
|
565
|
-
// on postgres.
|
|
564
|
+
// Use `query` here, not your ORM's other connection. `?` on sqlite and
|
|
565
|
+
// mysql, `$1` on postgres. MySQL has no RETURNING: after the UPDATE,
|
|
566
|
+
// `SELECT ROW_COUNT() AS claimed` tells you the same thing.
|
|
566
567
|
const claimed = await query(
|
|
567
568
|
"UPDATE orders SET state = 'paid', paid_at = ? WHERE id = ? AND state = 'awaiting_payment' RETURNING id",
|
|
568
569
|
[paidAt, reference],
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/flask/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 Flask application — the app you are already working in.
|
|
23
23
|
You do not need a copy of the OpenReceive source: the engine is on PyPI
|