Use Hono for lightweight services and keep 4Mica payment handling in the Node layer that owns your paid route. The stable 4Mica server integration is Express middleware, so mount it beside your Hono app when the paid route needs automatic verify and settle behavior.
This integration is not stable yet. For now, use the
NodeJS quick start for the supported implementation.
Prerequisites
Node.js 18 or later.
A Hono service running on Node.
A seller wallet address for payTo.
A buyer wallet with deposited collateral for testing paid calls.
Use the private key only for buyer-side signing in trusted server-side code.
Use PAY_TO as the seller address advertised by protected routes.
Deposit collateral
Deposit collateral for the buyer wallet before it calls your Hono service. Use the same network in the buyer scheme and route payment requirements.To learn more about collateral setup, see Deposits and Withdrawals.
Protect a route
Run your paid API route through the 4Mica middleware and keep the rest of your service in Hono.