DEV Community

Keshav Sharma
Keshav Sharma

Posted on Originally published at settlematic.com

Detecting invoice payments: watch the address, do not parse memos

Automatic detection is easy if each invoice owns an address. It is a research project if everyone pays the same wallet with a hope of a memo.

The only reliable matcher

balance(invoice_address) >= amount after your finality threshold, asset and chain matching the invoice. Dual-source if you are serious: your indexer plus a second RPC/provider, disagree → do not mark paid.

What does not work

  • Memo fields on chains that users’ exchanges strip
  • “First unpaid invoice in FIFO” against a pooled address
  • 0-conf because Slack is buzzing

Underpay / overpay

Partial USDC happens. Define whether you accept partials as a new state or wait. Overpays should not silently tip the vendor.

Implementation sketch

You do not need a custom chain crawler on day one. You need: unique address at issue, a watcher, idempotent status transitions, a signed webhook. Settlematic Collect is that watcher for our invoices. If you self-build, copy the state machine, not a random Etherscan poller in a cron.

Canonical: detect on-chain invoice payments automatically. settlematic.com

Top comments (0)