Facebook Credits - Getting error code 13 when trying to get credit balance

半腔热情 提交于 2020-01-15 20:17:06

问题


I'm trying to get a user's credit balance with this code:

$obj = json_decode( 
     file_get_contents('https://api.facebook.com/method/users.getStandardinfo'.
                       '?uids='.$facebook_uid.'&fields=credit_balance&access_token='.
                       ''.$access_token.'&format=json'));

I get error code 13 with this message:

The underlying FQL query made by this API call has encountered the following error: credit_balance is not a member of the user table.","request_args".

I've approved for credits in my game a lot of places and 95% sure on, that I've been accepted.

What to do?


回答1:


Simon, if you have re-authenticated the user and retried then it is likely an issue on our end. Can you post your application ID and I will take a look.




回答2:


I had the same problem. There are couple of things you need to do to get facebook credit balances in your app.

  1. Get your App whitelisted by Facebook so you can call this API.
  2. Use the code below to get the credit balances.

Facebook's own documentation didn't work either. (No surprise there) Instad I used the code below.

$accessTokenURL = 'https://graph.facebook.com/oauth/access_token&client_id=' .$app_id .'&client_secret=' .$secret .'&grant_type=client_credentials';
$accessToken = file_get_contents($accessTokenURL);

$creditsInfoURL = 'https://api.facebook.com/method/users.getStandardinfo?fields=credit_balance&format=json&uids=' .$query_uid.'&' .$accessToken;
$creditsInfo = file_get_contents($creditsInfoURL);
list($creditsArray) = json_decode($creditsInfo, true);

$fbcredbalance = 0;

if(isset($creditsArray['credit_balance'])) {
    $fbcredbalance = $creditsArray['credit_balance'];
}


来源:https://stackoverflow.com/questions/6563678/facebook-credits-getting-error-code-13-when-trying-to-get-credit-balance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!