Track created outputs from new blocks which fund the scriptPubKeys your application knows about, removing them if they are reorged out, otherwise update the confirmation count if the chain is elongated by one block.
Once an output gains 6 confirmations, notify your application to process them further.
So, basically do you mean when the new block is created, I should start checking the pending transactions for their latest confirmation count?
Yeah, and I think if it has 6 confirmations already, the transaction will take place. The one you send will already reaceive the BTC you've sent or you will already receive BTC if someone sends BTC to you. You will be notified if the BTC was sent or received in your wallet.