Accept Bitcoin & Stablecoin Payments With Sylius

Sylius quickstart

Sylius is an open-source e-commerce framework on Symfony. The OpenReceive plugin adds a payment method to it: the customer pays with Bitcoin over Lightning, straight into your own wallet, on the shop’s own pay page. 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.

Sylius keeps owning customers, orders, prices and shipping. The plugin keeps its payment attempts in two tables of Sylius’s own database. When a payment settles, it applies Sylius’s own complete transition to the order’s payment, in the same database transaction that settles the payment, so Sylius moves the order’s payment state to “Paid” and runs its usual listeners.

Requirements: Sylius 2.2 or 2.3 (Sylius 2.3 needs PHP 8.3) on MySQL, MariaDB or PostgreSQL, with 64-bit PHP 8.2 or later and the gmp, sodium and mbstring extensions besides what Sylius needs. A cron job runs the plugin’s reconcile pass, as below.

The plugin uses Sylius 2’s payment requests, not Payum. It runs on the OpenReceive Symfony bundle, which serves the checkout’s routes and the settlement engine.

Install the plugin

composer require openreceive/sylius-plugin

Register both bundles in config/bundles.php:

OpenReceive\Symfony\OpenReceiveBundle::class => ['all' => true],
OpenReceive\SyliusPlugin\OpenReceiveSyliusPlugin::class => ['all' => true],

Import the plugin’s configuration and routes:

# config/packages/openreceive_sylius.yaml
imports:
    - { resource: "@OpenReceiveSyliusPlugin/config/config.yaml" }
# config/routes/openreceive_sylius.yaml
openreceive_sylius:
    resource: "@OpenReceiveSyliusPlugin/config/routes.yaml"

Then create the two OpenReceive tables (the plugin’s migration runs after Sylius’s own) and publish the checkout’s script and stylesheet:

bin/console doctrine:migrations:migrate
bin/console assets:install

Configure the wallet

In the admin, open Configuration > Payment methods > Create and choose Bitcoin Lightning (OpenReceive). Paste a receive-only NWC code (get one), enable the method on your channels, and save. The form checks the code with your wallet before saving it: a code that cannot make invoices, or one that can also spend, is refused.

Sylius encrypts the code in the database with its payment encryption key (bin/console sylius:payment:generate-key makes one if your shop has none), and the form never shows it again. Leave the field blank to keep the saved code. The optional swap provider codes go in the same form (set up a swap provider).

The first enabled OpenReceive method, by position, holds the shop’s wallet. Without a code there, NWC_URI, LSC_URI_PRIMARY and LSC_URI_BACKUP from the environment apply.

The cron job

Every request the checkout makes runs one reconciliation pass, so a customer who stays on the page sees the order paid within seconds. A customer who pays and closes the page is settled by the next pass. Add one to cron, so that order does not wait for another customer:

* * * * * cd /path/to/shop && bin/console openreceive:reconcile

The optional bin/console openreceive:notifications worker settles within a second of payment. Run one per shop, not one per web server.

Check it

bin/console openreceive:doctor
bin/console openreceive:test-invoice <order id>

The doctor reports the wallet code as set or unset (it never prints it), the routes, and the wallet’s receive-only check. test-invoice makes the Lightning invoice for an unpaid order through the checkout’s own route.

How a payment works

Refunds and removal

The receive-only wallet cannot send refunds. Send a refund from your own wallet; Sylius’s refund action does not send bitcoin. A customer whose swap deposit never converted reclaims it from the order’s pay page, which resumes the order’s live checkout. 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 plugin keeps the two tables, which are a record of payments received.

The payment method must not use Payum. The admin form sets that for this gateway; a method created by fixtures or the API needs usePayum: false.

Tested, and not tested

Tested on 2026-11-28 with Sylius 2.3.3 on MariaDB 11.4, the demo fixtures and the built storefront, and a test wallet on a live relay: in Chromium, a customer checking out with OpenReceive through Sylius’s own checkout steps; the pay page making the invoice; the payment settling; and the order reading payment state “paid”, with its payment and both payment requests completed. The plugin’s PHPUnit suite (31 tests) runs Sylius’s test application on PHP 8.2, 8.3 and 8.4 over the engine’s fake wallet.

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. A customer picked USDT on Solana on the 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 read payment state “paid”. A second customer’s swap, which the provider reported underpaid, was refunded to a Solana address from the checkout, and that order stayed “awaiting payment”.

Not tested: a real swap provider, the other swap coins and networks, PostgreSQL, multi-channel shops with different currencies on a live relay, an asynchronous Messenger transport for payment requests, and updating from an older release of the plugin.

Next