1

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?

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
Simon Thomsen
  • 1,351
  • 7
  • 27
  • 37

2 Answers2

0

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.

bkaid
  • 51,465
  • 22
  • 112
  • 128
DSchultz
  • 1,335
  • 6
  • 15
0

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'];
}
Suneth Mendis
  • 63
  • 1
  • 7