Initialization

Before using any SDK methods, you must initialize the SDK with your configuration.

Basic Initialization

Copy
window.lobyAsyncInit = async function() { await Loby.init({ clientId: 1234, version: 'v1' }) }

Configuration Options

ParameterTypeRequiredDescription
clientIdnumberYesYour Loby SDK client ID. Found in Settings > Developer Settings in your Loby dashboard.
versionstringNoAPI version to use. Currently only 'v1' is supported.
languagestringNoInitial language code (e.g., 'en', 'da'). Defaults to browser language.
testModebooleanNoWhen true, the SDK uses test mode data (test membership types, ticket types, and Stripe test keys). Useful for development and testing before going live. Defaults to false.

Example with All Options

Copy
window.lobyAsyncInit = async function() { await Loby.init({ clientId: 1234, version: 'v1', language: 'da', testMode: true }) console.log('Loby SDK initialized!') }

Test Mode

When testMode is set to true, the SDK will only load membership types and ticket types that are marked as test mode in your Loby dashboard. This allows you to test the full checkout flow without processing real payments.

To use test mode:

  1. Create test membership types or ticket types in your Loby dashboard
  2. Pass testMode: true when initializing the SDK
  3. Use Stripe test card numbers (e.g., 4242 4242 4242 4242) to complete test purchases

Remember to remove testMode: true (or set it to false) before going live.

Getting Your Client ID

Your client ID is a unique identifier assigned to your Loby workspace. To obtain your client ID:

  1. Log in to your Loby dashboard at loby.cloud
  2. Navigate to Settings > Developer Settings
  3. Scroll down to the SDK Client ID section
  4. Copy your client ID using the copy button

The SDK Client ID is automatically generated for your workspace and cannot be changed.

Error Handling

If initialization fails (e.g., invalid client ID), the promise will reject:

Copy
window.lobyAsyncInit = async function() { try { await Loby.init({ clientId: 1234, version: 'v1' }) console.log('SDK ready') } catch (error) { console.error('Failed to initialize Loby SDK:', error) } }
Previous
Installation
Next
Sign In