Features

Bliss SDK Features

Core Features

Quote Management

Creating Quotes

Create quotes for events or services that need guarantees:

const quoteRequest = {
  product_id: "123e4567-e89b-12d3-a456-426614174000",
  product_price: 100,
  eventStartTime: "2024-03-24T10:00:00Z",
  eventEndTime: "2024-03-24T18:00:00Z",
  data: {
    // Optional additional data
    bookingRef: "TEST-123",
  },
};

const quote = await window.Bliss.createQuote(quoteRequest);

Quote Response Structure

interface QuoteResponse {
  message: string;
  product_id: string;
  quote_id: string;
  currency: string;
  valid_until: number;
  bliss_pricing: {
    raw: number; // Raw numeric value
    formatted: string; // Currency-formatted string (e.g. "$25.00")
  };
  partner_admin_fee: {
    raw: number; // Raw numeric value
    formatted: string; // Currency-formatted string
  };
  refund_amount: {
    raw: number; // Raw numeric value
    formatted: string; // Currency-formatted string
  };
  data?: Record<string, string>;
}

Accepting Quotes

Accept a quote to proceed with guarantee creation:

const acceptRequest = {
  quote_id: "quote_123",
  user: {
    name: "John Doe",
    email: "[email protected]",
    phone: "+12345678900", // Optional
  },
};

const result = await window.Bliss.acceptQuote(acceptRequest);

Accept Quote Response Structure

interface AcceptQuoteResponse {
  message: string;
  product_id: string;
  currency: string;
  bliss_id: string;
  valid_until: number;
  quote_id: string;
  reservation_id?: string;
  bliss_pricing: number;
  partner_admin_fee: number;
  refund_amount: number;
  payout: number;
}

Guarantee Management

Creating Guarantees

Create a new guarantee:

const guaranteeRequest = {
  product_id: "123e4567-e89b-12d3-a456-426614174000",
  product_price: 200,
  event_start_time: "2024-03-24T10:00:00Z",
  event_end_time: "2024-03-24T18:00:00Z",
  external_id: "ORDER-123456",
  user: {
    name: "John Doe",
    email: "[email protected]",
    phone: "+12345678900", // Optional
  },
  data: {
    // Optional
    venue: "Stadium Name",
    eventType: "concert",
  },
};

const guarantee = await window.Bliss.createGuarantee(guaranteeRequest);

Guarantee Response Structure

interface GuaranteeResponse {
  message: string;
  product_id: string;
  currency: string;
  bliss_id: string;
  valid_until: number;
  payout: number;
  bliss_pricing: {
    raw: number;
    formatted: string;
  };
  partner_admin_fee: {
    raw: number;
    formatted: string;
  };
  details: string[];
}

Error Handling

Each feature includes built-in validation and error handling:

try {
  const quote = await window.Bliss.createQuote(quoteRequest);
} catch (error) {
  console.error("Error:", error.message);
}