New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adbros/shoptet-sdk

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adbros/shoptet-sdk

Shoptet API SDK

Source
Packagist
Version
v0.8.5
Version published
Total downloads
368
Maintainers
0
Created
Source

Shoptet SDK

main workflow Licence Downloads this Month Downloads total Latest stable

Installation

composer require adbros/shoptet-sdk

Usage

<?php declare(strict_types = 1);

use Adbros\Shoptet\OAuth;
use Adbros\Shoptet\Sdk;

// Initialize OAuth
$oAuth = new OAuth(
	clientId: getenv('CLIENT_ID'),
	clientSecret: getenv('CLIENT_SECRET'),
	eshopUrl: getenv('ESHOP_URL'),
);

// Get oAuthAccessToken in installation process
$oAuthAccessToken = $oAuth->getOAuthAccessToken(
	code: $_GET['code'],
	redirectUri: 'https://example.com/install',
);

// Get apiAccessToken before API call
$apiAccessToken = $oAuth->getApiAccessToken(
	oAuthAccessToken: $oAuthAccessToken->accessToken,
);

// Initialize SDK
$sdk = new Sdk(
	apiAccessToken: $apiAccessToken->accessToken,
);

// Get customers
$page = 1;

do {
	$customers = $sdk->getCustomers($page);
	
	foreach ($customers->customers as $customer) {
		// Get customer
		$customerDetail = $sdk->getCustomer($customer->guid);
	}
} while ($page++ < $customers->paginator->pageCount);

Keywords

api

FAQs

Package last updated on 15 Jan 2025

Related posts