Skip to main content
The Liteshop SDK sends Form submissions and booking and catalogue requests from a Site’s pages to Liteshop. It calls the Site’s own address, so it needs no keys and works only on a published Liteshop Site or with the local dev plugin.

Load the SDK

A Site without a build step loads the SDK with a script tag, before any script that uses it. The script defines the liteshop global:
A Site built with a framework installs the npm package and imports the SDK:
The package includes TypeScript types. To type the liteshop global in a Site that uses the script tag, add /// <reference types="@liteshop.ai/sdk/global" /> to a TypeScript file. Call the SDK from event handlers or effects that run in the browser, not while a page is prerendered.

liteshop.forms.submit

Sends a Visitor’s answers to a declared Form.
For details, see Forms.

liteshop.bookings.getAvailability

Returns which dates or slots of an Offer a Visitor can request.
The response always includes offerId, from, to, and unit:
  • For a nightly or daily Offer, dates lists { date, available } for each date.
  • For a timed Offer, slots lists { start, end, available }. start and end are ISO 8601 times with the Site’s time-zone offset, such as 2027-06-01T09:00:00+02:00.
Availability shows what a Visitor can request, not what is reserved: it doesn’t report whether imported calendars are up to date. Present dates and slots as open for requests.

liteshop.bookings.request

Sends a Booking Request for an Offer. The Owner confirms or declines it; the request doesn’t block the dates until the Owner confirms it.
For details, see Bookings.

liteshop.catalogue.list

Returns the published Catalogue Items and collections.
Each item has id, kind (product or service), name, optional description, optional price (amount in minor units and currency), optional images (Site-relative URLs, main image first) and image (the main image), maximumQuantity, and available. available is false when the Owner tracks stock and none is left. name and description are objects keyed by language. Each collection has id, name, and the ordered items IDs.

liteshop.catalogue.request

Sends a request for one Catalogue Item. The Owner confirms or declines it and arranges payment outside Liteshop.
The SDK sends the page language from <html lang>. For details, see Catalogue.

Errors

When Liteshop rejects a call, the promise rejects with an error that has these properties:

Errors for all methods

Field errors

Forms, Booking Requests, and catalogue requests check each value against its declared field, and report these codes with the field’s ID in field: VALUES_INVALID, FIELD_UNDECLARED, FIELD_REQUIRED, FIELD_TYPE_INVALID, FIELD_TOO_SHORT, FIELD_TOO_LONG, FIELD_EMAIL_INVALID, FIELD_BELOW_MINIMUM, FIELD_ABOVE_MAXIMUM, and FIELD_OPTION_INVALID.

Booking errors

Catalogue errors

Retries and spam protection

The SDK gives each call an identifier and retries one network failure with the same identifier, so a retry never creates a duplicate. Liteshop accepts at most five submissions per Visitor for each Form, Offer, or Catalogue Item every 10 minutes, and at most 100 per Site every hour.