1. Go to this page and download the library: Download nonz250/smaregi-api-php 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/ */
nonz250 / smaregi-api-php example snippets
declare(strict_types=1);
use Nonz250\SmaregiApiPhp\Auth\SmaregiClientCredentials;
use Nonz250\SmaregiApiPhp\Auth\SmaregiProvider;
$provider = new SmaregiProvider(
'SMAREGI_IDP_HOST',
'SMAREGI_CLIENT_ID',
'SMAREGI_CLIENT_SECRET',
);
$accessToken = $provider->getAccessToken(new SmaregiClientCredentials(), [
'contract_id' => 'SMAREGI_CONTRACT_ID',
'scope' => ['pos.products:read', 'pos.customers:read'],
]);