Membership Checkout
Open a checkout flow for membership purchases.
Basic Usage
Open the membership checkout with all available membership types:
Loby.checkout({ type: 'MEMBERSHIP' })
This opens a modal where users can browse available memberships, select options, and complete their purchase.
Specific Membership Type
To open checkout for a specific membership type:
Loby.checkout({ type: 'MEMBERSHIP', membershipTypeId: '08b0a9fb-6696-48c9-a9dd-6accd3c7ecaf' })
This is useful when you have a "Buy Now" button for a specific membership tier.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be 'MEMBERSHIP' |
membershipTypeId | string | No | UUID of a specific membership type to pre-select |
Example: Membership Purchase Buttons
<div class="membership-cards"> <div class="card"> <h3>Basic Membership</h3> <p>$49/year</p> <button onclick="buyMembership('basic-uuid')">Buy Now</button> </div> <div class="card"> <h3>Premium Membership</h3> <p>$99/year</p> <button onclick="buyMembership('premium-uuid')">Buy Now</button> </div> <div class="card"> <h3>View All Options</h3> <button onclick="Loby.checkout({ type: 'MEMBERSHIP' })"> Browse Memberships </button> </div> </div> <script> function buyMembership(membershipTypeId) { Loby.checkout({ type: 'MEMBERSHIP', membershipTypeId: membershipTypeId }) } </script>
Handling Completed Orders
Listen for the orderCompleted event to respond when a purchase is completed:
Loby.addEventListener('orderCompleted', () => { console.log('Order completed!') // Update UI, show confirmation, etc. })
User Flow
- User clicks your "Buy Membership" button
- You call
Loby.checkout({ type: 'MEMBERSHIP' }) - SDK displays the checkout modal
- User selects membership options and enters payment details
- SDK processes the payment
- SDK emits
orderCompletedevent - User sees confirmation and modal closes