SDKsJavaScript
Installation
Install and configure the JavaScript SDK
Installation
npm install @loyaltylt/sdkRequires 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.reactConfigure
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();| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | — | API key, lty_... (required) |
apiSecret | string | — | API secret (required) |
environment | 'production' | 'staging' | 'production' | Which API to talk to |
locale | string | 'lt' | lt or en |
timeout | number | 30000 | Request timeout, ms |
retries | number | 3 | Retry attempts for 429 and 5xx |
debug | boolean | false | Log 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