Payment Monitor
The PaymentMonitor is the component that watches for incoming DERO payments by polling the wallet RPC.
How It Works
- The monitor runs on a configurable interval (default: 5 seconds)
- Each poll calls
GetTransferson the wallet RPC - Incoming transfers are matched against pending invoices by payment ID
- When a match is found, the invoice transitions from
pending→confirming - The monitor continues tracking until the required number of confirmations is reached
- Once confirmed, the invoice moves to
completed
Configuration
The payment monitor is managed by the InvoiceEngine — you typically don't create one directly. Configuration is passed through the engine:
const engine = new InvoiceEngine({
walletRpcUrl: "http://127.0.0.1:10103/json_rpc",
daemonRpcUrl: "http://127.0.0.1:10102/json_rpc",
// Monitor-specific options
pollInterval: 5000, // How often to check (ms)
confirmationsRequired: 1, // Blocks to wait after detection
});Confirmations
DERO's DAG-based block structure means confirmations work differently than linear blockchains:
- 1 confirmation (default) — The transaction is included in a block
- Higher values — More blocks have been mined since inclusion
For most use cases, 1 confirmation is sufficient on DERO. The encrypted transaction model and DAG structure make double-spend attacks significantly harder than on transparent chains.
Partial Payments
If a customer sends less DERO than the invoice amount:
- The invoice transitions to
partialstatus - The received amount is tracked
- The monitor continues watching for additional payments
- If the total reaches the invoice amount, it moves to
confirming→completed - If the expiry window closes first, it moves to
expired(with the partial amount recorded)