{"slug":"debug-openreceive-payment-5","title":"debug-openreceive-payment","summary":"Diagnose a failing OpenReceive integration. Use when an OpenReceive-powered checkout misbehaves: the server refuses to boot, checkout routes return 403, 404, 409, or 5xx, a paid invoice never settles, a swap refund seems unreachable, or the checkout UI renders nothing.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:42:00.789696Z","repo":{"url":"https://github.com/OpenReceive/openreceive","stars":32,"forks":5,"license":"MIT","updatedAt":"2026-11-28T19:16:21Z"},"bodyHtml":"<hr>\n<h2>name: debug-openreceive-payment\ndescription: &gt;\nDiagnose a failing OpenReceive integration. Use when an OpenReceive-powered\ncheckout misbehaves: the server refuses to boot, checkout routes return 403,\n404, 409, or 5xx, a paid invoice never settles, a swap refund seems\nunreachable, or the checkout UI renders nothing.\nlicense: MIT</h2>\n<h1>Debug an OpenReceive payment</h1>\n<p>Work top-down: configuration, then the request, then settlement. Every guide\nURL below is raw markdown — fetch it when the step needs it.</p>\n<h2>1. Run the doctor first</h2>\n<pre><code>npx openreceive doctor                     # Node version, NWC_URI, swap config, wallet probe\nnpx openreceive doctor --db &lt;db&gt;           # + are openreceive_payments/openreceive_meta migrated?\nnpx openreceive doctor --url http://localhost:3000   # + are the routes actually mounted?\nnpx openreceive doctor --scan-build &lt;dir&gt;  # alone, after a production build: did a code reach it?\nbin/rails openreceive:doctor               # Rails\nmanage.py openreceive_doctor               # Django\nopenreceive doctor --app main:app           # FastAPI\nphp artisan openreceive:doctor             # Laravel\nwp openreceive doctor                      # WordPress\nphp bin/doctor                             # plain PHP: host script calling $engine-&gt;doctor()\n</code></pre>\n<p>Each failing line states its own fix. <code>npx openreceive debug-report</code> prints the\nsame diagnostics redacted, always exit 0 — safe to share.</p>\n<h2>2. Boot failures</h2>\n<table>\n<thead>\n<tr>\n<th>Symptom</th>\n<th>Cause and fix</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>MISSING_NWC</code> / \"needs a receive-only NWC code\"</td>\n<td><code>NWC_URI</code> is not in the server process env. A <code>.env</code> file alone is not enough — something must load it (<code>dotenv/config</code>, Next auto-load). Get a code: <a href=\"https://openreceive.org/get_a_nwc_code_to_receive_payments\">https://openreceive.org/get_a_nwc_code_to_receive_payments</a></td>\n</tr>\n<tr>\n<td><code>INVALID_NWC</code> / \"not a valid NWC code\"</td>\n<td>The value is malformed (must be <code>nostr+walletconnect://</code> with 64-hex pubkey and secret, ≥1 <code>wss</code> relay). Re-copy it from the wallet.</td>\n</tr>\n<tr>\n<td>\"NOT receive-only\" / spend methods advertised</td>\n<td>The wallet minted a spend-capable code; OpenReceive fails closed because a leak would drain the wallet. Mint a receive-only code. Overriding (<code>allowSpendCapableWallet</code> / <code>OPENRECEIVE_ALLOW_SPEND_CAPABLE_NWC</code>) is a last resort.</td>\n</tr>\n<tr>\n<td>Wallet preflight failed (methods/encryption)</td>\n<td>The wallet must advertise <code>make_invoice</code> + <code>list_transactions</code> and NIP-04 or NIP-44 v2. Use a compatible wallet.</td>\n</tr>\n<tr>\n<td>\"The openreceive_meta table does not exist\" / raw <code>no such table: openreceive_payments</code></td>\n<td>The migration was never applied. Node: <code>npx openreceive scaffold payments --orm &lt;yours&gt;</code>, then run the emitted migration through the app's normal workflow. Rails: <code>bin/rails generate openreceive:install</code>, then <code>bin/rails db:migrate</code>. Django: <code>manage.py openreceive_install &lt;app&gt; &amp;&amp; manage.py migrate</code>. FastAPI: <code>openreceive scaffold payments --alembic --dialect &lt;db&gt;</code> (or <code>--sql</code>), then apply through the host workflow. Laravel: <code>php artisan openreceive:install &amp;&amp; php artisan migrate</code>. Plain PHP: apply <code>OpenReceive\\Storage\\PaymentsSchema::statements($dialect)</code> through the host workflow. WordPress: check plugin activation/upgrades applied the tables. <a href=\"https://openreceive.org/guides/storage.md\">https://openreceive.org/guides/storage.md</a></td>\n</tr>\n<tr>\n<td>\"requires amountFor / onPaid / authorize / host\"</td>\n<td>The factory is missing a required hook — see the host contract in <a href=\"https://openreceive.org/guides/api-reference.md\">https://openreceive.org/guides/api-reference.md</a></td>\n</tr>\n</tbody>\n</table>\n<h2>3. Request-time errors from the routes</h2>\n<table>\n<thead>\n<tr>\n<th>Status</th>\n<th>Meaning</th>\n<th>Where to look</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>403 FORBIDDEN</td>\n<td>Your own <code>authorize</code> hook denied it, or the request looked cross-site. Check the session/cookie actually reaches the checkout routes. <a href=\"https://openreceive.org/guides/authorization.md\">https://openreceive.org/guides/authorization.md</a></td>\n<td></td>\n</tr>\n<tr>\n<td>Never 403s — any visitor can mint, poll, or refund for any reference</td>\n<td>The opposite failure: on Rails the generated <code>config.authorize = OpenReceive::ALLOW_ALL_AUTHORIZE</code> placeholder is still installed (the engine warns at boot; <code>bin/rails openreceive:doctor</code> reports it). Replace it with the app's real ownership check. <a href=\"https://openreceive.org/guides/authorization.md\">https://openreceive.org/guides/authorization.md</a></td>\n<td></td>\n</tr>\n<tr>\n<td>404 NOT_FOUND</td>\n<td><code>amountFor</code> returned <code>null</code> (unknown reference), or the <code>payment_hash</code> does not belong to that reference.</td>\n<td></td>\n</tr>\n<tr>\n<td>409 CONFLICT</td>\n<td><strong>Normal state, not a bug</strong>: the reference already settled, or an unpaid checkout for that method is already live. Show it as order state; never retry-loop.</td>\n<td></td>\n</tr>\n<tr>\n<td>503 retryable</td>\n<td>The host hook failed while persisting the attempt (instructions withheld), or the wallet is unavailable. Read the server log for the underlying error.</td>\n<td></td>\n</tr>\n<tr>\n<td>Framework 404 / HTML error page</td>\n<td>The router is not mounted, or mounted at a different prefix than the UI's <code>prefix</code> prop. <code>doctor --url</code> distinguishes these.</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h2>4. Paid but never settles</h2>\n<ul>\n<li>Settlement is opportunistic: any OpenReceive request runs one reconcile pass\nthrough a durable gate (min 3s between wallet scans, stretched by invoice\nage). A quiet server settles on the next request — or run the optional\nnotifications worker: Rails <code>bin/rails openreceive:notifications</code>, Django\n<code>manage.py openreceive_notifications</code>, FastAPI\n<code>openreceive notifications --app main:app</code>, Laravel\n<code>php artisan openreceive:notifications</code>, WordPress <code>wp openreceive notifications</code>,\nor plain PHP's host script <code>php bin/notifications</code>. Node hosts run their\nseparate worker using the notifications API. No web-process timer is missing.</li>\n<li>An unpaid attempt closes only after a successful wallet scan at/after expiry\nplus a 900s grace constant — a local clock alone never closes one. <code>expired</code>\narriving \"late\" is correct.</li>\n<li><code>onPaid</code> runs once per reference, first settled attempt only, inside the\nsettlement transaction. If your fulfillment did not run, check whether the\nguarded <code>UPDATE … WHERE</code> matched zero rows (already transitioned).\n<a href=\"https://openreceive.org/guides/storage.md\">https://openreceive.org/guides/storage.md</a></li>\n</ul>\n<h2>5. Swaps and refunds</h2>\n<ul>\n<li>A deposit that arrives short or late becomes <code>refund_required</code>; the payer\nclaims it on a second visit. That needs a per-order URL you serve\n(<code>/checkout/:reference</code>, <code>syncUrl</code> on the drop-ins). Keep the\n<code>payment_hash</code>: <code>POST /swaps/status</code> reopens the attempt with no expiry\nwindow, while re-picking the coin mints a new deposit after ~30 minutes.</li>\n<li>Refunds exist only for swap deposits from <code>refund_required</code>. There is <strong>no\nLightning refund</strong> — the wallet cannot spend. Do not chase one.\n<a href=\"https://openreceive.org/guides/swap-refunds.md\">https://openreceive.org/guides/swap-refunds.md</a></li>\n<li>\"Payer reports two different amounts on a stablecoin checkout\" (50.05 or\n50.03?): the deposit amount is a token quantity, <code>fee.pay_in_fiat</code> is its\nfiat valuation. Only <code>swap.deposit_amount</code> is an instruction. From 0.4.10 the\npackaged checkout renders a USD stablecoin's breakdown in the token and never\nshows <code>pay_in_fiat</code>; on an older bundle, upgrade <code>@openreceive/*</code>. To verify,\nread the row's <code>deposit_amount</code> and <code>fee</code> and confirm the UI shows only the\ndeposit amount. A custom UI must call <code>createSwapFeeBreakdown(fee, swap)</code>\nwith the swap, not the fee alone.</li>\n</ul>\n<h2>6. Checkout UI shows nothing</h2>\n<ul>\n<li>The components require <code>prefix</code> — the exact base path the routes are mounted\nat (<code>\"/openreceive\"</code> unless you changed it).</li>\n<li>Import <code>@openreceive/react/styles.css</code> or <code>@openreceive/elements/styles.css</code>\nalongside the component registration. For standalone Django/Laravel/PHP,\nserve both <code>openreceive-checkout.js</code> (as a module) and\n<code>openreceive-checkout.css</code>. Django serves them from <code>static/openreceive/</code>\nvia <code>collectstatic</code>; Laravel/PHP serve the unpacked standalone assets from\nthe public directory. Check that both requests succeed and the custom\nelement is registered. Do not process the compiled stylesheet with Tailwind.</li>\n<li>\"invoice must not be an NWC connection string\" means a server secret leaked\ninto a browser payload — stop and fix the server response; never render it.\n<a href=\"https://openreceive.org/guides/frontend-checkout.md\">https://openreceive.org/guides/frontend-checkout.md</a></li>\n</ul>\n<h2>Still stuck</h2>\n<p>The full route/option/error reference:\n<a href=\"https://openreceive.org/guides/api-reference.md\">https://openreceive.org/guides/api-reference.md</a> · machine-readable contract:\n<a href=\"https://openreceive.org/openapi.yaml\">https://openreceive.org/openapi.yaml</a> · library bug reports:\n<a href=\"https://openreceive.org/contact\">https://openreceive.org/contact</a></p>\n","files":[{"path":"SKILL.md","sizeBytes":8077,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"notes-only","suspicious":0,"notes":2,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:42:10.427043Z","sha256":"0ED335A45D3FD976C2B7E368CF8A8944829517E7DA59C95CE9E02CB72FCA34A0","sizeBytes":3698},"review":null,"source":{"repositoryUrl":"https://github.com/OpenReceive/openreceive","path":"packages/ruby/openreceive/skills/debug-openreceive-payment","license":"MIT","commit":"e78eecaa464259087917f2439b742212804a8817","subtreeSha":"486EB23E37619B651F79E33807E79805C6B80AE4F5B85F7F4E37907DCF001B83","lastSyncedAt":"2026-11-29T00:41:58.923445Z"},"reviewedAt":"2026-11-29T00:42:36.001776Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/OpenReceive/openreceive/tree/master/packages/ruby/openreceive/skills/debug-openreceive-payment"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install openreceive-openreceive@llmmart"},{"target":"git","command":"git clone https://github.com/OpenReceive/openreceive.git"}]}