> ## Documentation Index
> Fetch the complete documentation index at: https://docs.macropay.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Macropay: Turn Your Software into a Business

> Merchant-of-Record billing for software and AI agents — global tax handled, PCI absorbed, usage and outcome billing built in.

<img height="200" src="https://mintcdn.com/macrodeepinc/cFB2MwsVMVhNfkal/assets/welcome.png?fit=max&auto=format&n=cFB2MwsVMVhNfkal&q=85&s=a5caee9b0e2aeab82342e30bfd118709" data-path="assets/welcome.png" />

## Sell software anywhere, skip the back office

Macropay is open-source billing infrastructure built around one idea: you should be able to charge money for what you build — a SaaS subscription, a one-time license, or an AI agent that bills by the outcome it delivers — without becoming a tax filer, a PCI auditor, or a disputes desk.

We do that as your **Merchant of Record (MoR)**. Macropay is the legal seller on your customer's statement, which means we calculate and remit sales tax, VAT, and GST worldwide, absorb PCI scope, and own the chargeback process. You ship product; the compliance machinery is ours.

<CardGroup cols={2}>
  <Card title="Merchant of Record" icon="globe">
    We sell as the merchant on record, then remit tax and VAT in every
    jurisdiction you sell into — so your global tax liability stays ours, not
    yours.
  </Card>

  <Card title="Built for AI, not just SaaS" icon="robot">
    Meter by tokens, by activity, or by verified outcome. Agents are
    first-class: attribute spend, certify ROI, and track margin per agent.
  </Card>
</CardGroup>

## What you stop worrying about

<AccordionGroup>
  <Accordion title="Cross-border tax filings" icon="building-columns">
    **The problem:** A single global sale can trigger VAT, GST, or sales-tax
    obligations across dozens of jurisdictions, each with its own rate,
    threshold, and filing cadence. Most teams either gamble on non-compliance
    or wall themselves off from international customers.

    **With Macropay:** As your Merchant of Record we are the legal seller, so we
    calculate, collect, and remit the tax. Your liability is capped at the
    relationship with us — see [supported countries and tax handling](/merchant-of-record/fees).
  </Accordion>

  <Accordion title="Building billing from scratch" icon="gears">
    **The problem:** Subscriptions, proration, dunning, customer portals,
    invoices, refunds — each is weeks of work and a permanent maintenance tax on
    your team.

    **With Macropay:** A complete billing API ships on day one. Subscription
    lifecycle, failed-payment recovery, and a self-serve [customer portal](/features/products)
    are already wired up. Drop in an SDK and start charging.
  </Accordion>

  <Accordion title="Manually fulfilling every order" icon="box">
    **The problem:** Emailing license keys, sending Discord invites, and adding
    people to private repos by hand breaks the moment you have real volume.

    **With Macropay:** Entitlements fire automatically on purchase — license
    keys, file downloads, [GitHub repo access](/features/benefits/github-access),
    Discord roles, prepaid credits, and more. Customers are provisioned the
    instant a payment clears.
  </Accordion>

  <Accordion title="Metering AI usage and agent work" icon="microchip">
    **The problem:** AI products don't fit flat subscriptions. You pay providers
    per token, and your customers expect to pay for what they actually use — or
    for the result they actually got.

    **With Macropay:** Send usage events to the [meter and credits](/api-reference)
    primitives, route model calls through our OpenAI-compatible AI proxy to
    capture token cost automatically, and bill agents on **usage, activity, or
    outcome**. More on this below.
  </Accordion>
</AccordionGroup>

## What's in the platform

### Products: one model for everything you sell

In Macropay, everything you sell is a **product** — whether it's billed once or
recurring. The API and data model stay the same; only the pricing and billing
logic differ.

<CardGroup cols={3}>
  <Card title="One-time" icon="cart-shopping">
    Templates, courses, perpetual licenses, lifetime deals — paid for once, with
    instant fulfillment.
  </Card>

  <Card title="Subscriptions" icon="arrows-rotate">
    Recurring billing with automatic renewals, proration, and dunning for failed
    payments.
  </Card>

  <Card title="Flexible pricing" icon="hand-holding-dollar">
    Fixed, free, pay-what-you-want, seat-based, or usage-based (metered) — mix
    and match per product.
  </Card>
</CardGroup>

### Usage-based & AI billing

This is where Macropay goes beyond a typical payment processor. Charge for
consumption, activity, or — for AI agents — the value actually delivered.

<CardGroup cols={2}>
  <Card title="Metered billing" icon="gauge">
    Ingest **events**, aggregate them into **meters**, and attach a metered
    price. Sell **prepaid credits** or grant them, with stream, S3, delta-time,
    or LLM ingestion strategies.
  </Card>

  <Card title="AI proxy" icon="bolt">
    Point your model calls at our OpenAI-compatible endpoint
    (`POST /ai/v1/chat/completions`). Macropay captures the token cost of every
    request automatically — no manual metering code.
  </Card>

  <Card title="Agent billing" icon="robot">
    Agents are first-class. The **Signals API** (`POST /v1/signals`) ingests
    activity and outcome signals attributed to a specific agent, so you can bill
    on results, not just minutes.
  </Card>

  <Card title="Value receipts & margin" icon="chart-line">
    **Value receipts** certify ROI — time saved, revenue generated, cost
    avoided. **Agentic margin** compares billed revenue against AI cost (COGS)
    per agent, so you always know which agents are profitable.
  </Card>
</CardGroup>

<Tip>
  Outcome-based pricing is the cleanest way to monetize an agent: route inference
  through `/ai/v1` to track COGS, then post the result to `/v1/signals` to bill
  for the win. The margin between the two is your agentic margin.
</Tip>

### A checkout your customers trust

<img className="block dark:hidden" src="https://mintcdn.com/macrodeepinc/cFB2MwsVMVhNfkal/assets/introduction/checkout.light.png?fit=max&auto=format&n=cFB2MwsVMVhNfkal&q=85&s=fc14f2f566a4434f997f65aa216543ed" width="2702" height="1774" data-path="assets/introduction/checkout.light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/macrodeepinc/cFB2MwsVMVhNfkal/assets/introduction/checkout.dark.png?fit=max&auto=format&n=cFB2MwsVMVhNfkal&q=85&s=01be154ffc872b9d5794c0f233a640ee" width="2702" height="1774" data-path="assets/introduction/checkout.dark.png" />

Card details are tokenized in our **PCI DSS Level 1 compliant** vault, so
sensitive data never touches your servers. Pick the integration depth that fits:

<CardGroup cols={3}>
  <Card title="Share a link" icon="link" href="/features/checkout/links">
    No code required. Generate a checkout link in the dashboard and drop it into
    an email, a post, or a button.
  </Card>

  <Card title="Embed on your site" icon="browser" href="/features/checkout/embed">
    Keep customers on your domain with a themeable, localized embedded checkout.
  </Card>

  <Card title="Drive it with the API" icon="code" href="/api-reference">
    Create checkout sessions programmatically for fully custom purchase flows.
  </Card>
</CardGroup>

### Entitlements that fulfill themselves

Configure a benefit once and Macropay grants it on every qualifying purchase —
no scripts, no support tickets.

<CardGroup cols={2}>
  <Card title="License keys" icon="key" href="/features/benefits/license-keys">
    Generate and deliver keys automatically, with custom formats and activation
    limits.
  </Card>

  <Card title="File downloads" icon="download" href="/features/benefits/file-downloads">
    Securely serve digital assets up to 10GB, with per-customer download
    tracking.
  </Card>

  <Card title="GitHub access" icon="github" href="/features/benefits/github-access">
    Auto-invite buyers to private repositories and revoke access when a
    subscription ends.
  </Card>

  <Card title="Discord access" icon="discord" href="/features/benefits/discord-access">
    Assign roles and send server invites the moment someone joins a paid tier.
  </Card>
</CardGroup>

## Get to your first payment

<Steps>
  <Step title="Create your organization">
    [Sign up](https://macropay.ai/signup) with GitHub, Google, or email, then
    create an organization to hold your products, customers, and payouts.

    <img className="block dark:hidden" src="https://mintcdn.com/macrodeepinc/cFB2MwsVMVhNfkal/assets/create-org.light.png?fit=max&auto=format&n=cFB2MwsVMVhNfkal&q=85&s=47dc0543518dbb8918a1937af8817d4e" width="2076" height="1790" data-path="assets/create-org.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/macrodeepinc/cFB2MwsVMVhNfkal/assets/create-org.dark.png?fit=max&auto=format&n=cFB2MwsVMVhNfkal&q=85&s=f4d75ddf82640fbc45a2d13fb864eaf3" width="1920" height="1804" data-path="assets/create-org.dark.png" />
  </Step>

  <Step title="Define a product">
    Create your first [product](/features/products) in a couple of minutes:

    * Decide one-time or subscription
    * Set the pricing model — fixed, free, pay-what-you-want, seat-based, or metered
    * Attach the entitlements that should fulfill on purchase
  </Step>

  <Step title="Pick an integration path">
    <Tabs>
      <Tab title="No-code">
        Fastest way to take money today:

        * Create a [checkout link](/features/checkout/links) in the dashboard
        * Share it anywhere — email, social, a landing page
        * Payments start flowing immediately
      </Tab>

      <Tab title="Embedded">
        Keep the experience on your site:

        * Drop in the [embedded checkout](/features/checkout/embed)
        * Match your branding and locale
        * Customers never leave your domain
      </Tab>

      <Tab title="Full API">
        Maximum control for custom flows:

        * Install a [native SDK](/integrate/sdk/typescript)
        * Build bespoke checkout and provisioning logic
        * Wire billing into your existing stack
      </Tab>
    </Tabs>
  </Step>

  <Step title="Listen for events with webhooks">
    Keep your own database in sync as things happen:

    * Register [webhook endpoints](/integrate/webhooks/endpoints) in the dashboard
    * React to orders, subscription changes, and customer updates
    * Verify deliveries with Standard Webhooks signatures and test them locally

    Webhooks make your system the source of truth for fulfillment beyond the
    built-in entitlements.
  </Step>
</Steps>

## Integrate with your stack

### Framework adapters

Drop-in adapters wire Macropay into your framework's routing and auth so you
write less glue code.

<CardGroup cols={2}>
  <Card title="Next.js" icon="react" href="/integrate/sdk/adapters/nextjs">
    Full-stack React with App Router support.
  </Card>

  <Card title="BetterAuth" icon="react" href="/integrate/sdk/adapters/better-auth">
    Billing tied directly into your authentication and authorization layer.
  </Card>

  <Card title="Laravel" icon="php" href="/integrate/sdk/php">
    First-class PHP support for Laravel applications.
  </Card>

  <Card title="Deno" icon="node-js" href="/integrate/sdk/adapters/deno">
    A modern, secure TypeScript runtime.
  </Card>
</CardGroup>

<Accordion title="More supported frameworks">
  <CardGroup cols={4}>
    <Card title="Nuxt" href="/integrate/sdk/adapters/nuxt">
      Vue.js framework
    </Card>

    <Card title="Remix" href="/integrate/sdk/adapters/remix">
      React framework
    </Card>

    <Card title="Fastify" href="/integrate/sdk/adapters/fastify">
      Fast Node.js
    </Card>

    <Card title="Hono" href="/integrate/sdk/adapters/hono">
      Cloudflare Workers
    </Card>

    <Card title="Tanstack Start" href="/integrate/sdk/adapters/tanstack-start">
      Full-stack React
    </Card>

    <Card title="Elysia" href="/integrate/sdk/adapters/elysia">
      Bun framework
    </Card>

    <Card title="Astro" href="/integrate/sdk/adapters/astro">
      Static site generator
    </Card>

    <Card title="Express" icon="node-js" href="/integrate/sdk/adapters/express">
      Flexible Node.js framework
    </Card>

    <Card title="SvelteKit" icon="js" href="/integrate/sdk/adapters/sveltekit">
      Full-stack framework
    </Card>
  </CardGroup>
</Accordion>

### Native SDKs & tooling

<CardGroup cols={4}>
  <Card title="TypeScript" icon="js" href="/integrate/sdk/typescript">
    Web and Node.js applications
  </Card>

  <Card title="Python" icon="python" href="/integrate/sdk/python">
    Django, Flask, FastAPI
  </Card>

  <Card title="Go" icon="golang" href="/integrate/sdk/golang">
    Go web services
  </Card>

  <Card title="PHP" icon="php" href="/integrate/sdk/php">
    WordPress, Laravel, plain PHP
  </Card>
</CardGroup>

<Info>
  Authenticate with OAuth2 or organization access tokens (OAT), test everything
  in the **sandbox** before going live, and connect agent tooling through our
  **MCP** server.
</Info>

Here's a metered AI charge, end to end — capture model cost through the proxy,
then bill the customer for usage:

<CodeGroup>
  ```bash cURL theme={null}
  # Run inference through the AI proxy — token cost is captured automatically
  curl https://api.macropay.ai/ai/v1/chat/completions \
    -H "Authorization: Bearer $MACROPAY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-4o-mini",
      "messages": [{ "role": "user", "content": "Summarize this support ticket." }]
    }'
  ```

  ```ts TypeScript theme={null}
  import { Macropay } from "@macropay/sdk";

  const macropay = new Macropay({ accessToken: process.env.MACROPAY_API_KEY });

  // Record an outcome signal so an agent can bill for the result it delivered
  await macropay.signals.create({
    customerId: "cus_8fK2",
    agentId: "agent_triage",
    type: "outcome",
    name: "ticket_resolved",
    value: 1,
  });
  ```

  ```python Python theme={null}
  from macropay import Macropay

  macropay = Macropay(access_token=os.environ["MACROPAY_API_KEY"])

  # Ingest a usage event into a meter for metered billing
  macropay.events.ingest(
      customer_id="cus_8fK2",
      name="rows_processed",
      value=4200,
  )
  ```
</CodeGroup>

## Who it's for

<Tabs>
  <Tab title="Solo developers">
    <CardGroup cols={2}>
      <Card title="Ship weeks sooner" icon="rocket">
        Skip the billing build entirely and spend your time on the product.
      </Card>

      <Card title="Sell globally on day one" icon="globe">
        We handle tax and compliance everywhere, so geography stops being a
        blocker.
      </Card>

      <Card title="Hands-off fulfillment" icon="box">
        Keys, downloads, and access grants are delivered automatically.
      </Card>

      <Card title="Pay as you earn" icon="piggy-bank">
        No setup fees and no monthly minimums — costs scale with revenue.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="AI builders">
    <CardGroup cols={2}>
      <Card title="Token cost capture" icon="bolt">
        The AI proxy records COGS per request, so margin is never a mystery.
      </Card>

      <Card title="Outcome-based pricing" icon="bullseye">
        Bill for resolved tickets, booked meetings, or code merged — not seats.
      </Card>

      <Card title="Per-agent margin" icon="chart-line">
        Compare billed revenue to AI cost for every agent you run.
      </Card>

      <Card title="Certified ROI" icon="receipt">
        Value receipts quantify time saved and revenue generated for customers.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Growing teams">
    <CardGroup cols={2}>
      <Card title="Programmatic everything" icon="code">
        Full API control over products, customers, orders, and subscriptions.
      </Card>

      <Card title="Reliable webhooks" icon="link">
        Signed, replayable event delivery keeps your systems in sync.
      </Card>

      <Card title="Self-serve customers" icon="users">
        A hosted customer portal handles upgrades, invoices, and cancellations.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>

## Pricing

One transparent rate. We only make money when you get paid.

<CardGroup cols={2}>
  <Card title="4.5% + 50¢" icon="percent">
    **Per successful transaction**

    No monthly fees, no setup costs, no minimums.
  </Card>

  <Card title="Free payouts" icon="building-columns">
    **ACH (US) and SEPA (EU)**

    SWIFT is passed through at cost. No payout markup.
  </Card>
</CardGroup>

<Info>
  A few situational add-ons: **+1.5%** on international (non-US) cards, **+0.5%**
  on subscriptions, and **\$30 per dispute** regardless of outcome. Full breakdown
  on the [fees page](/merchant-of-record/fees).
</Info>

## Start building

<CardGroup cols={2}>
  <Card title="Create an account" icon="user-plus" href="https://macropay.ai/signup">
    **Free, no card required**

    You'll be set up in under two minutes.
  </Card>

  <Card title="Follow a guide" icon="book" href="/guides/nextjs">
    **Framework tutorials**

    Step-by-step integration walkthroughs.
  </Card>

  <Card title="Browse the API" icon="code" href="/api-reference">
    **Full reference**

    Endpoints, schemas, and live examples.
  </Card>

  <Card title="Join the community" icon="discord" href="https://discord.gg/Pnhfz3UThd">
    **Get help fast**

    Talk to the team and other builders on Discord.
  </Card>
</CardGroup>
