Store

The store's own identity: its name, its slug and its brand (what the merchant set under Settings, Brand). One anonymous read, usually at layout level, so a storefront titles, heads and foots itself with the merchant's name and never hardcodes one. Logo URLs are public. Colors are #rrggbb. Every field except name and slug may be null.

SDK module: @cartbase/storefront/api/store (from 0.8.0; on 0.7.0 call client.request("/api/store/store") with the same shape).


GET /api/store/store

  • Purpose: read the store's id, name, slug and brand.
  • Auth: anon: the store's publishable key (Cartbase-Key).
  • Request: GET /api/store/store
  • Response 200
{
  "store": {
    "id": "1e7a4c02-9b31-4f7e-8d2a-5c6f90ab12cd",   // the store's public id (what PlatformInit mounts)
    "name": "Demo Store",
    "slug": "demo-store",
    "brand": {
      "logo_url": "https://…/brand/…/logo.png",   // or null
      "logo_dark_url": "https://…/brand/…/logo-dark.png", // or null
      "logo_square_url": null,
      "color_primary": "#111111",                  // or null
      "color_secondary": null,
      "slogan": null,
      "social": {                                  // the profiles set, by network; {} when none
        "facebook": "https://www.facebook.com/…",
        "instagram": "https://www.instagram.com/…"
      }
    },
    "accounts": { "mode": "optional" }             // "disabled" | "optional" | "required"
  }
}

social is set on the admin's Settings, Brand (Social links). Draw it with SocialLinks from @cartbase/storefront/common (components.md, Family: common).

accounts.mode is the admin's Settings, Customer accounts: a storefront shows its sign-in door unless it is disabled (the code doors then answer 403 accounts_disabled, auth.md); required asks for a sign-in before checkout.

curl -sf "$BASE/api/store/store" -H "x-client-id: $CLIENT_ID" \
  | grep -Eq '"accounts":\{"mode":"(disabled|optional|required)"\}'

GET /api/store/payment-marks: the store's payment marks

  • Purpose: the payment marks a footer shows, read from the store's Stripe account: every card brand (Visa, Mastercard, Maestro, American Express, UnionPay, Discover, Diners Club, JCB) when cards are on, and Apple Pay, Google Pay, PayPal, Revolut, Klarna, Bancontact and iDEAL each when Stripe has that method on. No merchant switch: a mark follows what the store can charge. Empty with no Stripe. Held at the edge with the shell.

  • Response: { "payment_marks": ["visa", "mastercard", …, "applepay", "googlepay"] }, in the package's order.

  • SDK: getPaymentMarks(client) (api/store); draw with PaymentIcons (common/payment-icons).

  • Errors: 404 store_not_found when the key names no live store.

import { cacheLife, cacheTag } from "next/cache"
import { getStore } from "@cartbase/storefront/api/store"

// A cached read with the catalogue client (BUILD-A-STOREFRONT.md step 3).
// The tag is what lets a publish refresh it.
async function readStore() {
  "use cache: remote"
  cacheLife("catalog")
  cacheTag("catalog")
  return (await getStore(storeClient)).store
}

export async function generateMetadata() {
  const store = await readStore()
  return createStorefrontMetadata({ title: store.name, description: store.brand.slogan ?? undefined })
}