Loyalty.lt
API Basics

Staging Environment

Test your integration safely with our staging environment

Staging Environment

The Loyalty.lt API provides a dedicated staging environment for testing your integrations before going live with production data.

Staging vs Production

FeatureStagingProduction
Base URLhttps://staging-api.loyalty.lthttps://api.loyalty.lt
DataDemo/test dataReal customer data
API CredentialsStaging credentials onlyProduction credentials only
Weekly resetYes (Sundays)No

Getting Staging API Credentials

  1. Log in to the Partners Portal
  2. Navigate to API Credentials in the sidebar menu
  3. Click Create New Credential
  4. Select Environment: Staging
  5. Save your API Key and Secret (shown only once!)

Staging credentials only work with the staging API (staging-api.loyalty.lt). Production credentials only work with the production API (api.loyalty.lt).

Demo Test Data

The staging environment includes pre-configured demo data for testing:

Demo Loyalty Cards

Card numbers use the format XXX-XXX-XXX. Demo cards start with 900-:

Card NumberPhoneEmailPoints
900-001-001+37060000001demo1@loyalty.lt1000
900-002-001+37060000002demo2@loyalty.lt2500
900-003-001+37060000003demo3@loyalty.lt500
900-004-001+37060000004demo4@loyalty.lt10000
900-005-001+37060000005demo5@loyalty.lt150

Card number format: 900-{user_id}-{partner_id} where IDs are zero-padded to 3 digits.

Demo Staff Accounts

Staff members log in to the Staff App using their Barcode (numbers only):

BarcodeNameRole
100000001Demo ManagerManager
100000002Demo CashierCashier

Barcode format: {partner_id}{user_id} where user_id is zero-padded to 8 digits.

Example: For partner ID 5 and user ID 123, barcode would be 500000123.

Staff accounts are created for each partner synced from production.

SDK Configuration

JavaScript SDK


const sdk = new LoyaltySDK({
  apiKey: 'your_staging_api_key',
  apiSecret: 'your_staging_api_secret',
  environment: 'staging', // Uses staging-api.loyalty.lt
  locale: 'lt'
});

PHP SDK

use LoyaltyLt\SDK\LoyaltySDK;

$sdk = new LoyaltySDK([
    'apiKey' => 'your_staging_api_key',
    'apiSecret' => 'your_staging_api_secret',
    'environment' => 'staging',
]);

Python SDK

from loyalty_sdk import LoyaltySDK

sdk = LoyaltySDK(
    api_key='your_staging_api_key',
    api_secret='your_staging_api_secret',
    environment='staging'
)

Weekly Data Reset

Note

The staging environment is reset every Sunday at 05:00 EET. All test transactions and temporary data are cleared. Demo cards and partner catalog data are preserved.

What Gets Reset

  • Customer transactions
  • Point awards/redemptions
  • Game progress and sessions
  • Coupon redemptions
  • Activity logs

What Gets Preserved

  • Partner settings and catalog (products, games, offers)
  • Demo loyalty cards
  • Demo staff accounts
  • API credentials

Testing Recommendations

1. Test the Full Flow

// 1. Validate credentials
await sdk.validateCredentials();

// 2. Look up a card by number
const { data: card } = await sdk.getLoyaltyCardInfo({ card_number: '900-001-001' });

// 3. Create transaction (awards points automatically)
await sdk.createTransaction({
  card_id: card.id,
  amount: 25.50,
  type: 'earn',
  description: 'Test purchase'
});

// 4. Check balance
const balance = await sdk.getPointsBalance(card.id);

2. Test Error Handling

Use invalid card numbers to test error handling:

try {
  await sdk.getLoyaltyCardInfo({ card_number: 'invalid-card' });
} catch (error) {
  console.log('Code:', error.code);
  console.log('Message:', error.message);
}

3. Test Games & Coupons

// List available games
const games = await sdk.listShopGames();

// Get customer's games
const cardGames = await sdk.getCardGames('900-001-001');

// Get customer's coupons
const coupons = await sdk.getCardCoupons('900-001-001');

Troubleshooting

Common Issues

Support

If you encounter issues with the staging environment:

On this page