Search by

openreceive / shopware-plugin

openreceive

Accept Bitcoin Lightning payments in Shopware 6 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-shopware

Homepage

Issues

Documentation

Type:shopware-platform-plugin

pkg:composer/openreceive/shopware-plugin

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

v0.6.6 2026-11-29 18:55 UTC

This package is auto-updated.

Last update: 2026-11-29 19:12:18 UTC


README

Add a Bitcoin Lightning payment method to your Shopware 6 shop and receive payments directly into a wallet you control. The customer places the order in Shopware's own checkout and pays on the order's pay page; the order's payment moves to Paid when the Lightning invoice settles. There is no payment processor account and no second database: OpenReceive keeps its payment attempts in Shopware's own database, and Shopware keeps its orders, customers, prices and fulfillment.

This plugin is the Shopware side of the integration. Composer installs the OpenReceive PHP engine (the checkout's routes, the settlement engine) next to Shopware's own packages, and the plugin adds the payment method, the pay page, the settings, the console commands and the bridge that moves a paid order through Shopware's own state machine.

Docs and setup: openreceive.org/integrations/shopware

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.

Requirements

  • Shopware 6.6 (6.6.5 or later) or 6.7, with the Storefront; tested end to end on 6.7.16.2 and 6.6.10.32 with MariaDB 11.4.
  • 64-bit PHP 8.2 or later with ext-gmp and sodium, besides what Shopware needs.
  • Shopware's scheduled tasks running (bin/console scheduled-task:run and messenger:consume, or the admin worker), for the settlement backstop.
  • A receive-only NWC code from your wallet (get one).

Install

In a Composer-managed shop:

composer require openreceive/shopware-plugin
bin/console plugin:refresh
bin/console plugin:install --activate OpenReceivePayment
bin/console cache:clear

A plugin placed in custom/plugins/OpenReceivePayment (an uploaded ZIP) ships no vendor/: when Shopware installs it, it runs composer require openreceive/shopware-plugin itself (executeComposerCommands), so the engine and its dependencies resolve against the versions your shop already locks. Uninstalling it through Shopware runs composer remove the same way.

Installing makes the payment method Bitcoin Lightning (switched off) and the engine's two tables, openreceive_payments and openreceive_meta (a plugin migration running the engine's own MySQL schema).

Configure

In the admin, open Extensions > My extensions > Bitcoin Lightning (OpenReceive) > Configure, paste the receive-only NWC code under All Sales Channels, and save. The plugin checks the code with your wallet before Shopware stores it: a code that cannot make invoices, or one that can also spend, is refused and nothing is saved. The code is stored encrypted (sodium secretbox, under a key derived from the shop's APP_SECRET), so the system_config row alone never reveals it. Saving a code switches the payment method on; then offer it in your sales channels under Sales Channels > Payment and shipping.

Or from the console, with the code read from stdin (never as an argument):

bin/console openreceive:configure --nwc-uri=- < /path/to/nwc-code-file
bin/console openreceive:configure --lsc-uri-primary=- < /path/to/swap-code-file   # optional
bin/console openreceive:doctor

openreceive:configure runs the same check, switches the method on and offers it in every storefront and headless sales channel that does not offer it yet (--no-sales-channels skips that). It prints only whether a code was saved.

Keep APP_SECRET stable: a code sealed under one secret cannot be read under another, and the doctor says so; save the code again after changing it.

How it works

  • The reference is the order's id. It exists before checkout, survives every retry and every change of payment method, and is never reused, so an order is paid once. A second invoice for a paid order is refused.
  • Paying. The plugin's payment handler (Shopware's AbstractPaymentHandler) sends the customer from checkout to the order's pay page, /openreceive/pay/<deep-link code>, on the storefront domain the order was placed on. The page shows the <openreceive-checkout> element, which makes the Lightning invoice (or a swap) through POST /openreceive/checkouts, shows it, and watches it settle. The page shows no order total beside the checkout: the checkout shows the one amount to send.
  • The price is Shopware's. The invoice is for the order transaction's total, in the order's currency, converted at the current BTC price. It is made only while that transaction, this method's, waits for its payment (open, unconfirmed, in progress or reminded) and the order is not cancelled.
  • Who may pay. The signed-in customer who placed the order (a guest checkout signs the guest in for the session), or a browser the pay page was opened in with the order's deep-link code, the secret Shopware puts in the order's own links and mails. The checkout's JSON routes under /openreceive accept JSON only and refuse cross-site requests.
  • Settlement. When the invoice settles, the engine's settlement transaction, on Shopware's own DBAL connection, applies Shopware's paid transition to the order transaction through OrderTransactionStateHandler and records the payment hash in the transaction's custom fields (openreceive_payment_hash). Shopware's DAL writes join that transaction, so the payment row and the order transaction commit together, or roll back together for the next pass. Shopware's flows on "payment state paid" (its mails) run as for any other payment method.
  • Settlement discovery. Every request the checkout makes runs one reconciliation pass, so a customer who stays on the page sees the order paid within seconds. The scheduled task openreceive.reconcile (every minute) covers customers who leave.
  • Repair. A settled payment whose transaction could not move then (a state machine changed to have no paid transition from its state, say) is finished by the scheduled task, by openreceive:reconcile, when the customer comes back to the pay page, and on Shopware's finalize step.
  • Cancelled orders. An order someone cancelled, or whose payment moved to another method, is never moved. The payment is in the wallet and in openreceive_payments, the log says so, and openreceive:doctor lists the order.
  • Coming back. The transaction stays open until the invoice settles, so Shopware's own "complete payment" button on the customer's order page leads back to the same pay page and the same invoice. Once paid, the pay page continues to Shopware's finish page (through its return URL while that is valid, else to the order's own page).
  • Codes. The NWC code and the optional swap provider codes (lscUriPrimary, lscUriBackup) live in the plugin's configuration, encrypted. Codes never reach the browser, the log or the admin in plain text.

Commands

Command What it does
openreceive:configure Saves a code read from stdin (--nwc-uri=-, --lsc-uri-primary=-, --lsc-uri-backup=-; --remove-lsc), encrypted and checked, switches the method on and offers it in the sales channels
openreceive:doctor The codes (set/unset only), the payment method and its sales channels, the tables, the checkout files, the wallet's receive-only check, the price feed, swap providers and the backstop; --no-wallet skips the network
openreceive:test-invoice <order number> Makes the Lightning invoice for an order waiting for its Bitcoin Lightning payment, through the checkout's own route, and prints the pay page
openreceive:reconcile The scheduled task's pass by hand: checks pending payments with the wallet and marks settled orders paid

Limits

  • One wallet per shop: the codes hold for every sales channel.
  • Refunds are made from your wallet; Shopware's refund action does not send bitcoin (the handler declares no refund support).
  • A swap that arrives short or late is refunded from the order's pay page, which resumes the order's live checkout. See Swap refunds before you set a swap provider code.
  • The pay page is a Storefront page. A headless frontend sends the customer to the redirectUrl Shopware's handle-payment route returns, which is that page on the order's storefront domain.

Tests

composer install
vendor/bin/phpunit

The suite needs no Shopware install: it runs the plugin's own classes and the real engine over the engine's fake wallet and a static price, on SQLite tables shaped like Shopware's (and on MySQL too when OPENRECEIVE_TEST_MYSQL_DSN, OPENRECEIVE_TEST_MYSQL_USER and OPENRECEIVE_TEST_MYSQL_PASSWORD are set).

tests/e2e/run.sh runs a whole Shopware shop in Docker (the official project template on MariaDB), installs the plugin from custom/plugins the way an uploaded ZIP is installed, and pays a guest order placed through the storefront in Chromium against a test wallet; then a payment settled by the scheduled task after the customer left, and one on an order the merchant cancelled.

License

MIT