Store
BIAB's e-commerce engine powers products, categories, cart, checkout, subscriptions, shipping, and coupons. The SDK exposes everything you need to build a custom storefront on your own site.
Products
// List products with pagination and filtering
const result = await client.storefront.listProducts({
limit: 20,
offset: 0,
category: 'services',
sort: 'price_asc',
})
const { items, total } = result
// items → [{ id, title, description, price, images, variants, ... }, ...]
// Same shape, but includes inventory counts and SEO metadata
const full = await client.storefront.listProductsWithMeta({ limit: 10 })
// Categories
const categories = await client.storefront.listCategories()
// → [{ id, name, slug, productCount, image }, ...]
// Single product
const product = await client.storefront.getProduct('product-slug')
Addons & Related
const addons = await client.storefront.getProductAddons('product-slug')
// → [{ id, title, price, type: 'checkbox' | 'radio' | 'select' }, ...]
const related = await client.storefront.getRelatedProducts('product-slug')
// → [{ id, title, price, image }, ...]
Reviews
const reviews = await client.storefront.getProductReviews('product-slug')
// → [{ id, author, rating, content, createdAt }, ...]
Cart
// Get the current cart
const cart = await client.cart.get()
// Add an item
await client.cart.addItem({ productId: 'prod-1', quantity: 2, addonIds: ['addon-a'] })
// Update or remove
await client.cart.updateItem({ cartItemId: 'ci-1', quantity: 3 })
await client.cart.removeItem('ci-1')
// Coupons
await client.cart.applyCoupon('SAVE20')
await client.cart.removeCoupon()
// Clear the cart
await client.cart.clear()
Checkout
// Create a checkout session
const session = await client.checkout.createSession({
successUrl: 'https://mysite.com/order/confirmed',
cancelUrl: 'https://mysite.com/cart',
})
// Start the hosted checkout flow
const result = await client.checkout.start(session.id)
// Poll for status
const status = await client.checkout.getStatus(session.id)
// → 'pending' | 'completed' | 'failed'
BIAB Checkout handles payment collection, tax calculation, and order storage.
Coupons
Validate a coupon code before applying it to a cart:
const result = await client.coupons.validate('SAVE20')
// → { valid: true, discount: 20, type: 'percentage' | 'fixed', ... }
Subscriptions
// List available subscriptions
const plans = await client.subscriptions.list()
// → [{ id, title, price, interval: 'month' | 'year', description }, ...]
// Start a subscription checkout
const session = await client.subscriptions.startCheckout({
subscriptionId: 'sub-plan-1',
successUrl: 'https://mysite.com/thank-you',
cancelUrl: 'https://mysite.com/pricing',
})
Shipping
// Get shipping rates for a cart
const rates = await client.shipping.getRates({ address: { zip: '10001' } })
// → [{ id, carrier, method, price, estimatedDays }, ...]
// Track a shipment
const tracking = await client.shipping.track('tracking-number')
// → [{ status, location, timestamp }, ...]
// Read account shipping settings
const settings = await client.shipping.settings()
// → { origin, defaultCarrier, packageDefaults }
Address Autocomplete
// Search addresses
const results = await client.address.search({ query: '123 Main' })
// → [{ formatted, street, city, state, zip }, ...]
// Get details for a selected address
const details = await client.address.getDetails(results[0].id)
// Verify an address
const verified = await client.address.verify({ street, city, state, zip })
React Storefront Components
import { Storefront, Cart, Checkout, CheckoutResult } from '@biab-dev/sdk/react'
// Drop-in product listing
<Storefront category="services" />
// Cart widget (renders the current cart with quantity controls)
<Cart />
// Checkout button (opens the hosted BIAB checkout)
<Checkout productId="prod-1" />
// Post-checkout result display
<CheckoutResult sessionId="sess-1" />