Business

Manage business settings, subscriptions, and team invitations

The Business module handles business configuration, subscription management, team invitations, and webhooks.

Get Business

GET /v1/businesses/{businessId}
SDK: sdk.business.getBusiness()

Retrieve the current business.

const business = await sdk.business.getBusiness({});

console.log(business.key, business.settings);

List Businesses

GET /v1/businesses
SDK: sdk.business.getBusinesses()

List all businesses the current user has access to.

const result = await sdk.business.getBusinesses({
query: 'store',
isNetwork: false,
status: 'ACTIVE',
limit: 20,
cursor: null,
sortField: 'createdAt',
sortDirection: 'desc'
});

result.items.forEach(business => {
console.log(business.key);
});

Parameters

Name Type Description
query optional string Search query
isNetwork optional boolean Filter by network status
status optional DRAFT | ACTIVE | ARCHIVED Filter by status
limit optional number Items per page
cursor optional string Pagination cursor
sortField optional string Sort field
sortDirection optional asc | desc Sort direction

Create Business

POST /v1/businesses
SDK: sdk.business.createBusiness()

Create a new business.

const result = await sdk.business.createBusiness({
key: 'my-store',
slug: 'my-store',
description: 'My online store',
email: '[email protected]',
phone: '+1234567890',
website: 'https://mystore.com',
address: {
  line1: '123 Main St',
  city: 'New York',
  state: 'NY',
  postalCode: '10001',
  country: 'US'
},
settings: {
  currency: 'USD',
  locale: 'en-US'
}
});

Parameters

Name Type Description
key required string Unique business key identifier
slug optional string URL-friendly identifier
description optional string Business description
email optional string Contact email
phone optional string Contact phone
website optional string Business website URL
address optional Address Business address
settings optional object Business configuration

Update Business

PUT /v1/businesses/{id}
SDK: sdk.business.updateBusiness()

Update business settings.

const result = await sdk.business.updateBusiness({
id: 'biz_abc123',
key: 'my-updated-store',
networkKey: null,
timezone: 'America/New_York',
status: 'ACTIVE',
configs: {
  webhookUrl: 'https://yourapp.com/webhooks',
  webhookEvents: ['order.created', 'order.paid']
}
});

Parameters

Name Type Description
id required string Business ID
key required string Business key
networkKey required string | null Network key (null if standalone)
timezone required string Business timezone (IANA format)
status required DRAFT | ACTIVE | ARCHIVED Business status
configs required object Business configuration object

Delete Business

DELETE /v1/businesses/{id}
SDK: sdk.business.deleteBusiness()

Permanently delete a business and all associated data.

Warning

This action is irreversible. All products, orders, reservations, and content will be permanently deleted.

await sdk.business.deleteBusiness({
  id: 'biz_abc123'
});

Business Hierarchy

Get Parent Businesses

GET /v1/businesses/{businessId}/parents
SDK: sdk.business.getBusinessParents()

Retrieve the parent chain for a business.

const parents = await sdk.business.getBusinessParents({});

// Returns array from immediate parent to root
parents.forEach(parent => {
  console.log(parent.key);
});

Subscriptions

Get Subscription Plans

GET /v1/businesses/plans
SDK: sdk.business.getSubscriptionPlans()

List available subscription plans.

const plans = await sdk.business.getSubscriptionPlans({});

plans.forEach(plan => {
  console.log(plan.name, plan.price, plan.features);
});

Get Current Subscription

GET /v1/businesses/{businessId}/subscription
SDK: sdk.business.getSubscription()

Get the current subscription status for a business.

const subscription = await sdk.business.getSubscription({});

console.log(subscription.plan, subscription.status, subscription.currentPeriodEnd);

Subscribe to Plan

PUT /v1/businesses/{businessId}/subscribe
SDK: sdk.business.subscribe()

Subscribe a business to a plan. Returns a Stripe checkout URL for payment.

const result = await sdk.business.subscribe({
planId: 'plan_pro',
successUrl: 'https://yourapp.com/subscription/success',
cancelUrl: 'https://yourapp.com/subscription/cancel'
});

// Redirect to Stripe checkout
if (result.url) {
window.location.href = result.url;
}

Parameters

Name Type Description
planId required string Plan ID to subscribe to
successUrl required string URL to redirect after successful payment
cancelUrl required string URL to redirect if payment is cancelled

Create Billing Portal Session

POST /v1/businesses/{businessId}/subscription/portal
SDK: sdk.business.createPortalSession()

Create a Stripe Customer Portal session for subscription management.

const result = await sdk.business.createPortalSession({
  returnUrl: 'https://yourapp.com/settings/billing'
});

// Redirect to Stripe portal
window.location.href = result.url;

Parameters

Name Type Description
returnUrl required string URL to return to after portal session

Team Management

Invite User

POST /v1/businesses/{businessId}/invitation
SDK: sdk.business.inviteUser()

Send an invitation to join the business team.

await sdk.business.inviteUser({
email: '[email protected]',
role: 'Admin'  // 'Admin' | 'Owner' | 'Super'
});

Parameters

Name Type Description
email required string Invitee email address
role optional Admin | Owner | Super Role to assign (defaults to Admin)

Handle Invitation

PUT /v1/businesses/{businessId}/invitation
SDK: sdk.business.handleInvitation()

Accept or decline an invitation.

// Accept invitation
await sdk.business.handleInvitation({
token: 'invitation_token_from_email',
action: 'ACCEPT'
});

// Reject invitation
await sdk.business.handleInvitation({
token: 'invitation_token_from_email',
action: 'REJECT'
});

Parameters

Name Type Description
token required string Invitation token from email
action required ACCEPT | REJECT Action to take

Webhooks

Test Webhook

POST /v1/businesses/{businessId}/webhooks/test
SDK: sdk.business.testWebhook()

Send a test webhook to verify your endpoint configuration.

await sdk.business.testWebhook({
webhook: {
  url: 'https://yourapp.com/webhooks',
  events: ['order.created', 'order.paid'],
  secret: 'whsec_...'
}
});

console.log('Webhook test sent successfully');

Parameters

Name Type Description
webhook required object Webhook configuration object with url, events, and optional secret

Media

Get Business Media

GET /v1/businesses/{id}/media
SDK: sdk.business.getBusinessMedia()

List all media files for a business.

const result = await sdk.business.getBusinessMedia({
  id: 'biz_abc123',
  limit: 50,
  cursor: null,
  query: 'product',
  mimeType: 'image/jpeg',
  sortField: 'createdAt',
  sortDirection: 'desc'
});

result.items.forEach(media => {
  console.log(media.id, media.url);
});

Parameters

Name Type Description
id required string Business ID
limit required number Items per page
cursor optional string Pagination cursor
ids optional string[] Filter by specific media IDs
query optional string Search query
mimeType optional string Filter by MIME type
sortField optional string Sort field
sortDirection optional asc | desc Sort direction

Refunds

Process Refund

POST /v1/businesses/{id}/refund
SDK: sdk.business.processRefund()

Process a refund for a payment.

await sdk.business.processRefund({
id: 'biz_abc123',
entity: 'ord_xyz789',  // Order or reservation ID
amount: 1999  // Partial refund in cents
});

Parameters

Name Type Description
id required string Business ID
entity required string Order or reservation ID to refund
amount required number Amount in cents to refund

Business Events

Get Business Events

GET /v1/businesses/{businessId}/events
SDK: sdk.business.getBusinessEvents()

Retrieve business events for a specific entity type.

const result = await sdk.business.getBusinessEvents({
  entity: 'order',
  limit: 50,
  cursor: null
});

result.items.forEach(event => {
  console.log(event.type, event.payload);
});

Parameters

Name Type Description
entity required string Entity type (order, reservation, etc.)
limit optional number Items per page
cursor optional string Pagination cursor

Update Business Event Payload

PUT /v1/businesses/{businessId}/events/{eventId}
SDK: sdk.business.updateBusinessEventPayload()

Update the payload of a business event.

await sdk.business.updateBusinessEventPayload({
  eventId: 'evt_abc123',
  payload: {
    type: 'email',
    templateKey: 'order-confirmation',
    recipients: ['[email protected]']
  }
});

Parameters

Name Type Description
eventId required string Event ID to update
payload required BusinessEventAction Updated event payload

Build Triggers

Trigger Builds

POST /v1/businesses/{id}/trigger-builds
SDK: sdk.business.triggerBuilds()

Trigger connected CI/CD builds (e.g., for static site regeneration).

await sdk.business.triggerBuilds({
  id: 'biz_abc123'
});

Parameters

Name Type Description
id required string Business ID