Search by

openreceive / magento2-module

openreceive

Accept Bitcoin Lightning payments in Magento Open Source with your own wallet and existing database. Optional USDT, USDC, SOL and ETH swaps settle as BTC over Lightning.

Package info

github.com/OpenReceive/openreceive-magento2

Homepage

Issues

Documentation

Type:magento2-module

pkg:composer/openreceive/magento2-module

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

v0.6.6 2026-11-29 19:28 UTC

This package is auto-updated.

Last update: 2026-11-29 19:29:08 UTC


README

Take Bitcoin Lightning payments in a Magento Open Source store, straight into your own wallet. The customer picks "Bitcoin Lightning" at checkout, places the order, and pays on the order's own pay page; the settled payment invoices the order and moves it to Processing, as Magento's offline capture would.

OpenReceive supports optional swaps from USDT, USDC, SOL, and ETH through a configured swap provider. The provider converts the payment to BTC over Lightning, which settles into the merchant's connected wallet. Available assets and networks depend on the provider; swaps are optional.

Magento owns customers, orders, prices and fulfilment. The module bundles the OpenReceive PHP engine, which keeps payment attempts in two tables of Magento's own database (openreceive_payments and openreceive_meta, declared in etc/db_schema.xml, so setup:upgrade creates them).

Docs and setup: Magento quickstart

Install

Requires Magento Open Source 2.4.7 or later (Luma checkout; tested on 2.4.8-p3), 64-bit PHP 8.2+ with GMP and sodium, and Magento's cron (bin/magento cron:install). Hyvä Checkout is not supported yet.

Install the release package with Composer, then, as the web server's user:

bin/magento module:enable OpenReceive_Payment
bin/magento setup:upgrade
bin/magento openreceive:configure --nwc-uri=- < /path/to/code-file
bin/magento openreceive:doctor

Or save the receive-only NWC code under Stores > Configuration > Sales > Payment Methods > Bitcoin Lightning (OpenReceive) and set Enabled to Yes. The code is stored encrypted, and only after the wallet answers as receive-only. In production mode, run setup:di:compile and setup:static-content:deploy as usual.

The source directory is not an installable package. A release is two Composer packages: this module, with the checkout's script in view/frontend/web/checkout, and openreceive/magento2-engine, which Composer installs with it: the OpenReceive engine and its dependencies with every namespace prefixed, because Magento 2.4 locks older versions of packages the engine needs.

How an order is paid

  1. Placing the order leaves it in Pending Payment and holds back the order email.
  2. The browser goes to the pay page, /openreceive/pay?order=<id>&token=<token>. The customer can come back to it from the order's page in their account or the guest order lookup until the order is paid.
  3. The checkout on that page talks to the engine's JSON routes under /openreceive/ (checkouts, payments/check, the swap routes). Writes need the session's Magento form key; the engine refuses cross-site requests and anything but JSON.
  4. When the payment settles, the order is invoiced (offline capture, the payment hash as the transaction id) and moves to Processing, in the same database transaction as the payment record. The order and invoice emails go out after that.

Magento's cron runs openreceive_reconcile every minute, which settles payments whose customer left the pay page. Magento cancels a Pending Payment order after "Pending Payment Order Lifetime" (480 minutes by default); the module keeps an order out of that cleanup while one of its payments may still settle, so a payment never lands on an order Magento canceled on its own. A payment that settles on an order the merchant canceled by hand is recorded on the order as a comment and listed by openreceive:doctor; the order stays canceled.

Commands

  • openreceive:configure --nwc-uri=- (or --lsc-uri-primary=-) saves a code read from stdin, encrypted, after the wallet answers as receive-only, and turns the payment method on.
  • openreceive:doctor checks the install and prints each code as set or unset.
  • openreceive:test-invoice <order id> makes a Lightning invoice for an order waiting for its payment, through the pay page's own route, and prints the pay page's link.
  • openreceive:reconcile runs the cron job's pass by hand.

Build and test

From the repository root, with Node 22+, PHP 8.3+ with GMP and sodium, and Composer:

npm ci
npm run build:packages
composer install --working-dir=packages/php/magento
node tools/release/magento-module.mjs build

This writes dist/openreceive-magento2-module-<version>.zip and dist/openreceive-magento2-engine-<version>.zip. composer install also writes the prefixed engine to vendor-prefixed/, which the unit tests (vendor/bin/phpunit) load. tests/e2e/run.sh installs the built package into Magento Open Source in Docker and pays an order with the test wallet.

License

MIT