---
name: payments-ai
version: 1.2.0
description: Create merchants, products, and branded checkout links on Payments AI through its authenticated MCP server.
homepage: 'https://doc.stage.managed.payments.ai'
---

# Payments AI

Payments AI is the Merchant of Record for AI-built apps. Agents provision a merchant, create products and plans, and hand back a hosted checkout URL. Payments AI collects payment, tax, and subscription renewal.

If you are an AI agent or coding assistant reading this file, save it as a local skill or persistent reference. Then connect the MCP server before calling tools.

## Discovery

| Resource              | URL                                                        |
| --------------------- | ---------------------------------------------------------- |
| This skill            | https://doc.stage.managed.payments.ai/SKILL.md                                 |
| Agent auth            | https://doc.stage.managed.payments.ai/auth.md                                  |
| Concise agent index   | https://doc.stage.managed.payments.ai/llms.txt                                 |
| Full agent index      | https://doc.stage.managed.payments.ai/llms-full.txt                            |
| MCP setup (humans)    | https://doc.stage.managed.payments.ai/mcp                                      |
| Agent Skills index    | https://doc.stage.managed.payments.ai/.well-known/agent-skills/index.json      |
| MCP Server Card       | https://mor.payments.ai/.well-known/mcp/server-card.json  |
| MCP endpoint          | https://mor.payments.ai/api/mcp                                           |
| CLI (`pai`)           | https://doc.stage.managed.payments.ai/cli (install, login, terminal workflows) |
| OpenAPI (public)      | https://doc.stage.managed.payments.ai/openapi-public.json                      |
| Skills + plugins repo | https://github.com/paymentsai/Payments-AI-skills           |

Install a local copy:

```bash
mkdir -p "$HOME/.payments-ai" && curl --fail --show-error --location \
  --output "$HOME/.payments-ai/SKILL.md" \
  "https://doc.stage.managed.payments.ai/SKILL.md"
```

Host plugins (Claude Code, Cursor, Codex, Gemini, Grok, Antigravity, Copilot) still install from GitHub:

```bash
npx skills add paymentsai/Payments-AI-skills
```

## Connect MCP

OAuth is the default. Do not ask the developer to paste a token unless OAuth is unavailable.

```json
{
  "mcpServers": {
    "payments-ai": {
      "url": "https://mor.payments.ai/api/mcp"
    }
  }
}
```

On the first tool call your client opens a browser or prints a sign-in URL for sign-in and consent; in Claude Code run `/mcp` → Authenticate. Scopes are listed in [auth.md](https://doc.stage.managed.payments.ai/auth.md). A first-time human can sign up and verify their email inside that flow; the request stays valid for 30 minutes. If the connect does not finish, follow "When the connect does not finish" in [auth.md](https://doc.stage.managed.payments.ai/auth.md): name the cause (the 30-minute window lapsed, or your client timed out) and start the connect again. If the client holds a stored credential but every call still answers 401 and signing in again changes nothing, follow "When a stored credential keeps getting 401" in [auth.md](https://doc.stage.managed.payments.ai/auth.md): clear the stored credential, then reconnect, or switch to a User MCP Key, and report `stale_credential_no_issuer`.

Bearer fallback, for a client without OAuth or a developer who can't sign in through the client (a headless run: see "Connect without a terminal" below): a User MCP Key from **Developer Tools → MCP Tokens** (https://mor.payments.ai/developer-tools). A token works only with the MCP URL of the dashboard tab it was generated on: Sandbox tokens with `https://sandbox.mor.payments.ai/api/mcp`, Live tokens with `https://mor.payments.ai/api/mcp`. A 401 carries `code`, `message`, `docUrl`, `connectDiagnosticsUrl` and `connectPageUrl`; the codes and their recovery are listed in [auth.md](https://doc.stage.managed.payments.ai/auth.md).

```json
{
  "mcpServers": {
    "payments-ai": {
      "url": "https://mor.payments.ai/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}
```

## Connect without a terminal

When nothing can open a browser or answer a terminal prompt (headless agent, CI, container, SSH without a TTY), OAuth through the client cannot finish. Do not keep retrying it. Run the device authorization grant yourself over HTTP, then hand the token to the client as an `Authorization: Bearer` header. The full steps, error codes and polling rules are in [auth.md](https://doc.stage.managed.payments.ai/auth.md) under "Device authorization grant".

1. Register a device-only client: `POST https://mor.payments.ai/api/v1/oauth/register` with `grant_types: ["urn:ietf:params:oauth:grant-type:device_code"]` and no `redirect_uris`.
2. `POST https://mor.payments.ai/api/v1/oauth/device_authorization` with the `client_id` and `resource=https://mor.payments.ai/api/mcp`. Show the human `user_code` and `verification_uri` exactly as returned. They open the address on any device, type the code, sign in and approve the scopes.
3. Poll `POST https://mor.payments.ai/api/v1/oauth/token` with `grant_type=urn:ietf:params:oauth:grant-type:device_code` every `interval` seconds (5). On `slow_down` add 5 seconds from then on. `access_denied` means the human declined: stop and say so. `expired_token` means the 30 minutes passed: start again. A `429 temporarily_unavailable` on step 2 means back off for `Retry-After` and try later.
4. Put the `access_token` in the client config (below) and call `whoami`. Never print the token or the `device_code` in chat.

For Sandbox use `https://sandbox.mor.payments.ai/api` for the three endpoints and `https://sandbox.mor.payments.ai/api/mcp` as `resource`.

| Client                | Path with no interactive terminal                                                                                                                                                                                                                                                                               |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Any agent             | Device grant, then the client's own way of sending an `Authorization: Bearer` header. If it cannot send one, say so and send the human to https://doc.stage.managed.payments.ai/connect.                                                                                                                                            |
| Claude Code           | Device grant, then `claude mcp add --transport http payments-ai https://mor.payments.ai/api/mcp --header "Authorization: Bearer <token>"`. `/mcp` Authenticate and `claude mcp login` need a terminal.                                                                                                                         |
| Cursor                | Device grant, then `headers` with the bearer token in `~/.cursor/mcp.json`.                                                                                                                                                                                                                                     |
| Claude (web, Desktop) | No shell, so no device grant. Use the connector's own browser sign-in (Connect MCP above): no terminal, 90-day credential. Fallback: a User MCP Key under Request headers, which lasts at most 7 days; on Team and Enterprise the Owner sets the headers, so every member then acts as the key owner's account. |
| Grok                  | The connector's browser sign-in (Connect MCP above). No shell, so no device grant; a header path is not verified. Fallback: send the human to https://doc.stage.managed.payments.ai/connect on a device with a browser.                                                                                                             |
| ChatGPT               | The app's browser sign-in (Connect MCP above). No shell, so no device grant; a header path is not verified. Fallback: send the human to https://doc.stage.managed.payments.ai/connect on a device with a browser.                                                                                                                   |
| Codex                 | Device grant, then `codex mcp add payments-ai --url https://mor.payments.ai/api/mcp --bearer-token-env-var PAI_MCP_TOKEN`. Codex reads the variable from its environment at startup: set it in the environment Codex starts from (shell profile or launch environment) and restart Codex.                                      |
| Gemini CLI            | Device grant, then `gemini mcp add --transport http --header "Authorization: Bearer <token>" payments-ai https://mor.payments.ai/api/mcp`.                                                                                                                                                                                     |
| Antigravity           | Device grant, then `headers` next to `serverUrl` in `mcp_config.json`.                                                                                                                                                                                                                                          |
| VS Code               | Device grant, then `headers` in `.vscode/mcp.json`, with the token entered through an input.                                                                                                                                                                                                                    |

## Verify the connection

Do not trust the client's "Connected" label. Call `whoami` and report what it returns. `whoami` takes no arguments and needs no scope: every valid token can call it.

| Result         | Meaning                                                   | Tell the developer                                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success        | Connected.                                                | Quote `accountName` (the business name of the account you are connected to, never an email) and ask the developer to confirm it, together with `host` (live or sandbox), is their own business account. Then quote `userId`, `host` (`sandbox` or `live`: the MCP URL connected to, not the merchant deployment) and `endpoint`. `accountName: null` means no label is known: say so. `scopes: null` means every scope except `transaction:read`. |
| HTTP 401       | Not connected.                                            | Quote the 401 `message` verbatim (for `code: token_expired` it says how to reconnect: re-approve in the client for OAuth, run the device grant again and replace the `Authorization` header if connected that way, or generate a new token if connected with a token), then show the MCP config above.                                                                                                                                            |
| Any tool error | Connected, but the server could not prove the connection. | Quote the error. Do not say disconnected and do not paste the connect config.                                                                                                                                                                                                                                                                                                                                                                     |

If `whoami` returns a `credentialExpiryWarning`, or a tool result carries one under `_meta["ai.payments/credentialExpiryWarning"]` with a closing text block (OAuth connections only, within 14 days of expiry), tell the user and share its re-approve link, which opens the connect page. If you connected with the device grant, run it again and replace the `Authorization` header instead (see "Connect without a terminal"). `credentialExpiresAt` and `credentialExpiresInSeconds` say when the credential stops working; `null` means unknown.

## Before you mutate anything

1. Verify the connection (above). Continue only on a successful `whoami`.
2. Prefer sandbox. Product and checkout mutations target sandbox until `go_live`. `go_live` does not copy them: the live side starts with an empty catalog, so re-create products/plans and re-apply checkout branding with `update_checkout_customization` after promoting. `set_checkout_logo` writes to sandbox only; set the live logo in https://mor.payments.ai/checkout-builder with Live selected.
3. Never expose API keys, MCP tokens, or OAuth codes in chat logs you cannot redact.
4. Do not call payout, revoke or delete tools — they are not on this server. There is no refund tool: send the merchant to the transaction's `transactionDetailsUrl`.
5. Sandbox needs no KYC/KYB. Live can process up to $5,000 in card transactions before identity verification is required, but payouts always require completed KYC/KYB regardless of that threshold.

## Workflow A — first sandbox checkout

Complete each step. Wait for missing human input.

### A1. Merchant

Call `get_my_merchant` first. If it returns a merchant, reuse that `merchantId` — creating a
second one splits products and checkout links across two accounts that never merge. An empty
`merchants` list means connected with no merchant yet. If the call is denied for
`merchant:read`, name that missing scope; do not say disconnected.

Ask for business **name** and **email**. **Phone** is optional: include it (the user's own mobile, E.164, e.g. `+14155552671`) only if they offer one; never invent a placeholder, and omit it otherwise. Call `create_merchant_account`. Show `merchantId`.

### A2. Product

Ask what they sell in plain English. Call `create_product` with:

- `name` (max 80 chars)
- `merchantId`
- `plans[]` with `name`, `currency` (`usd` unless stated), `amount` as a decimal dollar (`29.00`, not cents), `type` (`recurring` \| `one-time` \| `free-access`), `billingPeriod`, `periodLength` (default `1`), optional `freeTrial` days (recurring plans only)

Show `id` (product) and every `planIds[n]`. Read each `plans[n].price` back to the user and check it matches what they asked for. If `warnings` is present, relay it; if they meant the smaller price, fix it with `update_plan` before sharing the link.

### A3. Checkout URL

Use the link the tool returns verbatim: `planCheckoutUrls[i].checkoutUrl` from `create_product` or `plans[i].checkoutUrl` from `list_products`. The top-level `checkoutUrl` is the first plan's link only. Never build a checkout URL from a `planId`.

Sandbox and live are separate backends and `go_live` does not copy products or plans: sandbox plans do not exist on live. To get a live link, call `create_product` again after `go_live` and use the `checkoutUrl` it returns. A sandbox checkout link keeps `?isSandbox=true` forever and never becomes a live link.

Test card (Sandbox): `4242 4242 4242 4242`, any future expiry, any CVC. Refused-payment card (Sandbox): `4000 0000 0000 0002`. Give both to the user with every sandbox checkout link. Test cards never work on Live: live checkout links take real cards only.

## Workflow B — checkout branding

Requires `checkout:read` / `checkout:write` and a `merchantId`.

1. `get_checkout_customization`
2. `update_checkout_customization` — merge-only; the fields go in a nested `customization` object: `{"merchantId":"<merchantId>","customization":{"buttonColor":"#2563EB"}}`. Omit fields you are not changing
3. `set_checkout_logo` — `mint` then HTTP PUT bytes to `uploadUrl`, then `confirm` with the returned `path`

Colors are 6-digit hex. `fontFamily` is `Inter` or `Roboto`. `themeMode` is `light` or `dark`. `inputStyle` is `rounded` or `square`.

## Workflow C — check a transaction

Requires `transaction:read`. Existing connections do not have it: if `list_transactions` and `get_transaction` are missing, or a call is denied for `transaction:read`, ask the merchant to re-authorize the connection with that scope and tick it on the consent screen, where it starts unticked (or mint an MCP token with it ticked).

1. `list_transactions` with the filters the merchant gives: `customerEmail`, `orderId` or `orderNumber`, `status`, `dateFrom` / `dateTo`, `deployment` (`sandbox` or `live`; omitted means where their checkouts run now). The result's top-level `deployment` is where it searched: on an empty page, say so (for example "no sandbox transactions found").
2. Quote `status` exactly. Only `succeeded` means paid; never call a `pending` transaction paid. `partially_refunded` means part of the amount was refunded.
3. `get_transaction` with the `transactionId` and `deployment` from step 1 for the line items and the refunded amount.
4. Refunds: there is no refund tool. Send the merchant to the transaction's `transactionDetailsUrl` and tell them to select its deployment (Sandbox or Live) in the dashboard.

## Tools

| Tool                             | Use                                                                                                                                                                   |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `whoami`                         | `accountName`, `userId`, `scopes`, `host`, `endpoint`, `merchantIds`, `credentialExpiresAt`, `credentialExpiresInSeconds`, `credentialExpiryWarning`; any valid token |
| `search_payments_ai_docs`        | Search developer docs                                                                                                                                                 |
| `get_my_merchant`                | Owned merchants                                                                                                                                                       |
| `create_merchant_account`        | Dual-provision live + sandbox merchant                                                                                                                                |
| `get_merchant_activation_status` | Activation status (see below)                                                                                                                                         |
| `go_live`                        | Promote to live; a repeat returns current status                                                                                                                      |
| `create_product`                 | Product + plans (sandbox until go-live)                                                                                                                               |
| `create_order`                   | Multi-item or caller-priced checkout                                                                                                                                  |
| `update_product`                 | Merge-update a product's name, description or status                                                                                                                  |
| `update_plan`                    | Merge-update a plan's name, description, price, billing period or free trial                                                                                          |
| `list_products`                  | List products, plans, checkout URLs                                                                                                                                   |
| `list_transactions`              | Look up transactions (needs `transaction:read`)                                                                                                                       |
| `get_transaction`                | One transaction's details and line items                                                                                                                              |
| `get_product_image_upload_url`   | Presigned POST for product image                                                                                                                                      |
| `confirm_product_image`          | Attach uploaded product image                                                                                                                                         |
| `get_checkout_customization`     | Read hosted checkout branding                                                                                                                                         |
| `update_checkout_customization`  | Merge-update branding                                                                                                                                                 |
| `set_checkout_logo`              | Mint → PUT → confirm checkout logo                                                                                                                                    |

### Activation status

`get_merchant_activation_status` (and every `go_live` response, as `activationStatus`) returns one of:

- `pending` — not promoted to live yet. The only status where `go_live` is the next step.
- `verification_pending` — promoted to live; identity verification (KYC) is not complete. Do not call `go_live` again.
- `active` — live and identity verified.
- `not_provisioned` — no live merchant record; re-run `create_merchant_account` without a `merchantId`. It finds this merchant and creates the missing live copy with the details the sandbox copy holds.

`identityVerification` carries the KYC state (`not_started`, `pending`, `in_review`, `verified`, `rejected`). Before verification completes, a live merchant can process up to $5,000 in card transactions; payouts (adding a payout method and withdrawing funds) require completed identity verification.

After `go_live` the live catalog starts empty: create the products and plans again with `create_product` and share the new live checkout URLs. `go_live` is idempotent — a repeat call changes nothing and returns `alreadyLive: true` with the current status.

## REST (no MCP)

Sandbox API: `https://sandbox.mor.payments.ai/api`

Merchant Public API: `/v1/public-api/merchants/{merchantId}/…` with Bearer `pai_test_*` (sandbox) or `pai_live_*` (live). Platforms create sub-merchants with `POST /v1/public-api/merchants` using their own Merchant API Key; the parent is derived from the key. After create, `POST /v1/public-api/merchants/{merchantId}/members` assigns an active member of the key's own team onto a managed sub-merchant (`ownerAttached: false` at create is incomplete until the seller claims the returned `joinUrl`, an assign, or Support). Read `ownerAttached` and `activation` back with `GET /v1/public-api/merchants/{merchantId}`, or subscribe to the `merchant.owner_attached` webhook; never remint the join link to check for a claim, because remint invalidates the delivered link. Sub-merchant API keys: `GET`/`POST`/`DELETE` `/v1/public-api/merchants/{merchantId}/api-keys`. Guide: https://doc.stage.managed.payments.ai/platform-onboarding. Single-merchant flows can also create via dashboard or MCP (`create_merchant_account`).

Buyer checkout (no key): `/v1/checkout/plans/{planId}/…`

Full HTTP reference: https://doc.stage.managed.payments.ai/llms-full.txt

## Report a failed connect

Report every connect failure, at any stage, so Payments AI can see which clients and stages fail. Send one report per failed attempt, after you have told the developer what went wrong. A report never replaces the recovery steps above.

Where: `POST https://mor.payments.ai/api/mcp/connect-diagnostics` (Sandbox: `POST https://sandbox.mor.payments.ai/api/mcp/connect-diagnostics`). A 401 from the MCP endpoint also carries the exact URL as `connectDiagnosticsUrl`. Send `Content-Type: application/json`. No `Authorization` header and no token: the endpoint is public. It always answers `204` with an empty body, whether the report was accepted or dropped, so do not retry and do not read anything into the status.

What: a JSON object with exactly these seven fields. Every field is a closed value; a report cannot carry text.

| Field              | Allowed values                                                                                                                                                                                                                                       |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client`           | `claude-code`, `claude`, `cursor`, `codex`, `grok`, `chatgpt`, `gemini`, `vscode`, `other`                                                                                                                                                           |
| `stage`            | `discovery`, `authorize`, `callback`, `token_exchange`, `first_tool_call`, `oauth_interactive_unavailable`, `false_connected_state`                                                                                                                  |
| `code`             | `oauth_interactive_unavailable`, `false_connected_state`, `stale_credential_no_issuer`, `device_code_expired`, `device_consent_denied`, `discovery_failed`, `authorize_failed`, `token_exchange_failed`, `first_tool_call_failed`, `unknown_failure` |
| `mcpServerVersion` | Plain semver, at most 32 characters: the `serverInfo.version` from initialize.                                                                                                                                                                       |
| `clientVersion`    | Plain semver, at most 32 characters: your client's own version.                                                                                                                                                                                      |
| `deployment`       | `sandbox` or `live`: the MCP URL you were connecting to.                                                                                                                                                                                             |
| `reportedAt`       | ISO 8601 UTC timestamp, for example `2026-10-12T09:30:00Z`.                                                                                                                                                                                          |

Pick the `stage` where the connect stopped and the closest `code`. Use `unknown_failure` when no other code fits; use `other` as `client` when yours is not listed.

```json
{
  "client": "cursor",
  "stage": "token_exchange",
  "code": "token_exchange_failed",
  "mcpServerVersion": "1.4.0",
  "clientVersion": "2.0.14",
  "deployment": "live",
  "reportedAt": "2026-10-12T09:30:00Z"
}
```

Never include: tokens, API keys, OAuth codes, merchant data, email addresses, error messages, stack traces or any other prose. Unknown fields are dropped, and a body that contains a `pai_mcp_`, `pai_live_` or `pai_test_` credential is discarded whole. Bodies over 2048 bytes are dropped.
