merce.STACK
merce.STACK
Skip to content
PricingDevelopersSecurityAbout
Log inGet started

Commerce API

  • Quickstart
  • Keys & authentication
  • Products & catalog
  • Carts
  • Checkout & payment
  • Digital products
  • Webhooks
  • Errors
  • Without a build step
  • API reference

Commerce API

Build a shop on anything.

Four lines from an empty page to a paid order. Start here.

Mercestack Commerce is a headless commerce engine. Your catalog, pricing, stock, checkout, payments and orders live on our side; the shop front is yours to build in whatever you already use — Next.js, React, Vue, Laravel, a mobile app, or plain HTML.

If you would rather not build one at all, every workspace gets a hosted storefront that runs on this same API. Nothing here is a private endpoint reserved for it.

Install

pnpm add @mercestack/commerce

Sell something

import { Mercestack } from "@mercestack/commerce";

const mercestack = new Mercestack({ publicKey: "pk_live_…" });

const { products } = await mercestack.getProducts();

await mercestack.addToCart({
  variantId: products[0].variants[0].id,
  quantity: 1,
});

await mercestack.openCheckout();

That is the whole integration. There is no cart to create first, no session to establish, and no id to hold on to — the first call that needs a cart makes one and remembers it.

Your key lives in Commerce → Developers

Create a publishable key there. Test keys (pk_test_…) produce real carts and orders flagged as test data, so you can build against your live catalog without touching your revenue figures.

Everything else

  • Keys & authenticationTwo kinds of key, with different rules — and the rules are enforced, not advised.
  • Products & catalogReading the shop: products, variants, collections, search.
  • CartsServer-backed, so nothing about money can be edited by the browser.
  • Checkout & paymentOne call. Revalidated server-side, idempotent, stock held safely.
  • Digital productsSell files, licences and downloads. Delivered the moment payment clears.
  • WebhooksSigned, retried and replayable. Add endpoints in Developers.
  • ErrorsOne error type, stable codes. Branch on the code, never the text.
  • Without a build stepA script tag and a data attribute. For WordPress, Webflow and plain HTML.
  • API referenceEndpoints, limits, versioning and the SDK surface.
Create a workspaceTalk to usPricing

The business operating system. One workspace for structure, customers, communication, money and the automation between them.

Create your workspace

Platform

  • Overview
  • Structure & work
  • Customers & communication
  • Finance & commerce
  • Flow & AI Workforce
  • Analytics & files

Developers

  • Documentation
  • Quickstart
  • Keys & authentication
  • Carts & checkout
  • Webhooks
  • API reference

Company

  • About
  • Pricing
  • Security
  • Contact
  • Report a vulnerability

Legal

  • Privacy
  • Terms
  • Cookie policy
  • GDPR
  • Privacy contact

© 2026 Mercestack. All rights reserved.

Mercestack StructureOS