SazitoSazito SDKv1.2.2
Getting Started

Quickstart

Fetch products, handle errors, and bootstrap cart/invoice state.

Basic read flow

import { createSazitoClient } from '@sazito/client-sdk';

const client = createSazitoClient({
  domain: 'mystore.sazito.com',
});

const productsRes = await client.products.list({
  page: 1,
  pageSize: 12,
  sort: 'newest',
});

if (productsRes.error) {
  console.error(productsRes.error.message);
} else {
  console.log(productsRes.data.items);
}

Single product by URL path or slug

const byPath = await client.products.get('/product/running-shoe-pro');
const bySlug = await client.products.get('running-shoe-pro');

Minimal cart and invoice bootstrap

const cartRes = await client.cart.addItemWithAttributes(12345, 1);
if (cartRes.error) {
  throw new Error(cartRes.error.message);
}

const invoiceRes = await client.invoices.create();
if (invoiceRes.error) {
  throw new Error(invoiceRes.error.message);
}

console.log(invoiceRes.data.totalPrice);

Authenticated profile call

client.setAuthToken('<jwt>');
const me = await client.users.getCurrentUser();

Every SDK method returns a unified response object. Always branch on response.error before reading response.data.

On this page