-
Notifications
You must be signed in to change notification settings - Fork 0
Development
D edited this page Aug 2, 2026
·
1 revision
# Install dependencies
npm install
# Build JS bundles
npm run build
# Watch for changes
npm run watchThree JavaScript bundles are built with esbuild (build.mjs):
-
assets/js/clink-checkout.js— uses@shocknet/clink-sdkto request Lightning invoices via the CLINK protocol on the order-received page. QR codes are generated client-side withqrcode-generator(no remote API). Built toclink-checkout.min.js. -
assets/js/clink-blocks.js— registers the gateway with WooCommerce Cart/Checkout Blocks viaregisterPaymentMethod(). Built toclink-blocks.min.js. -
assets/js/clink-price-converter.js— client-side price conversion fallback that converts.woocommerce-Price-amountelements to sats/BTC/₿ on all frontend pages. Ensures compatibility with price-display plugins like Custom Price for WooCommerce Pro. Built toclink-price-converter.min.js.
The release .zip ships the pre-built .min.js bundles, so consumers never need Node.js.
Checkout Flow:
Customer WooCommerce Nostr Relay Merchant Node
│ │ │ │
│── Place Order ───────────▶│ │ │
│ │── Create Order (pending) │ │
│ │── Redirect to thank-you │ │
│ │ │ │
│── Page Load ─────────────▶│ │ │
│ │── Localize noffer + sats │ │
│ │ │ │
│── JS: Decode noffer ──────┤ │ │
│── JS: Generate ephemeral │ │ │
│ Nostr key │ │ │
│── JS: Send kind:21001 ────┼──────────────────────────▶│── Request Invoice ─▶│
│ │ │ │
│ │◀── BOLT 11 Invoice ──────│◀─ Response ─────────│
│── Display QR code ◀──────┤ │ │
│── Customer pays ◀─────────┼──────────────────────────▶│ │
│ │ │── Receipt ─────────▶│
│◀── Receipt callback ──────┤◀──────────────────────────│ │
│── AJAX: mark_paid ───────▶│ │ │
│ │── Order complete ────────▶│ │
woocommerce-clink-gateway/
├── woocommerce-clink-gateway.php # Plugin bootstrap, AJAX handlers, scripts
├── includes/
│ ├── class-wc-gateway-clink.php # WC_Payment_Gateway implementation
│ ├── class-wc-clink-subscriptions.php # WooCommerce Subscriptions integration
│ └── class-wc-clink-blocks-support.php# Cart/Checkout Blocks support
├── assets/
│ ├── js/
│ │ ├── clink-checkout.js # Source — order-received page (ES module, @shocknet/clink-sdk)
│ │ ├── clink-checkout.min.js # Built bundle
│ │ ├── clink-blocks.js # Source — blocks checkout registration
│ │ ├── clink-blocks.min.js # Built bundle
│ │ ├── clink-price-converter.js # Source — client-side price conversion fallback
│ │ ├── clink-price-converter.min.js# Built bundle
│ │ └── clink-checkout.asset.php # Asset metadata
│ ├── css/clink-checkout.css # Checkout page styles
│ └── images/lightning-icon.svg # Payment method icon
├── build.mjs # esbuild config
└── package.json # NPM dependencies
- Bump the version in
woocommerce-clink-gateway.php,package.json, andreadme.txt(stable tag + changelog) - Rebuild the JS bundles with
npm run build - Rebuild the release
.zip(excludingnode_modules,.git, and build files) - Tag and create a GitHub release, then deploy trunk + tag to WordPress.org SVN