JavaScript SDK Overview

The Loby JavaScript SDK allows you to embed Loby's membership, ticketing, and event functionality directly into your website. With just a few lines of code, you can enable user authentication, checkout flows, and more.

Features

  • User Authentication - Let users sign in and manage their accounts
  • Membership Checkout - Sell memberships directly on your website
  • Ticket Sales - Sell tickets and day passes
  • Event Ticketing - Sell event tickets with time slot selection
  • Event Listeners - React to user actions like sign-in and order completion

How It Works

The SDK embeds a lightweight widget on your website that handles all the UI for authentication and checkout. When a user interacts with the widget (e.g., signs in or completes a purchase), your website receives events that you can use to update your UI.

Quick Example

Copy
<script> window.lobyAsyncInit = async function() { await Loby.init({ clientId: 1234, version: 'v1' }) console.log('Loby SDK ready!') }; </script> <script async defer crossorigin="anonymous" src="https://js.loby.io/sdk.js"></script>

Once initialized, you can use the Loby object to trigger actions:

Copy
// Show sign-in dialog Loby.showSignIn() // Open membership checkout Loby.checkout({ type: 'MEMBERSHIP' }) // Get current user const user = await Loby.getUser()
Next
Installation