Just to be clear (Sorry if this is obvious...) a sent transaction uses both inputs and outputs to create the transaction. If you want to track the sent transaction you need to track the TxIns and TxOuts.
See - https://en.bitcoin.it/wiki/Transactions
By sending I mean I'm the creator of the transaction.
Costamonger has posted a workable solution, but this still seems a little convoluted.
2.) Track the presence of that output at your new address. (Through a callback for instance)
3.) Did the bitcoin arrive?
- If yes, then congratulations, you can be sure that the funds involved were delivered
- If no, then neither your funds or the customers withdrawal were successfully sent out to begin with.
If for whatever reason an attacker tried to manually spend or fake-double spend bitcoin back to your new address as a "trick," all they've accomplished is an action that forces your system to mark their withdrawal as successful.