merce.STACK
merce.STACK
Skip to content
PricingDevelopersSecurityAbout
Log inRequest access
{}Developers
GuidesAPI referenceChangelogGet API keys →
  • Get started

    • Quickstart
    • Keys & authentication
  • Storefront

    • Products & catalog
    • Carts
    • Checkout & payment
    • Customer accounts
    • Digital products
    • Without a build step
  • Server API

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

    • Webhooks
    • Errors
  • Reference

    • API reference
    • Changelog

Server API

Node SDK

`@mercestack/node` — a typed client for the server API.

Shell
pnpm add @mercestack/node
TypeScript
import { Mercestack } from "@mercestack/node";

const mercestack = new Mercestack(process.env.MERCESTACK_SECRET_KEY!);

const link = await mercestack.paymentLinks.create(
  { title: "Invoice 88", amount: "150000" },
  { idempotencyKey: "invoice-88" },
);
  • —Throws on a publishable key before sending anything.
  • —Retries network errors, 429 and 5xx — but a create only when you gave it an idempotencyKey, so a retry can't charge twice.
  • —.all() on customers and transactions walks every page for you.
  • —Errors are MercestackError with status, code, message and requestId.

Webhooks

TypeScript
app.post("/mercestack", express.raw({ type: "application/json" }), (req, res) => {
  const event = mercestack.webhooks.constructEvent(
    req.body,                                  // the raw bytes
    req.header("Mercestack-Signature"),
    process.env.MERCESTACK_WEBHOOK_SECRET!,
  );
  if (event.type === "payment_link.paid") fulfil(event.data);
  res.sendStatus(200);
});

Methods

TypeScript
mercestack.customers.list(params)      .retrieve(id)   .create(input)   .update(id, input)   .all()
mercestack.paymentLinks.list(params)   .retrieve(id)   .create(input)   .deactivate(id)
mercestack.transactions.list(params)   .retrieve(idOrReference)         .all()
mercestack.balance.retrieve()
mercestack.payouts.list()
mercestack.classrooms.list()           .retrieve(id)
mercestack.classrooms.enrollments.list(classId)       .create(classId, input)
mercestack.products.list()             .retrieve(id)
mercestack.orders.list()               .retrieve(id)
mercestack.webhooks.constructEvent(rawBody, signature, secret)
← PreviousClasses & studentsNext →Webhooks

On this page

  • Webhooks
  • Methods
Request accessTalk to usPricing

Mercestack is the business operating system — your team, customers, store, classes and payouts in one place.

Request access

Platform

  • Overview
  • Organization & work
  • Customers, support & messaging
  • Payments, store & classes
  • Flow, AI & Marverse
  • Analytics, growth & files

Developers

  • Quickstart
  • Server API
  • Customer accounts
  • Payment links
  • Webhooks
  • Changelog

Company

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

Legal

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

© 2026 Mercestack. All rights reserved.

Mercestack StructureOS

mercestack