user151: We are creating a payment processor. The business wants to send users a product when they receive a payment. This is easy enough using the cardano-wallet api. However, we were made aware of the existence of rollbacks on the chain. In the event of a rollback, what is the best practice for handling a change?
For example we may have detected a payment for 30 ADA. A rollback occurs, and that payment is removed from the chain history. How do we detect that this happened? How can we have confidence that a payment will not be rolled back before sending the customer the product?

user2629: In a perfect network setup rollbacks should not be happening. It is also down to your business decision of managing risks -- deep rollbacks are very rare but possibile nonetheless.
Shallow rollbacks (depth 1-3) do happen on occasion, perhaps once or twice a day. This happens because of the way the Praos protocol is selecting the block leaders and this relates to slot battles. Those are local rollbacks, most of the time happening to the cluster of nodes, not the whole network. This is considered to be a healty operation of the network.
Deeper rollbacks are happening less often (rare) and might be a sign of malevolent actor in the network.
Block is stable when it is securityParam (currently 2160) blocks deep. So to be 100% sure you might wish to wait for that number of confirmations.
refer to CIP-9 for details on securityParam
you might check the current value in cardano-node repo

151: <p>We are creating a payment processor. The business wants to send users a product when they receive a payment. This is easy enough using the <code>cardano-wallet</code> api. However, we were made aware of the existence of rollbacks on the chain. In the event of a rollback, what is the best practice for handling a change?</p>
<p>For example we may have detected a payment for 30 ADA. A rollback occurs, and that payment is removed from the chain history. How do we detect that this happened? How can we have confidence that a payment will not be rolled back before sending the customer the product?</p>
 2629: <p>In a perfect network setup rollbacks should not be happening. It is also down to your business decision of managing risks -- deep rollbacks are very rare but possibile nonetheless.</p>
<p>Shallow rollbacks (depth 1-3) do happen on occasion, perhaps once or twice a day. This happens because of the way the Praos protocol is selecting the block leaders and this relates to slot battles. Those are local rollbacks, most of the time happening to the cluster of nodes, not the whole network. This is considered to be a healty operation of the network.</p>
<p>Deeper rollbacks are happening less often (rare) and might be a sign of malevolent actor in the network.
Block is stable when it is <code>securityParam</code> (currently 2160) blocks deep. So to be 100% sure you might wish to wait for that number of confirmations.</p>
<p>refer to <a href="https://cips.cardano.org/cips/cip9/" rel="noreferrer">CIP-9</a> for details on <code>securityParam</code></p>
<p>you might check the current value in cardano-node <a href="https://github.com/input-output-hk/cardano-node/blob/master/configuration/cardano/mainnet-shelley-genesis.json#L67" rel="noreferrer">repo</a></p>
