Skip to content

Browser SDK

Ventana de terminal
pnpm add @wodira/browser
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;

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 });

Reads public event details, including categories, public fields, waivers, and active supplements.

const event = await wodira.getEvent('event_123');

Returns public pricing cards for rendering categories, quotas, active prices, and tiers before showing the form.

const pricing = await wodira.getPricingCards('event_123');

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',
});

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;