Skip to documentation
SparkGlimSparkGlim Developer
Search all documentation

Try a topic in your language or an exact API path.

    Integration guides

    Connect the supported ticket purchase handoff

    Use real ticket configuration and the existing protected Web client to open the server-created central checkout.

    Before you start

    • An approved public ticketing campaign, its actual ticket types and campaign-specific attendee form.
    • An authorized controlled test environment and the existing SparkGlim Web repository helper; this is not a published standalone browser SDK.
    • The existing Storm/Turnstile protection, permitted origin and secure same-origin return path.
    01

    Read tickets before accepting an order

    Choose an actual active ticket type, allowed quantity and required attendee fields. Keep ticket IDs, campaign currency, sale windows, invitation rules and per-person limits from the server configuration.

    The frontend does not calculate a charge total or fee. Free registrations use the existing free-ticket response path; the paid example below must not replace that flow.

    02

    Use the real protected client integration

    Inside the approved SparkGlim Web client, fetchPublicFlow from lib/server-backend/public-api.ts delegates to prepareWebCheckoutRequest in lib/security/web-checkout-storm.ts. It supplies existing browser context and stable attempt/return information and handles Web blocking.

    Bare external cURL/Python/PHP payment initialization is not a working integration: Server requires web_abuse_context and applies origin, device and abuse protections. Do not fabricate device strings or publish this repository import as an npm API. External integrations need approved Organization access or canonical campaign navigation.

    03

    Submit once and navigate to checkout

    The inert example exports a browser function and sends nothing until your existing validated handler calls it with approved test input. Keep one client_attempt_id for the same request, lock uncertain submissions and preserve the form while the result is unknown; never automatically retry with a new attempt.

    For a paid response, open the returned authorization_url on checkout.sparkglim.net. Checkout and Server own payment outcome and return navigation; add no frontend verification, polling or fulfillment.

    Illustrative request with placeholder values
    typescript
    'use client';
    import { fetchPublicFlow } from '@/lib/server-backend/public-api';
    type Input = { campaign_id: string; ticket_id: string; quantity: number; phone_number: string; email?: string; attendee_information?: Record<string, string>; invite_code?: string; discount_code?: string; client_attempt_id: string; return_path: string };
    let requestStarted = false;
    export async function initializeApprovedTest(input: Input, approvedTest: boolean) {
      if (!approvedTest || requestStarted) return null;
      requestStarted = true;
        const response = await fetchPublicFlow('/tickets/purchase', {
          method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input)
        });
        const result = await response.json();
        if (!response.ok || result.success !== true) throw new Error(result.error || 'Checkout unavailable');
        if (typeof result.data?.authorization_url !== 'string') throw new Error('No paid checkout URL returned');
        const target = new URL(result.data.authorization_url);
        if (target.origin !== 'https://checkout.sparkglim.net' || target.username || target.password) throw new Error('Invalid checkout URL');
        window.location.assign(target.href);
        return target.href;
    }

    Check your integration

    • Exercise sold-out, invalid ticket and attendee validation with approved fixtures only.
    • Confirm missing device identity or blocked browser stops initialization rather than bypassing protection.
    • Check central checkout handoff and return path without placing a live charge.