cimplify

TypeScript SDK

Type-safe, browser-first client for the Cimplify Commerce API.

TS
import { createCimplifyClient } from '@cimplify/sdk'

const client = createCimplifyClient({ publicKey: 'pk_test_...' })

// Every method returns Result<T>
const result = await client.catalogue.getProducts({ limit: 10 })

if (!result.ok) {
  console.error(result.error.code, result.error.message)
  return
}

console.log(result.value.items)

Installation

curl
npm install @cimplify/sdk

Result Pattern

All SDK methods return a discriminated union. Check result.ok before accessing result.value.

TS
type Result<T> =
  | { ok: true; value: T }
  | { ok: false; error: CimplifyError }

type CimplifyError = {
  code: string
  message: string
  retryable: boolean
  suggestion?: string
  docs_url?: string
}

Services

ServiceDescription
client.businessBusiness info, locations, hours
client.catalogueProducts, categories, collections, bundles, composites, quotes
client.cartCart mutations, coupons, totals
client.authOTP login, session status, profile updates
client.checkoutProcess checkout, poll payment status
client.ordersList, get, and cancel orders
client.linkSaved addresses, payment methods, sessions (like Shop Pay)
client.fxExchange rates and currency conversion
client.inventoryStock levels and availability checks
client.schedulingServices, available time slots, bookings

Configuration

OptionDefaultDescription
publicKeyNEXT_PUBLIC_CIMPLIFY_PUBLIC_KEYYour public API key (pk_test_... or pk_live_...)
baseUrlauto-derivedOverride storefront API base URL
linkApiUrlauto-derivedOverride Link API base URL
timeout30000Request timeout in ms
maxRetries3Retry count for retryable errors
retryDelay1000Base delay between retries (exponential backoff)
hooks{}Observability hooks: onRequestStart, onRequestSuccess, onRequestError, onRetry, onSessionChange

Package Exports

ImportContents
@cimplify/sdkcreateCimplifyClient, CimplifyError, generateIdempotencyKey
@cimplify/sdk/reactReact bindings: ElementsProvider, AuthElement, PaymentElement, AddressElement
@cimplify/sdk/utilsformatPrice, parsePrice
@cimplify/sdk/advancedCheckoutResolver for low-level checkout orchestration

Utilities

TS
import { formatPrice, parsePrice } from '@cimplify/sdk/utils'

formatPrice(1999, 'USD')  // "$19.99"
parsePrice('19.99')        // 19.99

Next Steps