-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
The form's loading spinner only clears when the client module reaches the invoice stage. Work through:
- Hard-refresh / clear cache — the modules are ES modules served per-request; a stale cached copy can silently fail.
-
Module scripts must load. OC4 injects the payment form with
$('#checkout-confirm').load(...), and jQuery 3.7 strips<script type="module">tags from injected HTML. The current template works around this by creating the module<script>elements from an inline classic script. If you see raw<script type="module" src=...>tags in your rendered form instead of the loader IIFE, your install is running an old template — reinstall. -
Check asset MIME types. Both
.jsand.mjsmust be served astext/javascript. If your server serves.mjsasapplication/octet-stream, module imports fail:Fix Apache/Nginx MIME config as needed.curl -sI http://YOUR-STORE/extension/clink/catalog/view/javascript/clink/lib/clink-nostr.mjs -
Check the browser console. A red
SyntaxError/MIME type/Failed to fetch moduleerror points at the module chain.console.error('[CLINK] Payment init failed:', ...)shows the server-side error surfaced bygetInvoiceDataorrequestInvoice. -
Is the merchant node online? The relay must accept kind-21001 events and the merchant must respond. From a browser terminal:
node --experimental-websocket e2e.mjs # see repository / wiki repo test scripts -
Verify
getInvoiceDatareturns JSON for the order:http://YOUR-STORE/index.php?route=extension/clink/payment/clink.getInvoiceData&order_id=<id>
parseBolt11Amount converts bolt11 units to sats. Correct table: p→÷10000, n→÷10, u→×100, m→×100000. Earlier builds (≤1.0.0) used the wrong multipliers and rejected valid invoices. Upgrade to 1.0.1+ and re-test.
If getInvoiceData always returns rate: 65000 (the hardcoded fallback) and the log repeats No rate available for USD, using fallback 65000, two bugs in ≤1.0.1 kept the CoinGecko fetch from ever running:
-
Cache miss short-circuit — OpenCart's file cache returns
[](empty array), notfalse, on a miss. The old checkif ($cached !== false) return (float) $cached;treated[]as a cached0, which is<= 0and fell back without ever calling CoinGecko. Fixed to truthy check. -
HTTP 403 from CoinGecko — the PHP stream request sent no
User-Agent, and CoinGecko rejects such requests. The request now sendsUser-Agent: OpenCart-CLINK/1.0.1.
Upgrade to 1.0.2+. If you still see the fallback, clear system/storage/cache/cache.clink_rate_*.json and confirm outbound HTTPS to api.coingecko.com is allowed. A live rate returns something like {"rate": 63695, "amount_sats": 204098} for a $130 order.
The OC4 installer copies zip entries verbatim into extension/<code>/, and the Payments list scans extension/*/admin/controller/payment/*.php. If the zip has an upload/ prefix (OC3 layout) nothing is found. Use the OC4-native clink.ocmod.zip (entries at the zip root). See Installation.
Leftover state from a previous broken install. Clean extension/clink/, the stale row in oc_extension_install (or oc_extension), and any leftover app-path copies, then reinstall.
Some relays (e.g. strfry) send ["EVENT", <subscription_id>, <event>] — three elements. The client uses data[2] (object) with a data[1] fallback. If your client logs responses that never match, check it reads the third element.
The merchant node must call the webhook (extension/clink/payment/clink.webhook) with bolt11 + preimage. Confirm the node is configured with the store's webhook URL and, if set, the webhook secret. See Configuration.
- OpenCart error log:
system/storage/logs/error.log— CLINK logs rate fallback and bolt11 mismatches here - Test scripts:
/tmp/clink_e2e/(relay client simulation:run.mjs,diag.mjs,probe.mjs) - Browser console is the fastest way to see the exact client error