Bookable products: availability, selectable resources and offerings, and booking
creation with book or bookings.create. Requires publishableKey. Every booking
needs acceptsTerms: true. A product without an online deposit is confirmed at once;
with one, book returns a pending booking and a checkout URL, and refreshPayment
reports the outcome when the buyer returns. A stored customer session is sent with each
booking, which then appears in customers.me(). Throws NOT_FOUND (apiCode
PRODUCT_NOT_FOUND) when bookings are not enabled on the site.
Access via: lynkow.reservations
Methods
6 methods
bookings.create
bookings.create(productIdOrSlug: string, data: BookingCreateData, options?: TimedSubmitOptions & BaseRequestOptions): Promise<Booking>Creates a booking for a product without an online deposit and resolves to the
confirmed Booking. Same request, session, anti-spam handling and errors
as book(); use book() for a product that requires a deposit.
Parameter | Type | Description |
|---|---|---|
|
| The product's |
|
|
|
|
| Optional |
Returns: Promise<Booking>
const booking = await lynkow.reservations.bookings.create('haircut', {
startsAt: '2026-07-10T09:00:00.000Z',
partySize: 1,
guestName: 'Alice Martin',
guestEmail: '[email protected]',
acceptsTerms: true,
})
// booking.status === 'confirmed'availability
availability(productIdOrSlug: string, filters: AvailabilityFilters): Promise<AvailabilityResponse>Fetches the bookable slots of a product between two dates, in chronological order. A
span longer than 62 days, or than how far ahead the product can be booked, is
shortened: read window.to for the date actually covered. Never cached. Throws LynkowError NOT_FOUND with apiCode
PRODUCT_NOT_FOUND for an unknown or non-bookable product, and VALIDATION_ERROR with
VALIDATION_FIELD_INVALID when to precedes from, or OFFERING_NOT_FOUND for an
offeringId that is not one of the product's offerings.
Parameter | Type | Description |
|---|---|---|
|
| The product's |
|
| AvailabilityFilters: |
Returns: Promise<AvailabilityResponse>
const { slots, timezone } = await lynkow.reservations.availability('sunset-dinner-cruise', {
from: '2026-07-10',
to: '2026-07-17',
partySize: 2,
})book
book(productIdOrSlug: string, data: BookingCreateData, options?: TimedSubmitOptions & BaseRequestOptions): Promise<BookingDepositResult>Creates a booking for a slot. Without an online deposit it is confirmed. When the
product requires a deposit and the site takes online payments, it is pending: send
the buyer to deposit.checkoutUrl, then call refreshPayment on their return. A stored
customer session books as that buyer, and a guest gets FORBIDDEN (apiCode
ACCOUNT_REQUIRED) on a site that requires accounts. Throws LynkowError
VALIDATION_ERROR with TERMS_NOT_ACCEPTED, TERMS_PAGE_NOT_CONFIGURED,
SLOT_UNAVAILABLE, CAPACITY_EXCEEDED, OFFERING_REQUIRED or another booking code,
NOT_FOUND with PRODUCT_NOT_FOUND, and the anti-spam errors RATE_SUBMISSION_TOO_FAST
(429), RATE_SUBMISSION_EXPIRED and SPAM_RECAPTCHA_REQUIRED (400).
Parameter | Type | Description |
|---|---|---|
|
| The product's |
|
| BookingCreateData: |
|
| Optional |
Returns: Promise<BookingDepositResult>
const result = await lynkow.reservations.book('chef-table', {
startsAt: '2026-07-10T18:00:00.000Z',
partySize: 2,
guestName: 'Alice Martin',
guestEmail: '[email protected]',
acceptsTerms: true, // ticked on this page, by this buyer
})
if (result.deposit) {
window.location.assign(result.deposit.checkoutUrl)
}offerings
offerings(productIdOrSlug: string, options?: BaseRequestOptions): Promise<ReservationOffering[]>Lists a product's offerings (each with its price, duration and party-size bounds) in
the merchant's order, so the buyer picks one before choosing a slot. When the list is
not empty, a booking must name one in BookingCreateData.offeringId. Never
cached. Throws LynkowError NOT_FOUND with apiCode PRODUCT_NOT_FOUND for an
unknown or non-bookable product, and when offering selection is not enabled on the site.
Parameter | Type | Description |
|---|---|---|
|
| The product's |
|
| Optional BaseRequestOptions: a |
Returns: Promise<ReservationOffering[]>
const offerings = await lynkow.reservations.offerings('haircut', { locale: 'es' })
for (const offering of offerings) {
console.log(`${offering.label}: ${offering.priceCents} cents, ${offering.durationMin} min`)
}refreshPayment
refreshPayment(paymentId: string, captureToken?: string, options?: BaseRequestOptions): Promise<PaymentRefreshResult>Updates a booking deposit from the payment provider after the buyer returns from
checkout, and resolves to the payment and booking statuses. Safe to call repeatedly.
A guest passes the captureToken that book returned; the buyer who made the
booking can omit it while their customer session is stored. Throws LynkowError
FORBIDDEN with apiCode PAYMENT_CAPABILITY_REQUIRED for an unknown payment or when
neither the token nor the session authorizes it, and NOT_FOUND when online payments
are not enabled on the site.
Parameter | Type | Description |
|---|---|---|
|
| The |
|
| The guest token from BookingDeposit.captureToken; optional for the signed-in buyer who booked. |
|
| Optional request options, such as |
Returns: Promise<PaymentRefreshResult>
const result = await lynkow.reservations.book('chef-table', {
startsAt: '2026-07-10T18:00:00.000Z',
partySize: 2,
guestName: 'Alice Martin',
guestEmail: '[email protected]',
acceptsTerms: true,
})
if (!result.deposit) return
const refreshed = await lynkow.reservations.refreshPayment(
result.deposit.paymentId,
result.deposit.captureToken,
)
if (refreshed.bookingStatus === 'confirmed') {
showConfirmation()
}resources
resources(productIdOrSlug: string, options?: BaseRequestOptions): Promise<ReservationResource[]>Lists the resources (a stylist, a room) the buyer can choose between for a product.
The list is empty unless the merchant lets buyers pick a resource for this product:
render no picker then, and a resource is assigned automatically. Pass a returned id
as BookingCreateData.resourceId. Never cached. Throws LynkowError NOT_FOUND
with apiCode PRODUCT_NOT_FOUND for an unknown or non-bookable product.
Parameter | Type | Description |
|---|---|---|
|
| The product's |
|
| Optional BaseRequestOptions: a |
Returns: Promise<ReservationResource[]>
const resources = await lynkow.reservations.resources('haircut', { locale: 'es' })
const booking = await lynkow.reservations.book('haircut', {
startsAt: '2026-07-10T09:00:00.000Z',
partySize: 1,
guestName: 'Alice Martin',
guestEmail: '[email protected]',
resourceId: resources[0]?.id, // undefined assigns one automatically
acceptsTerms: true,
})