Blockonomics
Accept Bitcoin payments in Medusa v2 through Blockonomics, straight to the merchant's own wallet.
@blockonomics/medusa-payment-blockonomics
Accept Bitcoin in Medusa v2 through Blockonomics. Payments go straight to your own wallet: each checkout gets a fresh address, and Blockonomics notifies Medusa as the transaction confirms.
Blockonomics never holds funds, so refunds are manual. See Refunds.
Requirements
- Medusa or later
- A Blockonomics account with a store and a wallet (xPub) attached
- A Medusa server reachable from the internet, for callbacks
Install
Configure
1. Register the plugin and the provider
Both entries are required. Without the entry, callbacks return and no payment completes.
Generate the callback secret in your project and add the printed line to with your API key:
The secret must start with . It is yours, not issued by Blockonomics.
2. Set the callback URL in Blockonomics
In the Blockonomics dashboard, under Stores, set the store's callback URL to:
https://your-store.com/hooks/blockonomics/blockonomics_blockonomics?secret=YOUR_CALLBACK_SECRETThe path is , where is the provider . Callbacks with a wrong secret are ignored, so a typo leaves orders unpaid without any error.
3. Enable the provider in a region
In the Medusa admin, under Settings โ Regions, add Blockonomics () to the region.
Options
Required
- : your Blockonomics API key.
- : the secret in the callback URL. Starts with .
Optional
- (default ): confirmations needed before an order is paid. takes about 10 min, about 20 min. risks double-spends.
- (default ): how long the BTC quote stays valid, from 300 to 1800.
- (default ): how much of a shortfall still counts as paid. = 1%.
- (default ): how much excess is allowed before the order is flagged as overpaid.
- : part of the store's callback URL. Needed if your account has more than one store, otherwise you get error .
- (default ): the API base URL. Only change it for testing.
Orders
- A transaction is seen: the order is placed with payment status Awaiting.
- It reaches and covers the amount: Captured. Only fulfil captured orders.
- Underpaid: the order stays Awaiting. The remainder is quoted on a new address.
- Overpaid: the order is captured, and the admin order page shows the amount received with an Overpaid flag. Refund the difference from your wallet.
- Never confirms: the order stays Awaiting. Cancel it in the admin.
Storefront
There is no hosted payment page. Your storefront renders the payment from the session's . is a complete payment screen in plain JavaScript that you can port.
Key fields: , , , , , (Unix ms), ( none, in progress, settled), , , (all addresses for the session).
The page should:
- Show a QR code for and count down to .
- When the quote expires, or after an underpayment confirms, call the re-quote route below. Do not create a new payment session.
- Listen on to detect the payment.
- Poll the cart until is set. Callbacks complete the order, so don't complete the cart from the storefront.
Re-quoting
This refreshes the amount once the price lock has expired. If the session has a settled underpayment, it returns a new for the remainder.
Refunds
Bitcoin payments are irreversible, and refunds cannot go through the provider. Refund in the Medusa admin throws an error. Send refunds from your wallet and record them outside Medusa.
Testing
- Expose your server (e.g. ngrok) and point the store's callback URL at it.
- Enable Testmode on the store in Blockonomics.
- Check out with Blockonomics, then send the amount from the Test Bench.
Callbacks arrive with status right away, after about 5 minutes and after about 10.
To test without a storefront:
License
MIT

