Browser SDK
Install
Section titled “Install”pnpm add @wodira/browserQuickstart
Section titled “Quickstart”import { createWodiraBrowserClient } from '@wodira/browser';
const wodira = createWodiraBrowserClient({ publishableKey: 'wpk_live_...' });
const session = await wodira.createRegistrationCheckoutSession({ eventId: 'event_...', categoryId: 'cat_...', purchaserEmail: 'buyer@example.com', purchaserName: 'Buyer Name', teamName: 'Team Name', termsAccepted: true, waiversAccepted: { waiver_123: true }, idempotencyKey: crypto.randomUUID(), successUrl: 'https://organizer.com/success', cancelUrl: 'https://organizer.com/cancel', athletes: [ { fullname: 'Ada Lovelace', idNumber: '12345678A', email: 'ada@example.com', phone: '+34600000000', gender: 'FEMALE', birthDate: '1990-01-01', }, ],});
if (session.sessionUrl) window.location.href = session.sessionUrl;Methods
Section titled “Methods”searchEventsList public eventsgetEventRead public event detailsgetPricingCardsRender categories and pricesgetRegistrationSummaryPreview checkout totalcreateRegistrationCheckoutSessionCreate Stripe Checkout SessionsearchEvents
Section titled “searchEvents”Lists published events available to the publishable key. Use it on organizer websites to render races, competitions, or sellable events.
const events = await wodira.searchEvents({ search: 'Madrid', limit: 20 });- Endpoint:
POST /external/v1/browser/events/search - Credential:
wpk_live_...with an allowedOrigin
getEvent
Section titled “getEvent”Reads public event details, including categories, public fields, waivers, and active supplements.
const event = await wodira.getEvent('event_123');- Endpoint:
GET /external/v1/browser/events/:eventId - Credential:
wpk_live_...with an allowedOrigin
getPricingCards
Section titled “getPricingCards”Returns public pricing cards for rendering categories, quotas, active prices, and tiers before showing the form.
const pricing = await wodira.getPricingCards('event_123');- Endpoint:
GET /external/v1/browser/events/:eventId/pricing-cards - Credential:
wpk_live_...with an allowedOrigin
getRegistrationSummary
Section titled “getRegistrationSummary”Calculates a checkout summary before redirecting to Stripe: base price, selected supplements, applied coupon, total, and currency.
const summary = await wodira.getRegistrationSummary({ categoryId: 'cat_123', purchaserEmail: 'buyer@example.com', selectedSupplementIds: ['supp_123'], promocode: 'EARLY',});- Endpoint:
POST /external/v1/browser/checkout/registration/summary - Recommended use: reactive summary in the registration form before payment
createRegistrationCheckoutSession
Section titled “createRegistrationCheckoutSession”Creates a Stripe Checkout Session for public registrations. The external website should redirect to sessionUrl; users do not go to WODira to pay.
const session = await wodira.createRegistrationCheckoutSession({ eventId: 'event_123', categoryId: 'cat_123', purchaserEmail: 'buyer@example.com', purchaserName: 'Buyer Name', termsAccepted: true, waiversAccepted: { waiver_123: true }, idempotencyKey: crypto.randomUUID(), successUrl: 'https://organizer.com/success', cancelUrl: 'https://organizer.com/cancel', athletes: [{ fullname: 'Ada Lovelace', email: 'ada@example.com' }],});
window.location.href = session.sessionUrl;- Endpoint:
POST /external/v1/browser/checkout/registration/session - Security:
successUrlandcancelUrlmust belong to an allowed origin - UI alternative:
<wodira-checkout-flow>if you prefer complete Web Components