PHP code example of shoplo / bonapiti-bonanza-php-sdk
1. Go to this page and download the library: Download shoplo/bonapiti-bonanza-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shoplo / bonapiti-bonanza-php-sdk example snippets
use Shoplo\BonanzaApi\Client\BonanzaClient;
use Shoplo\BonanzaApi\Credentials\Credentials;
use Shoplo\BonanzaApi\Request\GetBoothItemsRequest;
//Create credentials object using obtained data
$credentials = new Credentials('devID', 'certID');
//Create bonanza client
$client = new BonanzaClient($credentials);
//Create request
$request = new GetBoothItemsRequest();
$request->page = 1;
$request->itemsPerPage = 3;
$request->boothId = 'boothName';
//Make a call and receive GetBoothItemsResponse object
$response = $client->getBoothItems($request);
use Shoplo\BonanzaApi\Request\FetchTokenRequest;
//Create request, and provide the callback url
$request = new FetchTokenRequest();
$request->validationCompleteURL = 'http://return.to/url';
//Make a call and get the authorization URL
$response = $client->fetchToken($request);
//You have the auth token here, but it is inactive, so you can save it for example in the session
$authToken = $response->fetchTokenResponse->authToken;
//Then you redirect user to the page, where he need to log in and confirm the token.
// After confirmation the user is taken back to the validationCompleteURL.
header('Location: '.$response->fetchTokenResponse->authenticationURL);
use Shoplo\BonanzaApi\Client\BonanzaClient;
use Shoplo\BonanzaApi\Credentials\Credentials;
use Shoplo\BonanzaApi\Request\GetBoothItemsRequest;
use Shoplo\BonanzaApi\Type\RequesterCredentialsType;
//Create credentials object using obtained data
$credentials = new Credentials('devID', 'certID');
//Create bonanza client
$client = new BonanzaClient($credentials);
//Create requester credentials containing the received token
$requesterCredentials = new RequesterCredentialsType();
$requesterCredentials->bonanzleAuthToken = 'authToken';
//Create request and pass the requesterCredentials to authorize the request
$request = new GetBoothItemsRequest();
$request->requesterCredentials = $requesterCredentials;
$request->page = 1;
$request->itemsPerPage = 3;
$request->boothId = 'boothName';
//Make a call and receive GetBoothItemsResponse object
$response = $client->getBoothItems($request);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.