Everything we have written about onchain engineering.
Onchain payments are only final after confirmations, due to the risk of reorgs. This post explains how to track payment status, with code and real examples.