SDK Libraries

NPM SDK

Install the official MakePay JavaScript and TypeScript SDK for payment links, settings, and webhook verification.

MakePay NPM SDK

Overview

@makecrypto/makepay is the official JavaScript and TypeScript SDK for MakePay server-side integrations. It wraps API-key authentication, payment and donation links, anonymous public links, customers, subscriptions, invoices, bookkeeping, POS terminals, product catalogs, Simple Shop, branded domains, operational APIs, and signed webhook verification.

Package:

@makecrypto/makepay

Public source repository:

https://github.com/makepay-io/makepay-npm-sdk

Installation

npm install @makecrypto/makepay
pnpm add @makecrypto/makepay

The SDK targets Node.js 18 or newer and uses the runtime fetch implementation.

Authentication

Create a MakePay API key from the MakeCrypto merchant developer area and store the key secret only on your server.

import { MakePayClient } from "@makecrypto/makepay";

const makepay = new MakePayClient({
  keyId: process.env.MAKEPAY_KEY_ID!,
  keySecret: process.env.MAKEPAY_KEY_SECRET!,
});

The SDK sends x-makecrypto-key-id and x-makecrypto-key-secret headers to the MakePay partner API. You can pass baseUrl for a non-production MakeCrypto API origin, and checkoutBaseUrl for a custom MakePay checkout origin.

const response = await makepay.createPaymentLink({
  title: "Order #1042",
  description: "Checkout for order #1042",
  amount: "129.99",
  currency: "USDT",
  orderId: "order_1042",
  customerEmail: "buyer@example.com",
  returnUrl: "https://merchant.example/orders/1042",
  successUrl: "https://merchant.example/orders/1042/success",
  failureUrl: "https://merchant.example/orders/1042/pay",
  expirationTime: "12h",
});

console.log(response.paymentLink.publicUrl);

Send a payment request email during creation:

await makepay.createPaymentLink(payload, {
  sendPaymentRequestEmail: true,
});

Read and manage existing links:

await makepay.listPaymentLinks();
await makepay.getPaymentLink("PAYMENT_LINK_UID");
await makepay.updatePaymentLink("PAYMENT_LINK_UID", { status: "paused" });
await makepay.sendPaymentRequestEmail("PAYMENT_LINK_UID", "buyer@example.com");

Donation links use the same settlement and checkout infrastructure as payment links, but they publish a public donation slug and allow flexible donor amounts.

const donation = await makepay.createDonationLink({
  title: "Spring campaign",
  description: "Support the 2026 spring fundraiser.",
  defaultAmountUsd: "25",
  minimumAmountUsd: "5",
  donationSlug: "spring-campaign",
});

console.log(donation.paymentLink.publicUrl);

await makepay.listDonationLinks();
await makepay.getDonationLink("DONATION_UID");
await makepay.updateDonationLink("DONATION_UID", { status: "paused" });

Use anonymous links when a payment page should be created without a MakePay API key. Because there is no authenticated merchant account, the request must include settlement routing.

import { createAnonymousPaymentLink } from "@makecrypto/makepay";

const response = await createAnonymousPaymentLink({
  amount: "25",
  settlement: {
    currency: "USDT",
    priorities: [
      {
        chain: "ETH",
        address: "0xYourSettlementWallet",
        asset: "ETH.USDT-0xdAC17F958D2ee523a2206206994597C13D831ec7",
      },
    ],
  },
  title: "Invoice #1042",
  customerEmail: "buyer@example.com",
  webhookUrl: "https://merchant.example/webhooks/makepay",
});

Anonymous link payloads support title, description, orderId, clientId, customerEmail, returnUrl, successUrl, failureUrl, metadata, branding, webhookUrl, and expirationTime values from 15 minutes to 72 hours.

Hosted And Embedded Checkout

Use hosted checkout URLs for full-page redirects, or the embed helpers when your frontend keeps the shopper on the merchant page.

import {
  buildMakePayEmbeddedCheckoutUrl,
  buildMakePayHostedCheckoutUrl,
  mountMakePayCheckout,
  openMakePayCheckout,
} from "@makecrypto/makepay";

const paymentUid = response.paymentLink.uid;

const hostedUrl = buildMakePayHostedCheckoutUrl(paymentUid);
const embedUrl = buildMakePayEmbeddedCheckoutUrl(paymentUid, {
  parentOrigin: "https://merchant.example",
  viewType: "minimal",
});

await openMakePayCheckout({
  paymentUid,
  viewType: "minimal",
  onEvent(event) {
    if (event.type === "makepay.payment.redirect_requested") {
      window.location.assign(String(event.payload?.redirectUrl || hostedUrl));
    }
  },
});

mountMakePayCheckout({
  container: "#makepay-checkout",
  paymentUid,
  viewType: "minimal",
});

Embedded checkout accepts viewType: "full" | "minimal". The default "full" view keeps the current hosted-payment style with the payment summary. Use "minimal" when the embed sits inside your own checkout page or modal and should show only the compact payment area.

Donation pages have hosted and embedded URL helpers too:

makepay.hostedDonationUrl("spring-campaign");
makepay.embeddedDonationUrl("spring-campaign", {
  parentOrigin: "https://merchant.example",
  viewType: "minimal",
});

For static CMS pages, buildMakePayEmbedButtonHtml(paymentUid) returns a button snippet that loads the MakePay modal script. Pass { viewType: "minimal" } to button, iframe, modal, or URL helpers when you want the compact embed view.

Customers

await makepay.upsertCustomer({
  email: "buyer@example.com",
  name: "Buyer Example",
  clientId: "crm_123",
  metadata: { plan: "pro" },
});

await makepay.listCustomers();

await makepay.createCustomerPortal("CUSTOMER_ID", {
  returnUrl: "https://merchant.example/account",
});

Subscriptions

await makepay.createSubscription({
  amountUsd: "29",
  customerEmail: "buyer@example.com",
  label: "Monthly plan",
  billingIntervalUnit: "month",
  billingIntervalCount: 1,
  sendPaymentRequestEmail: true,
});

await makepay.listSubscriptions();

Subscription invoice payment links are generated by the subscription API. Do not create subscription_invoice links directly through createPaymentLink.

POS Terminals

const terminal = await makepay.createPosTerminal({
  name: "Front counter",
  pin: "1234",
  allowedAssets: ["ETH.USDT-0xdAC17F958D2ee523a2206206994597C13D831ec7"],
  emailCollectionMode: "optional_after_deposit",
  catalogEnabled: true,
});

await makepay.listPosTerminals();
await makepay.getPosTerminal(String(terminal.terminal.uid));
await makepay.updatePosTerminal(String(terminal.terminal.uid), {
  name: "Front counter",
  pin: "5678",
  catalogEnabled: true,
});

Products

Products power POS catalogs and Simple Shop storefronts.

await makepay.createProduct({
  name: "Digital guide",
  productType: "digital",
  basePriceUsd: "19",
  shopSlug: "digital-guide",
  images: [{ url: "https://merchant.example/guide.png", alt: "Guide cover" }],
  variants: [{ name: "PDF", priceUsd: "19" }],
  taxRates: [{ name: "VAT", rateBps: 2000, isDefault: true }],
});

await makepay.listProducts();
await makepay.getProduct("PRODUCT_UID");
await makepay.updateProduct("PRODUCT_UID", {
  name: "Digital guide",
  status: "active",
});

Digital products can include downloads:

await makepay.createProductDownload("PRODUCT_UID", {
  fileName: "guide.pdf",
  contentType: "application/pdf",
  url: "https://merchant.example/downloads/guide.pdf",
});

await makepay.listProductDownloads("PRODUCT_UID");

Simple Shop

await makepay.updateShop({
  slug: "merchant-shop",
  displayCurrency: "USD",
  checkoutMode: "hosted",
  billingDetailsRequired: true,
  flatShippingFeeUsd: "5",
  freeShippingThresholdUsd: "100",
  branding: { accentColor: "#14b8a6" },
});

await makepay.getShop();
await makepay.updateShopBuilder({ blocks: [] });
await makepay.getShopBuilder();

Connect and verify a shop domain:

await makepay.updateShopDomain("shop.merchant.example");
await makepay.getShopDomain();
await makepay.refreshShopDomain();

Manage coupons and orders:

await makepay.createShopCoupon({
  code: "SPRING10",
  discountType: "percent",
  value: "10",
});

await makepay.listShopCoupons();
await makepay.updateShopCoupon("COUPON_UID", { status: "archived" });
await makepay.archiveShopCoupon("COUPON_UID");
await makepay.listShopOrders({ status: "paid", limit: 25 });

Invoices And Bookkeeping

Bookkeeping APIs manage merchant invoices, expenses, contacts, supporting documents, OCR, and reconciliation links. Contacts are shared across customer and vendor workflows: when the same email is used as a customer and vendor, the bookkeeping contact is marked as both.

const invoice = await makepay.createBookkeepingInvoice({
  title: "Invoice #1042",
  currency: "USD",
  issueDate: "2026-05-15",
  dueDate: "2026-05-30",
  counterparty: {
    name: "Buyer Example",
    email: "buyer@example.com",
    clientId: "crm_123",
  },
  lineItems: [
    {
      description: "Implementation services",
      quantity: "1",
      unitAmount: "500",
      taxAmount: "0",
    },
  ],
  metadata: { orderId: "order_1042" },
});

await makepay.createBookkeepingInvoicePaymentLink("INVOICE_UID", {
  sendPaymentRequestEmail: true,
});

await makepay.listBookkeepingInvoices();
await makepay.getBookkeepingInvoice("INVOICE_UID");
await makepay.updateBookkeepingInvoice("INVOICE_UID", { status: "open" });

Create and reconcile expenses manually or from wallet activity:

await makepay.createBookkeepingExpense({
  title: "Hosting",
  amount: "49",
  currency: "USD",
  incurredOn: "2026-05-15",
  category: "Infrastructure",
  counterparty: {
    name: "Vendor Example",
    email: "billing@vendor.example",
    type: "vendor",
  },
});

await makepay.createBookkeepingExpenseFromActivity({
  walletActivityEventKey: "CHAIN_EVENT_KEY",
  category: "Settlement",
});

await makepay.createBookkeepingReconciliation({
  invoiceId: "INVOICE_UID",
  paymentSessionId: "PAYMENT_SESSION_ID",
  linkType: "payment",
});

Wallet activity saves use the same behavior for outgoing chain transfers: MakeCrypto creates or updates a single paired expense, carries over private receipt or invoice files attached to the transfer, and keeps the reconciliation linked by wallet activity ID.

Document uploads use multipart form data through Blob or File.

await makepay.uploadBookkeepingDocument({
  file: new Blob([receiptBytes], { type: "application/pdf" }),
  fileName: "receipt.pdf",
  documentType: "receipt",
  expenseId: "EXPENSE_UID",
});

await makepay.uploadBookkeepingDocument({
  file: new Blob([invoiceBytes], { type: "application/pdf" }),
  fileName: "supplier-invoice.pdf",
  documentType: "invoice",
  walletActivityEventKey: "CHAIN_EVENT_KEY",
});

await makepay.listBookkeepingDocuments();
await makepay.getBookkeepingDocumentDownloadUrl("DOCUMENT_UID");
await makepay.runBookkeepingDocumentOcr("DOCUMENT_UID");
await makepay.getBookkeepingSummary();

Branding And Domains

Branding controls merchant display details, checkout theme colors, payment-link domains, and email-sending domains.

await makepay.updateBranding({
  brandName: "Merchant",
  businessDescription: "Digital products and services.",
  websiteUrl: "https://merchant.example",
  supportEmail: "support@merchant.example",
  brandingBrandColor: "#111827",
  brandingBrandTextColor: "#ffffff",
  brandingAccentColor: "#14b8a6",
  brandingAccentTextColor: "#ffffff",
  paymentLinkTheme: "system",
  paymentLinkDomain: "pay.merchant.example",
  emailSendingDomain: "mail.merchant.example",
});

const branding = await makepay.getBranding();
await makepay.refreshBrandingDomains("all");

Use refreshBrandingDomains("payment-link") or refreshBrandingDomains("email-sending") when you only need one domain check.

Operational APIs

await makepay.getSettings();
await makepay.updateSettings({
  callbackUrl: "https://merchant.example/webhooks/makepay",
});

await makepay.listDestinationAssets();
await makepay.listWebhookRequests({ limit: 25 });

listDestinationAssets is useful before configuring settlement overrides or anonymous settlement routes.

Webhook Verification

Read the exact raw body before parsing JSON.

import { parseMakePayWebhook } from "@makecrypto/makepay";

export async function POST(request: Request) {
  const rawBody = await request.text();
  const event = parseMakePayWebhook(
    rawBody,
    request.headers.get("x-makepay-signature"),
    process.env.MAKEPAY_WEBHOOK_SECRET!,
  );

  if (event.event?.type === "status_changed") {
    // Update your local order.
  }

  return new Response("ok");
}

Use verifyMakePayWebhook when you only need a boolean result.

SDK Method Coverage

AreaMethods
Payment linkscreatePaymentLink, listPaymentLinks, getPaymentLink, updatePaymentLink, sendPaymentRequestEmail
DonationscreateDonationLink, listDonationLinks, getDonationLink, updateDonationLink
Anonymous linkscreateAnonymousPaymentLink
Checkouthosted, embedded, modal, button, iframe, and donation URL helpers
CustomerslistCustomers, upsertCustomer, createCustomerPortal
SubscriptionslistSubscriptions, createSubscription
POS terminalslistPosTerminals, createPosTerminal, getPosTerminal, updatePosTerminal
ProductslistProducts, createProduct, getProduct, updateProduct, listProductDownloads, createProductDownload
Simple ShopgetShop, updateShop, getShopBuilder, updateShopBuilder, getShopDomain, updateShopDomain, refreshShopDomain, coupon and order methods
Bookkeepingsummary, invoice, expense, document upload/OCR, and reconciliation methods
BrandinggetBranding, updateBranding, refreshBrandingDomains
OperationsgetSettings, updateSettings, listDestinationAssets, listWebhookRequests
WebhooksverifyMakePayWebhook, parseMakePayWebhook

TypeScript, Data Models, And Response Models

@makecrypto/makepay is written in TypeScript and ships declaration files in the same npm package. You do not need a secondary SDK package or a separate @types package.

import type {
  MakePayBookkeepingInvoicePayload,
  MakePayBookkeepingSummaryResponse,
  MakePayPaymentLinkPayload,
  MakePayPaymentLinkResponse,
} from "@makecrypto/makepay";

Model conventions:

  • SDK payloads use camelCase. Some API routes also accept snake_case for compatibility, but new integrations should send camelCase.
  • Use strings for decimal money values when precision matters, for example "129.99" instead of 129.99.
  • Dates are ISO strings. Date-only fields, such as invoice issueDate, should use YYYY-MM-DD.
  • IDs are usually public uid values. Bookkeeping detail endpoints accept an internal UUID or public UID.
  • API methods throw MakePayError for non-2xx responses. Successful responses are typed envelopes with index signatures, so production can add fields without breaking TypeScript consumers.

Accepted Payload Models

ModelUsed byRequired fieldsCommon optional fields
MakePayPaymentLinkPayloadcreatePaymentLinkamounttitle, description, currency, asset, orderId, customerEmail, clientId, redirect URLs, metadata
MakePayDonationLinkPayloadcreateDonationLinknonedefaultAmountUsd, minimumAmountUsd, donationSlug, payment-link display and redirect fields
MakePayAnonymousPaymentLinkPayloadcreateAnonymousPaymentLinkamount, settlement.currency, settlement.prioritiestitle, customerEmail, orderId, metadata, branding, webhookUrl, checkout redirect URLs
MakePayCustomerPayloadupsertCustomerone of email, customerEmail, name, clientIdmetadata
MakePaySubscriptionPayloadcreateSubscriptionplan amount/customer fields for your billing flowamountUsd, customerEmail, label, billingIntervalUnit, billingIntervalCount, startAt, sendPaymentRequestEmail
MakePayPosTerminalPayloadcreatePosTerminal, updatePosTerminalnamepin, status, allowedAssets, emailCollectionMode, catalogEnabled, displaySettings, metadata
MakePayProductPayloadcreateProduct, updateProductnamedescription, sku, status, productType, basePriceUsd, shopSlug, images, variants, taxRates, metadata
MakePayShopPayloadupdateShopnoneslug, status, displayCurrency, checkoutMode, shipping fields, links, SEO, tracking, branding
MakePayBrandingPayloadupdateBrandingnonebrand name, support email, website URL, theme colors, paymentLinkDomain, emailSendingDomain
MakePayBookkeepingInvoicePayloadcreateBookkeepingInvoice, updateBookkeepingInvoicenone; blank invoices are allowed as draftsinvoiceNumber, status, paymentStatus, currency, issueDate, dueDate, counterparty, lineItems, documentIds
MakePayBookkeepingExpensePayloadcreateBookkeepingExpense, createBookkeepingExpenseFromActivity, updateBookkeepingExpensenone; amount defaults to zero if no activity is usedamount, currency, category, incurredOn, wallet activity IDs, counterparty, metadata
MakePayBookkeepingDocumentUploaduploadBookkeepingDocumentfilefileName, documentType, invoiceId, expenseId
MakePayBookkeepingReconciliationPayloadcreateBookkeepingReconciliationone target and one sourcetarget: invoiceId or expenseId; source: payment, subscription cycle, or wallet activity; amount, assetSymbol, metadata
Record<string, unknown>product downloads, shop builder, coupons, settings, customer portalroute-specificthese advanced surfaces stay open-ended while their server schemas evolve

Response Models By Function

FunctionsResolves toKey fields
createPaymentLink, getPaymentLink, updatePaymentLink, sendPaymentRequestEmail, donation variantsMakePayPaymentLinkResponseok, companyId, paymentLink, paymentRequestEmailSent, paymentRequestEmailError
listPaymentLinks, listDonationLinksMakePayPaymentLinksResponsecompanyId, paymentLinks
createAnonymousPaymentLinkMakePayPaymentLinkResponsepaymentLink, plus public-link metadata returned by the API
listCustomers, upsertCustomer, createCustomerPortalMakePayCustomersResponse or MakePayCustomerResponsecustomers, customer, portalUrl or url
listSubscriptions, createSubscriptionMakePaySubscriptionsResponse or MakePaySubscriptionResponsesubscriptions, subscription
listPosTerminals, createPosTerminal, getPosTerminal, updatePosTerminalMakePayPosTerminalsResponse or MakePayPosTerminalResponseterminals/posTerminals, terminal/posTerminal
listProducts, createProduct, getProduct, updateProduct, listProductDownloads, createProductDownloadproduct and download response typesproducts, product, downloads
getShop, updateShop, getShopBuilder, updateShopBuilder, getShopDomain, updateShopDomain, refreshShopDomainshop, builder, and domain response typesshop, blocks, builder, domain, status, verification
listShopCoupons, createShopCoupon, updateShopCoupon, archiveShopCoupon, listShopOrderscoupon and order response typescoupons, coupon, orders
getBranding, updateBranding, refreshBrandingDomains, getSettings, updateSettingsbranding/settings response typescompany, settings, ok
listDestinationAssets, listWebhookRequestsoperational response typesassets/destinationAssets, webhookRequests/requests
getBookkeepingSummary, invoice, expense, document, OCR, and reconciliation methodsbookkeeping response typessummary, invoices, invoice, expenses, expense, documents, url, reconciliationLinks, stats
verifyMakePayWebhook, parseMakePayWebhookboolean or parsed eventparseMakePayWebhook<T>() returns your supplied event type after signature verification

Bookkeeping mutation methods return a fresh MakePayBookkeepingSummaryResponse, so dashboards can update invoice, expense, document, reconciliation, and stat views from a single response.

Error Handling

API calls throw MakePayError. It includes the HTTP status and decoded response body.

import { MakePayError } from "@makecrypto/makepay";

try {
  await makepay.getPaymentLink("PAYMENT_LINK_UID");
} catch (error) {
  if (error instanceof MakePayError) {
    console.error(error.status, error.responseBody);
  }
}

Release Notes

The package is published as @makecrypto/makepay with public access. Release publishing should use an npm automation token in the MakeCrypto organization or an OTP-capable token when 2FA is required.

The public repository at https://github.com/makepay-io/makepay-npm-sdk mirrors only the SDK package files so developers can inspect the source without the full MakeCrypto workspace.

Need partner setup help?

Open the payment link details view in MakeCrypto to copy the generated snippets for a real payment UID, or return to the portal to manage merchant settings.

Open portal