What is the best way to implement withdrawal in online service? Suppose we have a service, which holds user balance in Bitcoin.

How to implement withdrawal from bitcoin perspective?

Which RPC call to use? How to archive transaction to have a proof of sending money to user? How to prevent duplicate money send in corellation to SQL transaction?

The most important thing is to prevent dual-submission having in mind power loss at any time. So we should have a way to mark some money as "possible sended" + some way to check in future time if it really was succesfuly sended and stored in blockchain.

(note that I am not asking about security, ACID transaction itd. I am interested in a way to comunicate with wallet daemon service)
As far as I know, there is no third-party ID could be associated with a bitcoin transaction. This means, if the power goes down, you would not be able to determine if the transaction "made it" by looking at block chain for the sender and recipient wallets.

But wallets and transactions are cheap. So you can create a pool of wallets and then intelligently rotate them making sure you lock on one until the entire transaction is complete and confirmed with public records. Then based on exclusivity of access you can determine BTC transaction hash for your system transaction record.

To take this idea to the extreme, you could create a new wallet for every amount you want to send, and use this wallet to identify the only one outgoing transaction.

Hope this would help,
Alex