Back to arkyStore.io

Scheduled Services

Schedule services through the unified cart checkout flow

Service scheduling is part of E-shop. Services and providers define what can be scheduled, and cart checkout creates an Order with service appointment lines. There is no separate booking checkout surface.

Setup

import { createArkyStore } from 'arky-sdk/storefront-store';

const arkyStore = createArkyStore({
  baseUrl: 'https://api.arky.io',
  storeId: 'your-store-id',
  market: 'us',
  locale: 'en',
});

await arkyStore.setup({
  hydrateCart: true,
});

Service Flow

The service controller keeps availability, calendar state, selected slots, and service cart items together.

const { items: services } = await arkyStore.eshop.service.list({ limit: 20 });
const service = services[0];

await arkyStore.eshop.service.initialize();
await arkyStore.eshop.service.select(service);
await arkyStore.eshop.service.findFirstAvailable();

const state = arkyStore.eshop.service.state.get();
const slot = state.slots[0];

arkyStore.eshop.service.selectTimeSlot(slot);
await arkyStore.eshop.service.addToCart();

The selected service line is now in eshop.cart.service_items and the backend cart.

const cartSnapshot = arkyStore.eshop.cart.snapshot.get();
console.log(cartSnapshot.service_items);

Quote And Checkout

Quote and checkout stay on the cart, even for service-only orders.

const quote = await arkyStore.eshop.cart.quote({
  forms: [
    {
      key: 'profile',
      entries: [{ key: 'email', value: '[email protected]' }],
    },
  ],
});

const order = await arkyStore.eshop.cart.checkout({
  payment_method_id: 'cash',
});

console.log(order.order_id, quote?.payment.total);
Note

Service-only orders do not require a shipping address or shipping method. Mixed carts can include shipping context for product lines and zone-based taxes.

Mixed Carts

Product and service appointment lines can be quoted and checked out together:

await arkyStore.eshop.cart.addProduct(product, variant, 1);
await arkyStore.eshop.service.addToCart();

await arkyStore.eshop.cart.quote({
  shipping_method_id: 'standard',
  shipping_address,
});

await arkyStore.eshop.cart.checkout({
  payment_method_id: 'credit_card',
  shipping_method_id: 'standard',
  shipping_address,
});

Lower-Level Escape Hatch

If you are building a custom scheduler, you can still sync service items manually through the cart action.

await arkyStore.eshop.cart.sync({
  service_items: [
    {
      id: `${serviceId}-${from}`,
      service_id: serviceId,
      provider_id: providerId,
      from,
      to,
    },
  ],
});

Prefer the service controller when it fits. It keeps the storefront lean and matches the platform flow.