Storefront
Bookings
Booking pages on your own site: who takes bookings, their open times, and booking one.
The same browser key (pk_…) as the store, so one client does the shop, the booking page and the courses. The key names the workspace — nothing here asks for a workspace slug. Paid booking types are paid into the workspace's own account, set up in Settings › Payments.
TypeScript
const pages = await mercestack.bookings.list();
// [{ handle: "ada", host: { name, intro, timezone }, types: [{ slug, title, durationMinutes, price }] }]
const page = pages[0];
const type = page.types[0];
const { slots, timezone } = await mercestack.bookings.slots(page.handle, type.slug, {
from: "2026-11-02",
to: "2026-11-09",
});
const booking = await mercestack.bookings.book(page.handle, type.slug, {
startsAt: slots[0],
name: "Ada Lovelace",
email: "[email protected]",
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
});
if (booking.paymentUrl) location.assign(booking.paymentUrl); // paid type
else show(booking.manageUrl); // confirmed — where the guest can reschedule or cancelWhat to know
- Slots are already filtered. Working hours, existing meetings and calendar events, buffers and the booking window are applied on the server. Show what comes back.
- A slot can go between showing it and booking it.
bookanswers with an error then; offer the next time rather than retrying the same one. - Paid types hold the slot while the guest pays. It is released if payment does not finish.