@openreceive/node 0.4.16 → 0.4.17
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.
- package/package.json +2 -2
- package/skills/integrate-openreceive/SKILL.md +1 -1
- package/skills/integrate-openreceive/references/btcpay.md +1 -1
- package/skills/integrate-openreceive/references/django.md +1 -1
- package/skills/integrate-openreceive/references/fastapi.md +1 -1
- package/skills/integrate-openreceive/references/fastify.md +1 -1
- package/skills/integrate-openreceive/references/laravel.md +1 -1
- package/skills/integrate-openreceive/references/next.md +1 -1
- package/skills/integrate-openreceive/references/node.md +1 -1
- package/skills/integrate-openreceive/references/php.md +1 -1
- package/skills/integrate-openreceive/references/rails.md +1 -1
- package/skills/integrate-openreceive/references/woocommerce.md +165 -61
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openreceive/node",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.17",
|
|
4
4
|
"description": "Accept Bitcoin Lightning payments in Node.js with your own wallet and optional USDT, USDC, SOL and ETH swaps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@getalby/sdk": "^8.0.3",
|
|
20
|
-
"@openreceive/core": "0.4.
|
|
20
|
+
"@openreceive/core": "0.4.17"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
23
|
"openreceive": "./bin/openreceive.mjs"
|
|
@@ -143,7 +143,7 @@ and BTCPay manage installation through their plugins; follow their references.
|
|
|
143
143
|
| FastAPI | `openreceive doctor --app main:app` | `nwc_client`, `price_provider`, `swap_providers` on `openreceive_router`, using `openreceive.testing` fakes |
|
|
144
144
|
| Laravel | `php artisan openreceive:doctor` | Bind `ReceiveNwcClient`, `PriceProvider`, and `OpenReceiveServiceProvider::SWAP_PROVIDERS` in the container |
|
|
145
145
|
| Plain PHP | `php bin/doctor` (host script calling `$engine->doctor()`) | Build `Service` with `OpenReceive\Testing\FakeWallet`, `FakeSwapProvider`, and `OpenReceive\Rates\StaticPriceProvider` |
|
|
146
|
-
| WordPress | `wp openreceive doctor` | Repository development: the documented Docker `compose.testkit.yml` override |
|
|
146
|
+
| WordPress | `wp openreceive doctor`, then `wp openreceive test-invoice <order id>` for a real invoice | Repository development: the documented Docker `compose.testkit.yml` override |
|
|
147
147
|
| BTCPay | Follow the plugin reference's connection and checkout checks | Use the plugin's Docker test setup in its reference |
|
|
148
148
|
|
|
149
149
|
The routes, persistence, reconciliation, and fulfillment hooks then run the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (BTCPay Server)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/btcpay.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Connect a BTCPay Server store to a receive-only NWC wallet with the OpenReceive
|
|
6
6
|
plugin, and optionally let payers pay BTCPay invoices with USDT, USDC, ETH or
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (Django)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/django.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a Django project — the app you are already working in. You
|
|
6
6
|
do not need a copy of the OpenReceive source: the Python package is on PyPI
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (FastAPI)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/fastapi.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a FastAPI application — the app you are already working in.
|
|
6
6
|
You do not need a copy of the OpenReceive source: the engine is on PyPI
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (Fastify)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/fastify.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a Fastify application — the app you are already working in.
|
|
6
6
|
You do not need a copy of the OpenReceive source: the packages are on npm, and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (Laravel)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/laravel.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a Laravel application — the app you are already working in.
|
|
6
6
|
You do not need a copy of the OpenReceive source: the package is on Packagist
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (Next.js)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/next.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a Next.js App Router application — the app you are already
|
|
6
6
|
working in. You do not need a copy of the OpenReceive source: the packages are
|
|
@@ -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.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/node.md`), not through a summarizing tool: a summary drops steps.
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (PHP)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/php.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a PHP application — the app you are already working in. You
|
|
6
6
|
do not need a copy of the OpenReceive source: the engine is on Packagist
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (Rails)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/rails.md`), not through a summarizing tool: a summary drops steps.
|
|
4
4
|
|
|
5
5
|
Add OpenReceive to a Rails application — the app you are already working in. You
|
|
6
6
|
do not need a copy of the OpenReceive source: the gem is on RubyGems, the
|
|
@@ -1,64 +1,155 @@
|
|
|
1
1
|
# OpenReceive agent directions (WordPress + WooCommerce)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
4
|
-
|
|
5
|
-
Install and configure the OpenReceive gateway in the
|
|
6
|
-
|
|
7
|
-
The plugin bundles the PHP engine and checkout assets
|
|
8
|
-
install npm or Composer packages on the WordPress server
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
and
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
3
|
+
These directions describe OpenReceive 0.4.17. If you fetched this file, fetch it raw (`curl -fsSL https://openreceive.org/agent-directions/woocommerce.md`), not through a summarizing tool: a summary drops steps.
|
|
4
|
+
|
|
5
|
+
Install and configure the OpenReceive payment gateway in the WooCommerce store
|
|
6
|
+
you are working in. Preserve its theme, checkout, customer accounts, order
|
|
7
|
+
model and prices. The plugin bundles the PHP engine and checkout assets: do not
|
|
8
|
+
install npm or Composer packages on the WordPress server, and do not clone the
|
|
9
|
+
OpenReceive repository unless the release download in Step 1 fails.
|
|
10
|
+
|
|
11
|
+
The one required credential is a receive-only NWC code (Nostr Wallet Connect):
|
|
12
|
+
a string from the merchant's wallet that can create invoices and read their
|
|
13
|
+
status, and cannot spend. A swap provider (an "LSC" code) optionally lets
|
|
14
|
+
customers pay with USDT, USDC, ETH or SOL instead; the provider converts the
|
|
15
|
+
payment to BTC over Lightning in the merchant's connected wallet. Available
|
|
16
|
+
assets and networks depend on the provider.
|
|
17
|
+
|
|
18
|
+
Run every `wp` command below where this store's WP-CLI runs. When WordPress
|
|
19
|
+
runs in Docker Compose, prefix it with the service that has WP-CLI, for
|
|
20
|
+
example `docker compose run --rm -T cli wp …` or
|
|
21
|
+
`docker compose exec -T wordpress wp …`. `-T` passes stdin through. If the
|
|
22
|
+
store has no WP-CLI at all (managed hosting without a shell), say so and walk
|
|
23
|
+
the user through the quickstart's admin screens instead.
|
|
24
|
+
|
|
25
|
+
## Step 0 — ask for the two codes, one question at a time
|
|
26
|
+
|
|
27
|
+
Before anything else, check one thing: whether OpenReceive is already
|
|
28
|
+
installed (`wp plugin is-active openreceive`). If it is, run
|
|
29
|
+
`wp openreceive doctor`. It prints `NWC_URI: set` or `unset` (likewise
|
|
30
|
+
`LSC_URI_PRIMARY`), never the values. A code that is already set is not asked
|
|
31
|
+
for again; if both are set, skip to `wp openreceive configure --enable` at
|
|
32
|
+
the end of Step 2.
|
|
33
|
+
|
|
34
|
+
Otherwise your next action is a question to the user. Do not install the
|
|
35
|
+
plugin, edit Docker files or search anywhere else before asking it. Do not
|
|
36
|
+
read wp-config.php, deploy config, container environments or other projects
|
|
37
|
+
looking for a code: a new store has neither code yet.
|
|
38
|
+
|
|
39
|
+
The user never runs a command and never edits a file. They paste each code
|
|
40
|
+
into this chat; you store it. That is the supported path: do not ask them to
|
|
41
|
+
run the save command themselves, and do not tell them to revoke or replace a
|
|
42
|
+
code because it was pasted here. Ask one question per message.
|
|
43
|
+
|
|
44
|
+
1. **First message — the NWC code, and nothing else.**
|
|
45
|
+
|
|
46
|
+
> To receive payments I need a receive-only wallet code. In Rizful: open
|
|
47
|
+
> the menu, tap NWC, choose Receive-only NWC code, and tap Copy
|
|
48
|
+
> (https://openreceive.org/get_a_nwc_code_to_receive_payments). If you would
|
|
49
|
+
> rather run your own wallet, Alby Hub works too: Connections → Add
|
|
50
|
+
> Connection → Read Only. Paste the code here and I will store it.
|
|
51
|
+
|
|
52
|
+
2. **When they paste it.** If it does not start with `nostr+walletconnect://`,
|
|
53
|
+
ask them to copy the receive-only code again. Otherwise do not repeat it:
|
|
54
|
+
reply only that you have it, then ask the next question. You store it in
|
|
55
|
+
Step 2.
|
|
56
|
+
3. **Second message — swaps.** If the user asked for stablecoins, USDT, USDC,
|
|
57
|
+
ETH, SOL, altcoins or "crypto" (as in "Bitcoin and stablecoin payments"),
|
|
58
|
+
this message IS the walkthrough below: do not skip it, and do not ask yes
|
|
59
|
+
or no first. Otherwise ask whether customers should also be able to pay
|
|
60
|
+
with USDT, USDC, ETH or SOL, then give the walkthrough. The walkthrough:
|
|
61
|
+
|
|
62
|
+
> Go to https://lightning-swap.com, sign in for API keys, create a key, and
|
|
63
|
+
> copy the whole URI (https://openreceive.org/set_up_swap_provider). Paste
|
|
64
|
+
> it here and I will store it — or say "Bitcoin only" and I will continue
|
|
65
|
+
> without it.
|
|
66
|
+
|
|
67
|
+
Mention FixedFloat only if they already use it.
|
|
68
|
+
4. **When they paste it.** If it does not start with
|
|
69
|
+
`lightning+swapconnect://`, ask them to copy it again. Swaps are now on,
|
|
70
|
+
so keep the route back (the swap non-negotiable below).
|
|
71
|
+
|
|
72
|
+
Do not report setup as complete until the NWC code is saved, and the LSC code
|
|
73
|
+
is saved or the user said "Bitcoin only". Never invent a placeholder code.
|
|
74
|
+
|
|
75
|
+
## Step 1 — install the plugin
|
|
76
|
+
|
|
77
|
+
Install the plugin built for this release. Never install the GitHub
|
|
78
|
+
source-code ZIP or a ZIP from an older release:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
wp plugin install https://github.com/OpenReceive/openreceive/releases/download/v0.4.17/openreceive-wordpress-0.4.17.zip --activate
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
It needs WooCommerce active, and PHP 8.2+ with GMP and sodium in BOTH the web
|
|
85
|
+
PHP and the WP-CLI PHP. On the official `wordpress` and `wordpress:cli` Docker
|
|
86
|
+
images, activation fails with "OpenReceive requires the PHP sodium and GMP
|
|
87
|
+
extensions": add GMP to both images as "Enable GMP in both PHP runtimes" below
|
|
88
|
+
says, rebuild both, then install again. If the URL answers 404, build the same
|
|
89
|
+
tag as "Get the installable archive" below says.
|
|
90
|
+
|
|
91
|
+
## Step 2 — store the codes, then enable the gateway
|
|
92
|
+
|
|
93
|
+
Store each code yourself, one per command, and never as a shell argument:
|
|
94
|
+
|
|
95
|
+
1. Write the code with your file-editing tool, not a shell command (no
|
|
96
|
+
`echo`, `printf` or heredoc), to a new file outside the repository, such
|
|
97
|
+
as `/tmp/openreceive-code`.
|
|
98
|
+
2. Run `wp openreceive configure --nwc-uri=- < /tmp/openreceive-code`. In
|
|
99
|
+
Docker: `docker compose run --rm -T cli wp openreceive configure --nwc-uri=- < /tmp/openreceive-code`.
|
|
100
|
+
For the LSC code, use `--lsc-uri-primary=-`.
|
|
101
|
+
3. Delete the file (`rm /tmp/openreceive-code`), whether the command passed
|
|
102
|
+
or not.
|
|
103
|
+
|
|
104
|
+
The command runs the receive-only wallet preflight, encrypts the code and
|
|
105
|
+
prints only "Settings saved; wallet preflight passed."; a failure keeps the
|
|
106
|
+
previous settings. If it reports spend methods such as `pay_invoice`, ask the
|
|
107
|
+
user for a receive-only code again. Never turn on the spend-capable override.
|
|
108
|
+
`wp wc payment_gateway` and WooCommerce REST writes of these fields are
|
|
109
|
+
rejected on purpose; do not use them. A code set as a constant in
|
|
110
|
+
wp-config.php wins over the stored one and changes only through the host's
|
|
111
|
+
secret workflow.
|
|
112
|
+
|
|
113
|
+
Then run `wp openreceive configure --enable` and `wp openreceive doctor`.
|
|
114
|
+
Doctor names any failed check and exits nonzero; fix it before going on.
|
|
115
|
+
|
|
116
|
+
## Step 3 — mint a test invoice
|
|
117
|
+
|
|
118
|
+
Create a pending test order that pays with OpenReceive, then mint its
|
|
119
|
+
Lightning invoice from the terminal:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
wp wc shop_order create --user=<admin user id> --payment_method=openreceive \
|
|
123
|
+
--line_items='[{"product_id":<product id>,"quantity":1}]' --porcelain
|
|
124
|
+
wp openreceive test-invoice <order id>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`test-invoice` goes through the same checkout route as the order-pay page. It
|
|
128
|
+
prints the amount in sats, the BOLT11 invoice and the order-pay link. Give the
|
|
129
|
+
user that link: it opens the checkout with the configured methods and resumes
|
|
130
|
+
this same invoice. Ask them to pay only if they want a real settlement test,
|
|
131
|
+
and tell them the test order is theirs to delete.
|
|
132
|
+
|
|
133
|
+
## Non-negotiables
|
|
134
|
+
|
|
135
|
+
- Never print, log or commit a code, never put one in a shell argument, and
|
|
136
|
+
never write one into source files, wp-config.php or browser code. Doctor's
|
|
137
|
+
set/unset is all you report.
|
|
138
|
+
- Receive-only NWC is required. Never turn on the spend-capable override to
|
|
139
|
+
get past the preflight.
|
|
140
|
+
- The plugin owns only its payment-attempt tables in the WordPress database.
|
|
141
|
+
WooCommerce owns orders, totals, stock and email. Do not add an external
|
|
142
|
+
idempotency store, payment database or custom fulfillment code.
|
|
143
|
+
- IF SWAPS ARE ON, KEEP THE ROUTE BACK. A deposit that arrives short or late
|
|
144
|
+
becomes refundable, and the customer claims it later on the same order-pay
|
|
145
|
+
link (guests return with the order key in it). Keep order-pay links
|
|
146
|
+
reachable, and keep the plugin installed while swap orders may still need a
|
|
147
|
+
refund. https://openreceive.org/guides/swap-refunds.md
|
|
148
|
+
- A receive-only wallet cannot send merchant refunds. Refund a settled
|
|
149
|
+
payment manually from the wallet.
|
|
150
|
+
- Settlement runs on checkout requests and an every-minute scheduled job. On a
|
|
151
|
+
low-traffic store, run WordPress scheduled work from a system cron;
|
|
152
|
+
`wp openreceive notifications` is an optional long-running worker.
|
|
62
153
|
|
|
63
154
|
## Further reading
|
|
64
155
|
|
|
@@ -95,7 +186,7 @@ database or application.
|
|
|
95
186
|
|
|
96
187
|
### Get the installable archive
|
|
97
188
|
|
|
98
|
-
Download [openreceive-wordpress-0.4.
|
|
189
|
+
Download [openreceive-wordpress-0.4.17.zip](https://github.com/OpenReceive/openreceive/releases/download/v0.4.17/openreceive-wordpress-0.4.17.zip)
|
|
99
190
|
from the matching release. Historical releases may lack this asset. If that exact
|
|
100
191
|
URL returns 404, build the same tag below; never silently install an older ZIP.
|
|
101
192
|
The GitHub source-code ZIP is not an installable plugin. On a development machine
|
|
@@ -104,7 +195,7 @@ with Node 22+, PHP 8.2+ with GMP/sodium, Composer and WP-CLI:
|
|
|
104
195
|
```sh
|
|
105
196
|
git clone https://github.com/OpenReceive/openreceive.git
|
|
106
197
|
cd openreceive
|
|
107
|
-
git checkout v0.4.
|
|
198
|
+
git checkout v0.4.17
|
|
108
199
|
npm ci
|
|
109
200
|
npm run build:packages
|
|
110
201
|
composer install --working-dir=packages/php/wordpress
|
|
@@ -189,6 +280,19 @@ reports the failed check with credentials redacted and exits nonzero on failure.
|
|
|
189
280
|
The default payment title becomes “Bitcoin & crypto (OpenReceive)” with swaps;
|
|
190
281
|
a customized title is preserved.
|
|
191
282
|
|
|
283
|
+
To check checkout from the terminal, mint an invoice for an unpaid order whose
|
|
284
|
+
payment method is OpenReceive:
|
|
285
|
+
|
|
286
|
+
```sh
|
|
287
|
+
wp wc shop_order create --user=<admin user id> --payment_method=openreceive \
|
|
288
|
+
--line_items='[{"product_id":<product id>,"quantity":1}]' --porcelain
|
|
289
|
+
wp openreceive test-invoice <order id>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
`test-invoice` uses the same checkout route as the order-pay page. It prints the
|
|
293
|
+
amount in sats, the Lightning invoice and the order-pay link, which opens the
|
|
294
|
+
checkout on that invoice. Delete the test order when you are done.
|
|
295
|
+
|
|
192
296
|
### Checkout and settlement
|
|
193
297
|
|
|
194
298
|
Both WooCommerce checkout blocks and classic checkout send the customer to the
|