Loyalty.lt
SDKsJavaScript

Installation

Install the official Loyalty.lt JavaScript SDK

Installation

The official Loyalty.lt JavaScript SDK is available on npm and can be used in Node.js, React, Vue, and any JavaScript environment.

NPM / Yarn

npm install @loyaltylt/sdk
yarn add @loyaltylt/sdk
pnpm add @loyaltylt/sdk

CDN (Browser)

For browser-based applications without a build system:

<script src="https://unpkg.com/@loyaltylt/sdk@latest/dist/index.umd.js"></script>
<script>
  const sdk = new LoyaltySDK.LoyaltySDK({
    apiKey: 'lty_xxxxxxxxxxxx',
    apiSecret: 'your_api_secret',
    environment: 'production'
  });
</script>

Requirements

Node.js

Node.js 16.0.0 or higher

TypeScript

TypeScript 4.0+ (optional, types included)

For React Components

If you plan to use the React components (QRLogin, QRCardDisplay), you also need:

npm install react react-dom qrcode.react

Quick Start


// Initialize SDK with API credentials
const sdk = new LoyaltySDK({
  apiKey: 'lty_your_api_key',
  apiSecret: 'your_api_secret',
  environment: 'production', // or 'staging'
  locale: 'lt'
});

// Test connection
const shops = await sdk.getShops();
console.log('Connected! Shops:', shops.data);

Configuration Options

OptionTypeDefaultDescription
apiKeystring-Your API Key (required)
apiSecretstring-Your API Secret (required)
environment'production' | 'staging''production'API environment
localestring'lt'API locale (lt, en)
timeoutnumber30000Request timeout in ms
debugbooleanfalseEnable debug logging
retriesnumber3Number of retry attempts

Getting API Credentials

Access Partners Portal

Go to partners.loyalty.lt and log in to your account.

Navigate to API Credentials

Click API Credentials in the sidebar.

Generate Credentials

Click Generate New Credentials to create your API Key and Secret.

Copy Credentials

Copy both the API Key (lty_...) and API Secret. Store them securely!

Never expose your API Secret in client-side code. The SDK is designed for server-to-server communication or secure backend integrations.

Next Steps

Learn how to use the SDK for common operations

Implement QR code-based login

Customer identification via QR code

Pre-built React components

On this page