Accept Bitcoin & Stablecoin Payments With Magento
Magento quickstart
The OpenReceive module adds a payment method to Magento Open Source: the customer picks “Bitcoin Lightning” at checkout, places the order, and pays on the order’s own pay page, straight into your own wallet. With a swap provider, the same page also takes USDT, USDC, SOL and ETH, which the provider converts to BTC over Lightning into the same wallet. The settled payment invoices the order and moves it to Processing, as Magento’s offline capture would.
Magento keeps owning customers, orders, prices and fulfilment. The module
keeps its payment attempts in two tables of Magento’s own database
(openreceive_payments and openreceive_meta, declared in its
etc/db_schema.xml, so setup:upgrade creates them).
Requirements: Magento Open Source 2.4.7 or later with the Luma checkout, on
64-bit PHP 8.2 or later with GMP and sodium, and Magento’s cron
(bin/magento cron:install). Hyvä Checkout is not supported yet. Already run
BTCPay Server? Magento via BTCPay Server is the other route.
Install the module
composer require openreceive/magento2-module
bin/magento module:enable OpenReceive_Payment
bin/magento setup:upgrade
Composer installs a second package with it, openreceive/magento2-engine:
the OpenReceive engine and its libraries with every namespace prefixed,
because Magento 2.4 locks older versions of libraries the engine needs. In
production mode, run bin/magento setup:di:compile and
bin/magento setup:static-content:deploy as after any module.
Run every bin/magento command as the web server’s user, never as root.
Configure the wallet
Save a receive-only NWC code (get one) from the command line, reading it from a file so it never appears in a shell argument:
bin/magento openreceive:configure --nwc-uri=- < /path/to/code-file
Or paste it under Stores > Configuration > Sales > Payment Methods >
Bitcoin Lightning (OpenReceive) and set Enabled to Yes. Either way the
module asks the wallet first, and saves the code encrypted with Magento’s own
key only when the wallet answers as receive-only. A code that can also spend
is refused. The optional swap provider code goes in the same place
(--lsc-uri-primary=-;
set up a swap provider).
The codes are store-wide (the default scope).
The cron job
Magento’s cron runs the module’s openreceive_reconcile job every minute. It
settles payments whose customer closed the pay page before the payment
arrived. Make sure Magento’s cron is installed (bin/magento cron:install);
bin/magento openreceive:reconcile runs the same pass by hand.
Check it
bin/magento openreceive:doctor
bin/magento openreceive:test-invoice <order id>
The doctor checks the install and prints each code as set or unset, never the
value. test-invoice makes the Lightning invoice for an order waiting for
its payment, through the pay page’s own route, and prints the pay page’s
link.
How a payment works
- Placing the order leaves it in Pending Payment and holds back the order email.
- 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. The success page links it too. - The checkout on that page talks to the engine’s JSON routes under
/openreceive/. Writes need the session’s Magento form key; the engine refuses cross-site requests and anything but JSON. The invoice is for the order’s grand total in the order’s currency, converted at the current BTC price, and only while the order is Pending Payment. - 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 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.
Refunds and removal
The receive-only wallet cannot send refunds. Send a refund from your own wallet, then record a credit memo in Magento. A customer whose swap deposit never converted reclaims it from the order’s pay page, while the order is unpaid. If you turn on swaps, you commit to keeping that path available. See swap refunds.
Disabling the payment method hides it at checkout. Removing the module keeps the two tables, which are a record of payments received.
Tested, and not tested
Tested on 2026-11-28 with Magento Open Source 2.4.8-p3 in production mode, MariaDB 11.4 and OpenSearch 2.19 in Docker, and a test wallet on a live relay: a guest order placed through the REST API, left in Pending Payment with its email held; a write without the form key refused and a wrong pay-page token refused; the pay page making the invoice; the payment settling; and the order reading Processing, with a paid invoice carrying the payment hash. In Chromium, a Luma checkout placed a second order, went to the pay page, and reached Processing the same way. The cleanup of expired Pending Payment orders and a hand-canceled order behaved as above.
Swaps were tested the same way against a test swap provider, a fake of the
provider’s API that moves no funds, saved with openreceive:configure. In
Chromium, a guest picked USDT on Solana on an order’s pay page and the deposit
screen showed one amount, the USDT to send. The provider completed the swap,
the swap’s Lightning invoice settled, and the order reached Processing with a
paid invoice carrying the swap’s payment hash. A second order’s swap, which
the provider reported underpaid, was refunded to a Solana address from the
checkout, and that order stayed in Pending Payment.
Not tested: a real swap provider, the other swap coins and networks, Adobe Commerce, multi-store installs with different currencies, Hyvä Checkout, Magento 2.4.7, PHP 8.2, and updating from an older release of the module.