Overview
Icon for OpenReceive

OpenReceive

Bitcoin Lightning payments to your own wallet

@openreceive/medusa

Take Bitcoin Lightning payments in Medusa, straight into your own wallet. The buyer pays at the storefront's checkout, and the order is placed once the payment settles.

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.

Medusa keeps carts, orders, prices and customers. The plugin keeps payment attempts in two tables of Medusa's own database, and a settled payment is captured and its cart completed through Medusa's own process-payment workflow, even when the buyer has left the page.

Docs and setup: Medusa quickstart

Install

Requires Medusa 2 on Node 22.12 or later, with Medusa's PostgreSQL database. This package is ESM-only.

npm install @openreceive/medusa

In Copy to clipboardmedusa-config.ts:

plugins: [{ resolve: "@openreceive/medusa", options: {} }],
modules: [
{
resolve: "@medusajs/medusa/payment",
options: {
providers: [{ resolve: "@openreceive/medusa/providers/openreceive", id: "openreceive" }],
},
},
],

Then, with Copy to clipboardNWC_URI (and optionally Copy to clipboardLSC_URI_PRIMARY) in the Medusa server's Copy to clipboard.env:

npx medusa db:migrate
npx medusa exec ./node_modules/@openreceive/medusa/dist/enable-openreceive.js
npx openreceive doctor

Copy to clipboarddb:migrate creates the two tables, the Copy to clipboardexec script offers the provider (Copy to clipboardpp_openreceive_openreceive) in every region, and Copy to clipboarddoctor checks the codes and the wallet. The storefront shows the checkout from Copy to clipboard@openreceive/react; the quickstart has the code for Medusa's Next.js starter.

What the plugin adds

  • A payment provider: a session is captured once its payment settles in the wallet, and Medusa refuses to complete the cart before that. A refund made in the admin is recorded only; send it from your own wallet.
  • The checkout's routes under Copy to clipboard/store/openreceive, behind Medusa's publishable API key.
  • A job every minute that finds a payment whose buyer left the page and has Medusa place the order.
  • A migration script that creates Copy to clipboardopenreceive_payments and Copy to clipboardopenreceive_meta.

Part of OpenReceive. MIT licensed.

You may also like

Browse all integrations

Build your own

Develop your own custom integration

Build your own integration with our API to speed up your processes. Make your integration available via npm for it to be shared in our Library with the broader Medusa community.

gift card interface

Ready to build your custom commerce setup?