merce.STACK
merce.STACK
Skip to content
PricingWhat's new
Log inGet started
{}Developers
GuidesAPI referenceChangelogGet API keys →
  • Get started

    • Quickstart
    • Keys & authentication
  • Storefront

    • Products & catalog
    • Carts
    • Checkout & payment
    • Customer accounts
    • Digital products
    • Without a build step
    • Bookings
    • Courses
    • Drop-in components
  • Server API

    • Server API
    • Customers
    • Payment links & transactions
    • Balance & payouts
    • Classes & students
    • Node SDK
  • Email API

    • Email API
    • Sending email
    • Delivery events
  • Events & errors

    • Webhooks
    • Errors
  • Reference

    • API reference
    • Changelog

MERCESTACK PAYMENTS · DEVELOPER GUIDES

Build commerce, payments and classes into anything.

One API for your shop front, your backend and your webhooks. Typed SDKs, test keys that never touch your numbers, and a reference that shows the exact request to send.

QuickstartServer API reference
import { Mercestack } from "@mercestack/commerce";

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

await shop.addToCart({ variantId, quantity: 1 });
await shop.openCheckout();
pk_…Storefront APICatalog, cart, checkout and customer accounts from any front end, with a publishable key.Read →sk_…Server APICustomers, payment links, transactions, payouts and classes from your backend.Read →eventsWebhooksSigned, retried events when an order is paid, a link is settled or a payout lands.Read →npmSDKs@mercestack/commerce for the browser and React, @mercestack/node for servers.Read →

Quickstart

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

Shell
pnpm add @mercestack/commerce

Sell something

TypeScript
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.

Popular

  • Customer accountsSign up, sign in with a password or Google, sign out, reset a password, keep addresses.
  • Payment links & transactionsAsk to be paid with a link, then see whether it was.
  • WebhooksSigned, retried and replayable. Add endpoints in Developers.
  • Keys & authenticationTwo kinds of key, with different rules — and the rules are enforced, not advised.
  • ErrorsOne error type, stable codes. Branch on the code, never the text.
  • ChangelogWhat changed in the API, newest first. Nothing here breaks /v1.
Create a workspaceTalk to usPricing

One workspace for everything your business runs on — your team, customers, store, marketing and payouts in one place.

Get started

Product

  • All products
  • Pricing
  • What's new
  • Security

Resources

  • Documentation
  • Guides
  • Use cases
  • Blog
  • Get support

Company

  • About
  • Careers
  • Contact us
  • Talk to the team

Legal

  • Privacy
  • Terms
  • Cookie policy
  • GDPR
  • Report a vulnerability

© 2026 Mercestack. All rights reserved.

Mercestack StructureOS

mercestack