Skip to main content

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+37060000001[email protected]1000
900-002-001+37060000002[email protected]2500
900-003-001+37060000003[email protected]500
900-004-001+37060000004[email protected]10000
900-005-001+37060000005[email protected]150
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

import LoyaltySDK from '@loyaltylt/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

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. Get customer by card
const customer = await sdk.getPartnerCard('900-001-001');

// 3. Create transaction (awards points automatically)
await sdk.createTransaction({
  cardId: customer.data.id,
  amount: 25.50,
  shopId: 1,
  description: 'Test purchase'
});

// 4. Check balance
const balance = await sdk.getCardBalance('900-001-001');

2. Test Error Handling

Use invalid card numbers to test error handling:
try {
  await sdk.getPartnerCard('invalid-card');
} catch (error) {
  console.log('Error code:', error.errorCode);
  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');

Rate Limits

Staging environment has the same rate limits as production:
  • 100 requests per minute per API credential
  • 1000 requests per hour per partner

Troubleshooting

Common Issues

  • Verify you’re using staging credentials with staging API URL
  • Check that credentials are active in the Partners Portal
  • Ensure the API key and secret are correct
  • Use demo card numbers listed above
  • Cards created in production don’t exist in staging
  • Wait for weekly sync if testing with specific partner data
  • Staging server may have higher latency than production
  • Increase timeout settings in your SDK configuration

Support

If you encounter issues with the staging environment: