openreceive-rails 0.4.13 → 0.4.15

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.
@@ -1,224 +0,0 @@
1
- # OpenReceive agent directions (BTCPay Server)
2
-
3
- These directions describe OpenReceive 0.4.13.
4
-
5
- Connect a BTCPay Server store to a receive-only NWC wallet with the OpenReceive
6
- plugin, and optionally let payers pay BTCPay invoices with USDT, USDC, ETH or
7
- SOL. You do not need a copy of the OpenReceive source, and there is no
8
- application code to write: the plugin is configured through BTCPay's store UI
9
- or its Greenfield API, and the quickstart is appended to this file in full.
10
-
11
- This is the BTCPay plugin, not the Node or Rails library. Do not install
12
- `@openreceive/*` packages or the `openreceive-rails` gem into a BTCPay
13
- deployment, do not add `openreceive_payments` tables, and do not mount
14
- OpenReceive HTTP routes. BTCPay's invoices, checkout, webhooks and Greenfield
15
- API are the host; the plugin only supplies the Lightning backend and the swap
16
- rail.
17
-
18
- ## What the plugin is
19
-
20
- A BTCPay Server plugin (`BTCPayServer.Plugins.OpenReceive`) that registers a
21
- Lightning connection-string handler for `type=openreceive;nwc=<NWC URI>`.
22
- Saving that string makes the NWC wallet the store's Lightning node: BTCPay
23
- mints every Lightning invoice in that wallet and its own `LightningListener`
24
- records the payments. The plugin never calls a NIP-47 `pay_*` method, so
25
- every send-side BTCPay feature (Lightning payouts, pull-payment refunds over
26
- Lightning, the send tab) is unavailable by design.
27
-
28
- The one required credential is a receive-only NWC code. A Lightning Swap
29
- Connect (LSC) code optionally adds server-side swaps: a provider order aimed at
30
- the invoice's existing BOLT11, tracked in the plugin's own table, with the
31
- refund path on the same checkout screen.
32
-
33
- ## Step 0 — check the deployment before you change anything
34
-
35
- 1. Confirm the BTCPay Server version is 2.4.4 or later (Server Settings →
36
- About, or `GET /api/v1/server/info`). The plugin declares that minimum and
37
- BTCPay refuses to load it below.
38
- 2. Check whether the plugin is installed (the Plugins menu — the plug icon in
39
- the top-right corner — under Installed Plugins, or the store navigation
40
- shows an "OpenReceive" entry). If not, install it from the BTCPay plugin
41
- directory (the same Plugins menu → Plugin Directory, search "openreceive",
42
- then Install and Restart now), as the quickstart says; do not invent an
43
- installer command.
44
- 3. Check whether the store already has an OpenReceive connection:
45
- `GET /api/v1/stores/{storeId}/openreceive/settings` returns
46
- `lightningNodeIsOpenReceive`. If true, the wallet step is done — go to
47
- swaps only if the user wants them.
48
- 4. If no receive-only NWC code is available, stop and tell the user exactly
49
- what to create:
50
-
51
- > OpenReceive cannot mint an invoice without a receive-only NWC code. Get
52
- > one at https://openreceive.org/get_a_nwc_code_to_receive_payments and
53
- > paste it into Store → OpenReceive → Test connection, or hand it to me and
54
- > I will set it through the Greenfield API.
55
-
56
- Never print, log or echo the code; report only whether it is set. Never
57
- paste a bare `nostr+walletconnect://` string into BTCPay's Lightning node
58
- screen — that form is claimed by the Nostr plugin, without the receive-only
59
- guard.
60
- 5. If the user wants altcoin payments, ask for an LSC code from
61
- https://openreceive.org/set_up_swap_provider. Do not wait for it: the
62
- wallet works without it, and swaps switch on later with one settings change.
63
-
64
- Only then start the quickstart.
65
-
66
- ## Non-negotiables
67
-
68
- - The connection string is `type=openreceive;nwc=<NWC URI>[;allow-spend=true]`
69
- and nothing else. Set it through the setup page or
70
- `PUT /api/v1/stores/{storeId}/openreceive/settings` with `nwcUri`, never by
71
- editing BTCPay's Lightning node screen by hand.
72
- - Receive-only is required. A code that advertises `pay_invoice` or another
73
- spend method is refused on save. The override (`allowSpendCapableWallet`,
74
- the checkbox on the setup page) is the user's explicit choice; never tick it
75
- to make a save succeed.
76
- - The wallet's network must match BTCPay's. A mismatch is a refusal, not a
77
- warning.
78
- - The wallet must grant `make_invoice` and `list_transactions`.
79
- `lookup_invoice` is optional; do not ask the user for a code that grants it.
80
- - Swaps require the store's Lightning node to be the OpenReceive connection.
81
- Enabling swaps on a store using the internal node is refused
82
- (`wallet_required`).
83
- - Swaps set the store's invoice expiration to 60 minutes when it is shorter,
84
- and the plugin refuses to create a swap on an invoice with less than the
85
- provider's window left. Do not lower the expiration below 45 minutes on a
86
- swap-enabled store.
87
- - Top-up (amountless) invoices are unsupported on this backend. Do not
88
- configure a point of sale or payment link that relies on them with this
89
- wallet.
90
- - Secrets stay server-side. The NWC code and LSC code live in BTCPay's
91
- database like every other BTCPay credential; never copy them into
92
- screenshots, tickets, browser code or logs. The provider's order token never
93
- leaves the server.
94
- - BTCPay's `LightningListener` is the settlement authority. Provider
95
- `completed` is not payment; only the wallet reporting the Lightning invoice
96
- settled is. Do not build anything that fulfils on a provider state.
97
- - There is no merchant-initiated refund of a settled Lightning payment. A swap
98
- refund is a payer reclaiming a deposit that never converted, and only from
99
- the `refund_required` provider state.
100
-
101
- ## Verifying
102
-
103
- Store → OpenReceive → **Run a health check** (the doctor page) runs every probe now: connection, preflight,
104
- notifications, last scan, provider reachability, invoice expiration, swaps
105
- needing attention. On a regtest machine, `packages/dotnet/docker/up.sh` then
106
- `e2e.sh` in the OpenReceive repository proves the whole path end to end, and
107
- that is the only situation where cloning the repository is the right move.
108
-
109
- ## More documentation
110
-
111
- Fetch one when the moment comes. Each is raw markdown, so a plain GET is
112
- enough; drop the `.md` for the same page a person would read.
113
-
114
- - https://openreceive.org/guides/btcpay-reference.md — every setting, route, swap state, doctor probe and log event of the plugin
115
- - https://openreceive.org/guides/security.md — why receive-only is the only wallet credential
116
- - https://openreceive.org/guides/lightning-swap-connect.md — what an LSC code actually is
117
- - https://openreceive.org/guides/automated-swaps.md — provider states, and what turning swaps on commits a merchant to
118
- - https://openreceive.org/guides/swap-refunds.md — the refund states; the route back is BTCPay's own invoice checkout page here
119
- - https://openreceive.org/guides.md — the index, if what you need is not above
120
-
121
- Questions, or a problem with the plugin itself:
122
- https://openreceive.org/contact
123
-
124
- - https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
125
-
126
- ---
127
-
128
- ## The quickstart, in full
129
-
130
- Inlined verbatim so this file needs no network access — follow it once Step 0
131
- passes. The page it comes from is https://openreceive.org/guides/quickstart-btcpay.
132
-
133
- ## BTCPay Server quickstart
134
-
135
- Requires BTCPay Server ≥ 2.4.4.
136
-
137
- The OpenReceive plugin makes a receive-only NWC wallet the Lightning node of a
138
- BTCPay store. BTCPay creates every Lightning invoice in that wallet. It records
139
- payments the same way it records any other payment. You can also let payers pay
140
- a BTCPay invoice with USDT, USDC, ETH or SOL through a Lightning Swap Connect
141
- provider. The swap pays into the same wallet. The store's internal node is
142
- never used.
143
-
144
- This is not the Node or Rails library. There are no hooks, no
145
- `openreceive_payments` table and no OpenReceive HTTP routes. BTCPay's own
146
- invoices, checkout, webhooks and Greenfield API do that work.
147
-
148
- ### 1. Prerequisites
149
-
150
- - A BTCPay Server, version 2.4.4 or later, on any network (mainnet, testnet,
151
- signet, regtest). The wallet must be on the same network.
152
- - A receive-only NWC code for the wallet you want to receive into
153
- ([get one here](https://openreceive.org/get_a_nwc_code_to_receive_payments)).
154
- The code must grant `make_invoice` and `list_transactions` and must not
155
- advertise any spend method. `lookup_invoice` is optional.
156
- - Optionally, a Lightning Swap Connect (LSC) code from a
157
- [swap provider](https://openreceive.org/set_up_swap_provider), if payers
158
- should be able to pay with USDT, USDC, ETH or SOL.
159
-
160
- ### 2. Install the plugin
161
-
162
- Sign in as a **server administrator**. If someone else hosts your server, ask
163
- them to install the plugin for you.
164
-
165
- **1. Open the Plugins menu.** It is the plug icon in the top-right corner.
166
-
167
- **2. Click Plugin Directory.**
168
-
169
- **3. Search for `openreceive`** and click the **OpenReceive** result.
170
-
171
- **4. Click Install in BTCPay Server.** Confirm when prompted, then click
172
- **Restart now** and wait for BTCPay to come back.
173
-
174
- At startup, BTCPay creates the plugin's two tables in its own Postgres
175
- database: `openreceive_invoices` and `openreceive_swaps`, in the schema
176
- `BTCPayServer.Plugins.OpenReceive`. Nothing else is created.
177
-
178
- To build the plugin from source instead, follow
179
- [the .NET workspace README](https://github.com/OpenReceive/openreceive/blob/master/packages/dotnet/README.md).
180
-
181
- ### 3. Connect the wallet
182
-
183
- 1. Select your store and open **OpenReceive** in its sidebar, under Wallets.
184
- 2. Paste your receive-only NWC code. To see what the wallet supports first,
185
- click **Test connection**.
186
- 3. Click **Save NWC Code**.
187
- 4. To turn swaps on, paste a Lightning Swap Connect code and click **Save swap
188
- settings**.
189
-
190
- The page then shows **Wallet connected**. If you set up a provider, it also
191
- shows **Swaps on**. There is nothing else to configure. You never open BTCPay's
192
- Lightning node screen, and the plugin never reads the internal node.
193
-
194
- Screenshots for each of those steps, and for creating a first test invoice,
195
- are in the plugin's
196
- [README](https://github.com/OpenReceive/openreceive/blob/master/packages/dotnet/BTCPayServer.Plugins.OpenReceive/README.md).
197
-
198
- The plugin refuses to save a code whose wallet advertises a spend method such
199
- as `pay_invoice`. Create a receive-only code instead. If your wallet cannot
200
- make one, there is an override, but using it is a deliberate choice and the
201
- plugin logs it.
202
-
203
- Turning swaps on raises the store's invoice expiration to 60 minutes if it is
204
- shorter. A swap needs the invoice to stay open for at least 45 minutes.
205
-
206
- ### 4. Check it
207
-
208
- Click **Run a health check** on the OpenReceive page. It runs every check
209
- right there:
210
-
211
- - the connection
212
- - the wallet preflight
213
- - payment notifications
214
- - the last wallet scan
215
- - the swap provider and its assets
216
- - the invoice expiration
217
- - swaps that need a human
218
-
219
- Each failing check comes with a link to the fix.
220
-
221
- The [BTCPay plugin reference](https://openreceive.org/guides/btcpay-reference.md) lists every setting,
222
- Greenfield route, swap state, log event and check. It also lists what the
223
- plugin does not support by design: every send-side feature, top-up invoices,
224
- and a bare `nostr+walletconnect://` string in BTCPay's Lightning node screen.