Skip to main content

Invoice states

An invoice moves through this lifecycle:

PENDING โ†’ DETECTED โ†’ CONFIRMING โ†’ CONFIRMED โ†’ COMPLETED
โ”‚
โ””โ”€โ†’ EXPIRED (terminal, only from PENDING)
StateMeaning
PENDINGCreated, awaiting payment
DETECTEDPayment seen on chain (0+ confirmations)
CONFIRMINGAccumulating confirmations
CONFIRMEDEnough confirmations (โ‰ฅ20 on TRON, โ‰ฅ15 on BSC)
COMPLETEDWebhook delivered successfully (2xx response)
EXPIREDNot paid before expiry (default 30 minutes)

Terminal statesโ€‹

Only COMPLETED and EXPIRED are terminal. An invoice in either state will not change further and will not match any incoming on-chain payments.

State transitions are race-safeโ€‹

HelaMesh's blockchain poller runs every 15 seconds. State transitions use filtered findOneAndUpdate operations so concurrent pollers, webhook retries, and the expiry sweeper cannot race each other. Each transition is atomic and only fires when the current state is in the allowed set for the target state.