Help centre / Rewards and postbacks
A user was credited twice
The same message can arrive more than once. Remember each reward by its transaction id and status, and handle it only once.
A postback can reach your server more than once: when your server answered too slowly the first time, when it did the work and then answered with an error, or when someone pressed Send again in the postback log. That is on purpose. A message that arrives twice is harmless. A message that is lost is not.
The fix
Every reward has a transaction id. Before you change a balance, look up whether you already handled this transaction id with this status. If you did, answer with success and change nothing.
Why the status belongs to it
A reversal carries the same transaction id as the completion it takes back. If you only remember the id, the reversal looks like something you have already seen, and the reward is never deducted. Remember the two together.
Always answer with success
Also for a message you have handled before. As long as your server answers with an error, we keep trying.
Sample code is in Postbacks.