(Note · · 6 min read)

You delivered the goods and the payment never confirmed

A crypto payment looks simpler than a card payment: the money either moved or it did not. The difficulty is in deciding when it moved, because a transaction has several states that all look like success from a distance, and acting on the wrong one means giving away whatever you were selling.

By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka

Submitted, mined and settled are three things

A transaction broadcast to the network is a request. Included in a block, it has happened — subject to that block remaining part of the chain. Only after enough subsequent blocks is it safe to treat as final.

Delivering on a transaction hash alone is the common mistake. A hash proves somebody constructed a transaction, nothing more: it may never be included, or be replaced by one with a higher fee, or be included in a block that is later discarded.

Wait for confirmations, and pick the number deliberately

How many blocks to wait depends on the chain's own finality behaviour and on the value at stake. The right number is the one you chose with a reason, documented, rather than a default copied from a tutorial about a different chain.

Scale it with value where the product allows. Fast delivery for a small purchase and more patience for a large one is a legitimate trade-off, and a far better one than picking a single number that is simultaneously too slow for small buyers and too risky for large ones.

Verify the transfer, not just the transaction

A successful transaction is not necessarily a payment to you. Check, against the chain rather than against what the client told you: the token contract, the recipient address, the amount, and that the transaction did not revert.

For a token transfer, read the event the contract emitted rather than the call's input, which is what the sender asked for rather than what happened. A failed transfer still appears on chain, and a transaction can succeed overall while the transfer within it did not.

Treat an unexpected amount as a failure requiring a person, not as something to interpret. Underpayment by a fraction is a support case; it is not an invitation for code to guess.

Watch, do not ask once

Subscriptions drop and nodes fall behind. Rely on polling from the last block you processed, so a gap is filled rather than skipped, and treat any push notification as a hint to check sooner.

Record the last processed block and resume from it. A watcher that resumes from the current tip after a restart silently misses every payment that arrived while it was down, and nothing reports an error.

One payment, delivered once

The same transaction will be seen repeatedly: by the poller, by a notification, by a reorganisation re-including it. Key the fulfilment on the transaction hash with a unique constraint so a repeat cannot deliver twice.

Hold the goods only once the payment is confirmed, and reserve them while awaiting it. On a gift card shop I built where codes are delivered as soon as payment clears, that reservation is what stops two buyers racing for the last code while both payments are pending.

Decide what happens when it does not clear

Payments arrive late, partially, or not at all. Define the expiry, release the reservation when it passes, and make the state visible to the buyer rather than leaving a page saying pending with no explanation.

And offer a route for a payment that arrives after expiry, because it will. The alternative is a buyer who has demonstrably paid and a system with no way to acknowledge it.

Common questions

When is a crypto payment safe to act on?

After enough subsequent blocks have been added that the including block is unlikely to be discarded. A transaction hash only proves someone constructed a transaction — it may never be included, may be replaced by a higher-fee version, or may be in a block that is later dropped.

How many confirmations should I require?

A number you chose with a reason, based on the chain's finality behaviour and the value at stake, rather than a default copied from a tutorial about a different chain. Scaling with value beats one number that is too slow for small buyers and too risky for large ones.

What should be verified about an incoming payment?

Against the chain, not the client: the token contract, recipient address, amount, that the transaction did not revert, and the event the contract emitted rather than the call's input. A transaction can succeed overall while the transfer inside it failed.

How do I avoid missing payments?

Poll from the last block you processed and record that position, so a restart resumes rather than jumping to the current tip. Treat push notifications as hints to check sooner, and key fulfilment on the transaction hash with a unique constraint so repeats cannot deliver twice.

Need something like this built?