Back to catalog

Developer catalog

Monero checkout example

One subaddress per order, a view-only wallet with no spend key anywhere, paid after N confirmations, handles late, double and suspicious payments.

Built, MIT license

TypeScriptNode.jsmonero-wallet-rpcSQLite

What it does

A small example server that accepts Monero for orders. One subaddress per order. A view-only wallet watches for incoming payments. An order is marked paid after a confirmation count you choose. It handles late payments, double sightings and double-spend flags. This is example code, not a production payment processor.

How it works

  • POST /orders creates a subaddress labelled with the order id and returns the address and amount.
  • A background poller calls get_transfers for the subaddresses of open orders and recomputes each order's totals from that response alone.
  • The wallet is view-only: created from the address and private view key, with no spend key. This server can see incoming payments but cannot move funds.
  • An append-only audit log records every transfer seen. It is never used to decide a status.
  • Expired orders are still polled for late payments. A payment to an expired order moves it to seen or paid and sets late: true.
  • Transfers the wallet flags double_spend_seen never count. They are counted in double_spend_flagged so you can look at them.

Guardrails and design choices

  • The wallet is view-only. No spend key, seed, or private key appears anywhere in the repository.
  • This is example code, not a production payment processor.
  • POST /orders has no authentication. It must sit behind your own backend and is not for direct exposure to the internet.
  • The server binds to 127.0.0.1 by default.
  • Not audited. Unit-tested against a stub of monero-wallet-rpc and run end to end on a private regtest chain.

Status

Built. Run end to end on regtest with the real monerod and monero-wallet-rpc. Not yet run on stagenet or any public network. Not reviewed by a third party.