Menu

Buzz API Documentation, References & Code Examples

Supported Methods

The current version of the Buzz API supports GET, POST and JSON methods.

Supported Actions

GET

Retrieve a users current Buzz balance.

CREDIT

Add Buzz to a users current balance.

DEBIT

Deduct Buzz from a users balance.

PAY

Transfer Buzz from one user to another.

 

Identifying Users

The remote api uses email addresses to identify users. This means that the user registered on site A must have registered with the same email address on site B in order for us to be able to get their balance from the other site.

 

Security Token

To prevent users to execute mischievous requests on your sites, each request must contain a security token. This security token is a md5 hash of the request combined with the secret key that you have to setup in order to use the API.

 

Action: GET

The GET action allows you to query a specific users balance.

You can use this to display a users balance from another site or to sync two or more sites to always have the same point balance. In order to query a users balance, you must provide the users email address as a minimum.

For the GET action, you must hash the host, action and your secret key.

Example

$secret_key = 'mysecretkey';
$remote_url = 'https://goodgamebuzz.com/api/';

$action     = 'GET';
$account    = 'john.doe@email.com';
$point_type = 'Buzz';
$host       = get_bloginfo( 'url' );
$token      = md5( $host . $action . $secret_key );

$request    = array(
  'method' => 'POST',
  'body'   => array(
    'action'  => $action,
    'account' => $account,
    'type'    => $point_type,
    'token'   => $token,
    'host'    => $host
  )
);

$response = wp_remote_post( $remote_url, $request );

Response

  • 0.00

Action: CREDIT

The CREDIT action allows you to add points to a users account. You are required to provide a reference, the amount of points and a log entry at minimum in order for points to be awarded. Reference ID, point type and data is optional.

For the CREDIT action, you must hash host, action, amount and your secret key.

Example

$secret_key = 'mysecretkey';
$remote_url = 'https://goodgamebuzz.com/api/';

$action     = 'CREDIT';
$account    = 'john.doe@email.com';
$amount     = 10;
$ref        = 'reference';
$ref_id     = 0;
$entry      = 'Points for viewing video';
$data       = 'optional extra';
$point_type = 'Buzz';
$host       = get_bloginfo( 'url' );

$token      = md5( $host . $action . $amount . $secret_key );

$request    = array(
  'method' => 'POST',
  'body'   => array(
    'action'  => $action,
    'account' => $account,
    'amount'  => $amount,
    'ref'     => $ref,
    'ref_id'  => $ref_id,
    'type'    => $point_type,
    'entry'   => $entry,
    'data'    => $data,
    'token'   => $token,
    'host'    => $host
  )
);

$response = wp_remote_post( $remote_url, $request );

Response

Note that all response codes are submitted in capital letters and are not translatable.

  • DUPLICATE Your attempt has been executed before and is considered to be duplicate. You should utilize the data variable to make each entry unique.
  • COMPLETED The transaction was successfully completed.
  • FAILED Failed to transfer the funds. Note that the filter is used here twice. Once when the amount is deducted from the sender and once when the amount is credited to the recipients account.

 

Action: DEBIT

The DEBIT action allows you to deduct points to a users account. You are required to provide a reference, the amount of points and a log entry at minimum in order for points to be awarded. Reference ID, point type and data is optional.

For the DEBIT action, you must hash host, action, amount and your secret key.

*Even if you want to deduct points, the amount should never be sent as a negative value! We will take care of this for you.

Example

$secret_key = 'mysecretkey';
$remote_url = 'https://goodgamebuzz.com/api/';

$action     = 'DEBIT';
$account    = 'john.doe@email.com';
$amount     = -10;
$ref        = 'reference';
$point_type = 'Buzz';
$ref_id     = 0;
$entry      = 'Payment for movie tickets';
$data       = 'optional extra';
$host       = get_bloginfo( 'url' );

$token      = md5( $host . $action . $amount . $secret_key );

$request    = array(
  'method' => 'POST',
  'body'   => array(
    'action'  => $action,
    'account' => $account,
    'amount'  => $amount,
    'ref'     => $ref,
    'ref_id'  => $ref_id,
    'type'    => $point_type,
    'entry'   => $entry,
    'data'    => $data,
    'token'   => $token,
    'host'    => $host
  )
);

$response = wp_remote_post( $remote_url, $request );

Response

Note that all response codes are submitted in capital letters and are not translatable.

  • DUPLICATE
    Your attempt has been executed before and is considered to be duplicate. You should utilize the data variable to make each entry unique.
  • DECLINED
    The requested amount exceeds the amount a user has on their account.
  • COMPLETED
    The transaction was successfully completed.
  • FAILED
    Failed to transfer the funds. Note that the filter is used here twice. Once when the amount is deducted from the sender and once when the amount is credited to the recipients account.

 

Action: PAY

The PAY action allows you to transfer money from one account to another. First the user defined under the account variable is deducted the given amount and then added to the recipients account. You define the recipient under the to variable.

For the PAY action, you must hash host, action, amount, account, to and your secret key.

Example

$secret_key = 'mysecretkey';
$remote_url = 'https://goodgamebuzz.com/api/';

$action     = 'PAY';
$from       = 'john.doe@email.com';
$amount     = 10.50;
$to         = 'sara@email.com';
$ref        = 'reference';
$ref_id     = 0;
$entry      = 'Payment for order #1234';
$data       = 'optional extra';
$point_type = 'Buzz';
$host       = get_bloginfo( 'url' );

$token      = md5( $host . $action . $amount . $from . $to . $secret_key );

$request    = array(
  'method' => 'POST',
  'body'   => array(
    'action'  => $action,
    'account' => $from,
    'amount'  => $amount,
    'to'      => $to,
    'ref'     => $ref,
    'ref_id'  => $ref_id,
    'type'    => $point_type,
    'entry'   => $entry,
    'data'    => $data,
    'token'   => $token,
    'host'    => $host
  )
);

$response = wp_remote_post( $remote_url, $request );

Response

Note that all response codes are submitted in capital letters and are not translatable.

  • DUPLICATE
    Your attempt has been executed before and is considered to be duplicate. You should utilize the data variable to make each entry unique.
  • DECLINED
    The sender does not have enough points to fulfill this transaction.
  • COMPLETED
    The transaction was successfully completed.
  • FAILED
    Failed to transfer the funds. Note that the filter is used here twice. Once when the amount is deducted from the sender and once when the amount is credited to the recipients account.