Facebook Credits API PHP - Update user_id in mySql database after purchase
I have an app where I want users to be able to buy in-game credits called coins.
I have set my callback url, and can make a purchase, I get an order_id and settled from the callback, but how do I update the use开发者_StackOverflowrs row in my mySql database after they have made the purchace.
Kinda how my mySql DB looks
ID......FBID............Name..........Coins
7.......1000***797....John..............0
After the user has bought 200 coins for 1 credit, I would like to do this
$SQL = "UPDATE tb_users SET Coins = Coins+200 WHERE FBID = '$usernumber'"; $result = mysql_query($SQL);
But how and where am I supposed to do that? Is it in the callback.php file or in the index.php file after "var callback = function(data)".
I can't seem to pass the user_id from the form on the index to callback.php
So how do I do that, and if that is possible, am I supposed to update my database in the callback.php file??
Nevermind found this out. You can get the info about the user via API the normal way and update the DB in callback.php after "settled".
精彩评论