PHP code example of net-tools / zettle-api

1. Go to this page and download the library: Download net-tools/zettle-api 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/ */

    

net-tools / zettle-api example snippets


use GuzzleHttp\Client;
use LauLamanApps\IzettleApi\GuzzleIzettleClient;
use LauLamanApps\IzettleApi\IzettleClientFactory;

$izettleClient = new GuzzleIzettleClient(new Client(), 'clientId', 'clientSecret');
$accessToken = $izettleClient->getAccessTokenFromUserLogin('[email protected]', 'password');

//-- store $accessToken in cache

$productClient = IzettleClientFactory::getProductClient($iZettleClient);
$library = $productClient->getLibrary();

use GuzzleHttp\Client;
use LauLamanApps\IzettleApi\GuzzleIzettleClient;
use LauLamanApps\IzettleApi\IzettleClientFactory;

$accessToken = ...; //-- Get from cache

$izettleClient = new GuzzleIzettleClient(new Client(), 'clientId', 'clientSecret');
$izettleClient->setAccessToken($accessToken);

$purchaseClient = IzettleClientFactory::getPurchaseClient($iZettleClient);
$library = $purchaseClient->getPurchaseHistory();
diff
-if ($payout->getPeriodicity() === Periodicity::get(Periodicity::DAILY)) {
+if ($payout->getPeriodicity() === Periodicity::DAILY) {