1.Avoid remote 3rd party API calls.Write your own Json parser from scratch.
2.Yet the most easiest way to protect it,accept bets with only 2 or more confirmations.
3.I believe there is a C++ module which is available for free which can help prevent double spends within a certain broadcasting time of the transaction.
link please to module