问题
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.
- Get your App whitelisted by Facebook so you can call this API.
- 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