Loyalty.lt
SDKsJavaScript

Installation

Install and configure the JavaScript SDK

Installation

npm install @loyaltylt/sdk

Requires Node.js 16 or newer. TypeScript definitions ship with the package.

For the browser, without a build step:

<script src="https://unpkg.com/@loyaltylt/sdk@latest/dist/index.umd.js"></script>

Loading the SDK in a browser means putting your API secret in the page. Only do this on a POS terminal you control, never on a public website.

The React components (QRLogin, QRCardDisplay) need three peers:

npm install react react-dom qrcode.react

Configure

import { LoyaltySDK } from '@loyaltylt/sdk';

const sdk = new LoyaltySDK({
  apiKey: process.env.LOYALTY_API_KEY,
  apiSecret: process.env.LOYALTY_API_SECRET,
  environment: 'staging',
  locale: 'lt',
});

await sdk.validateCredentials();
OptionTypeDefaultDescription
apiKeystring—API key, lty_... (required)
apiSecretstring—API secret (required)
environment'production' | 'staging''production'Which API to talk to
localestring'lt'lt or en
timeoutnumber30000Request timeout, ms
retriesnumber3Retry attempts for 429 and 5xx
debugbooleanfalseLog each request and response

Get credentials from the Partners Portal → API Credentials. Staging and production credentials are separate and not interchangeable.

Next

Points, cards, coupons, games

Sign a customer in

Identify a customer at the POS

On this page