简体   繁体   中英

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 users 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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM