SDK Overview
Official JavaScript, PHP and Python libraries for the Shop API
SDKs
Each SDK wraps the Shop API: it adds the credential headers, builds the locale-prefixed
URL, unwraps the response envelope, and retries 429 and 5xx for you.
Node.js backends, POS front ends, and React components.
npm install @loyaltylt/sdkLaravel, Symfony, WooCommerce and plain PHP.
composer require loyaltylt/sdkDjango, Flask and FastAPI.
pip install loyaltylt-sdkWhat they cover
| JavaScript | PHP | Python | |
|---|---|---|---|
| Transactions and points | Yes | Yes | Yes |
| Loyalty card lookup | Yes | Yes | Yes |
| Coupons | Yes | Yes | Yes |
| Games and stamp cards | Yes | Yes | Yes |
| Offers (read) | Yes | Yes | Yes |
| XML product import | Yes | Yes | Yes |
| QR login and QR card scan | Yes | Yes | Yes |
| Realtime — subscribes for you | Yes | Yes | Yes |
| React components | Yes | – | – |
QR results arrive over a realtime channel, and every SDK subscribes for you — that is the path to build. Polling exists only as a fallback for environments that cannot hold a WebSocket open.
const session = await sdk.generateQrLogin('Till 3', shopId);
await sdk.subscribeToQrLogin(session.session_id, ({ data }) => {
if (data.status === 'authenticated') signIn(data.token, data.user);
});$session = $sdk->generateQrLogin('Till 3', $shopId);
$result = $sdk->subscribeQrLogin($session['session_id']); // blocks until it resolves
if (($result['status'] ?? null) === 'authenticated') {
$token = $result['token'];
}session = sdk.generate_qr_login(device_name='Till 3', shop_id=shop_id)
result = sdk.subscribe_qr_login(session['session_id']) # blocks until it resolves
if result and result['status'] == 'authenticated':
token = result['token']The PHP and Python helpers block the calling process, so they suit a POS or a worker. In a web request, open the session on your server and let the page subscribe — see Realtime.
Configuration
Every SDK takes the same four things:
apiKey your API key, lty_...
apiSecret your API secret
environment 'production' (default) or 'staging'
locale 'lt' (default) or 'en'Credentials come from the Partners Portal → API Credentials. Keep the secret server-side — these SDKs are for backends and POS software, not for browser or mobile bundles.
The call most integrations start with
await sdk.createTransaction({
user_email: 'customer@example.com',
order_id: 'ORD-2024-001',
order_total: 25.50,
currency: 'EUR',
shop_id: 1,
});$sdk->createTransaction([
'user_email' => 'customer@example.com',
'order_id' => 'ORD-2024-001',
'order_total' => 25.50,
'currency' => 'EUR',
'shop_id' => 1,
]);sdk.create_transaction(
user_email='customer@example.com',
order_id='ORD-2024-001',
order_total=25.50,
currency='EUR',
shop_id=1,
)Next
Response format, errors, base URLs