The Zettle by PayPal API provides a simple integration of the Zettle by PayPal API for your PHP project.
With composer, add:
$ composer require laulamanapps/izettle-api
To make sure everyting works you can run tests:
$ composer test
Get yourself an access token. you'll need an clientId
and clientSecret
for this (to get one apply here)
for performance benefits, it might be wise to store the access token in a cache like Redis.
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();
Version 1.0 requires PHP 8.1 and uses first-class Enums. This is a breaking change.
If you're using the enums, make sure you replace calls to get
with an instance reference:
-if ($payout->getPeriodicity() === Periodicity::get(Periodicity::DAILY)) {
+if ($payout->getPeriodicity() === Periodicity::DAILY) {
iZettle Api has been developed by LauLaman.