No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Examples/StandardPHPApplication
Libraries
.gitignore
README.md

README.md

ShopwaveConnect-PHP

A PHP library for ShopwaveConnect with an accompanying PHP example project.

Required Class Libraries

Each of the following libraries must be included in your PHP implementation file. An example of this can be found in Examples/StandardPHPApplication/index.php .

ShopwaveConnectManager

Required Parameters

Each of the following parameters will have to be supplied in the code in order to communicate with the ShopwaveConnect API. An example of this can be found in Examples/StandardPHPApplication/index.php.

/* Your Shopwave ClientIdentifier (e.g. js7woa9ro028djsnakf778sn3wiam3ond274knao) */
$clientIdentifier = "SHOPWAVE_CLIENT_IDENTIFIER";
    
/* Your Shopwave ClientSecret (e.g. 76h4389732ru2039r20ruju023r9u2309jk8sna0) */
$clientSecret = "SHOPWAVE_CLIENT_SECRET";
    
/* Your Shopwave RedirectUri (e.g. http://my.app) */
$redirectUrl = "SHOPWAVE_REDIRECT_URI";
    
/* Your Shopwave Scope. Please request scopes that are absolute essential for your app */
$scopes = array("user","application", "merchant","store", "product", "category", "basket", "promotion", "log", "supplierStore", "supplier", "invoice", "stock");

Using the Library

Each of the following code snipets can be found in Examples/StandardPHPApplication/index.php.

Initialisation

$shopwaveConnect = new ShopwaveConnectManager($clientIdentifier, $clientSecret, $redirectUrl, $scopes);

Authorise

PHP

header('Location: ' . $shopwaveConnect->getAuthoriseApplicationUri()); //redirect to auth uri

Fetch Token

$token = $shopwaveConnect->makeTokenCall();

Make API Call

$endpoint = $shopwaveConnect->makeShopwaveApiCall("API_ENDPOINT", "OAUTH2_TOKEN", "METHOD", "HEADERS_DICTIONARY", "POST_BODY_JSON")
$user = $shopwaveConnect->makeShopwaveApiCall('user', $_SESSION['token'], "GET", $headers);