Skip to content

Build with AI agents

A coding agent such as Claude Code, Codex, or Cursor writes a correct Flint integration when it reads the current request schema for each call instead of recalling one from training data, and when it can try its calls against a sandbox. Flint gives it both:

SourceUse it whenCredential
Docs MCP serverThe agent supports MCP and looks things up as it worksNone
.md pagesThe agent can fetch URLs but has no MCPNone
/SKILL.mdYou want the whole reference on disk to search offlineNone
OpenAPI specYou generate code or validate requests against the schemaNone
flint mcp serveThe agent should create and read resources in your sandboxYour CLI login or API key
An agent reads the schema, then makes the callResponse
Coding agentDocs MCP serverFlint CLIFlint APIlist_operations for refundsoperation IDs, such as createRefundread_operation createRefundauthentication, parameters, and the request body's top-level fieldsread_operation createRefund, section requestevery body field, with the next call for nested schemasflint_write: refunds.create with a sandbox orderPOST /v1/refunds with your test keythe refundthe refund as JSON
  1. Coding agent sends list_operations for refunds to Docs MCP server
  2. Docs MCP server returns operation IDs, such as createRefund to Coding agent
  3. Coding agent sends read_operation createRefund to Docs MCP server
  4. Docs MCP server returns authentication, parameters, and the request body's top-level fields to Coding agent
  5. Coding agent sends read_operation createRefund, section request to Docs MCP server
  6. Docs MCP server returns every body field, with the next call for nested schemas to Coding agent
  7. Coding agent sends flint_write: refunds.create with a sandbox order to Flint CLI
  8. Flint CLI sends POST /v1/refunds with your test key to Flint API
  9. Flint API returns the refund to Flint CLI
  10. Flint CLI returns the refund as JSON to Coding agent

Pick your path#

Most integrations start from one of these jobs. Send the agent to the guides for yours before it writes a request.

You want toBuild it withEvent to act on
Sell a product once: a course, templates, or a downloadSell with hosted checkout: a catalog product with product_type: "digital", sold through a payment link or a checkout session for the order, as in Accept a payment with Next.jsorder.paid
Ship goods, or hand them over at pickup or by local deliveryThe fulfillment API, which ships physical goods and records pickup, local delivery, and service handoffsfulfillment.created
Charge a plan every month or yearSubscription billingsubscription.payment_succeeded
Bill a business customer on termsInvoicesinvoice.paid
Give money backRefundsrefund.succeeded

Use quick_pay on a checkout session only for a one-off amount with no product. For software, a digital variant with license_key_configuration gets a key for each unit, which Flint emails, checks from the shipped app, and disables after a refund or chargeback (license keys). Flint has no file hosting, and a digital catalog product gets no fulfillment: your app delivers downloads and course access after order.paid, once you check the order's dispute_status (access rules).

Before you add checkout to an iOS or Android app, read Payments in mobile apps: digital content or features used inside the app generally need the store's in-app purchase, not Flint.

Let an assistant act for a buyer#

A shopping assistant uses a customer session for the person it represents. After your own login and the buyer's authorization, create the session from your backend with only the capabilities the task needs:

JSON
{
  "customer_id": "cus_1kmn0aExample",
  "capabilities": ["orders.read", "returns.read", "returns.create"]
}

This grant can track orders and start Returns. It cannot charge a saved card, remove payment methods, change account details, or request account deletion. Keep the secret and refresh token on your server. Inspect capabilities on the returned session resource to confirm the grant; refresh preserves it. A missing capability returns 403 INSUFFICIENT_SCOPE with reason scope_not_granted and missing_scopes. Obtain the buyer's authorization before creating a session with more capabilities.

Omitting capabilities gives full buyer access. An empty list gives no account operations except self-revocation. Capabilities do not imply each other, so include read capabilities explicitly when the assistant needs to inspect what it changes. The customer sessions guide lists every capability and the combined grants required for subscription charges.

Docs MCP server#

The docs server lets an agent find a Flint docs page, read it in bounded parts, and open one API operation or schema without loading the rest of the reference:

Text
https://developers.withflintpay.com/mcp

It is public and read-only. It serves documentation only, so it never sees your account, your data, or an API key.

Connect an agent#

Shell
claude mcp add --transport http flint-docs https://developers.withflintpay.com/mcp

To make the agent use it for Flint work, add the project instructions below.

Tools#

The server has seven tools, all read-only. Every result is Markdown that ends with the exact call that continues it, so an agent follows the calls it is given and doesn't build them.

ToolMain argumentsWhat you get
search_docsquery, optional kindsMatching guides and sections, API resources and operations, error codes, webhook event types, CLI commands, changelog entries, lookups, and blog posts. Each result has an excerpt and the read_doc or read_operation call that opens it.
list_docsoptional collection or parentWith no arguments, the collections and the newcomer path. With collection, its documents. With parent, a document's sections, operations, or entries.
read_doctarget, optional sectionA docs page as Markdown. target takes a docs path or URL, with or without .md, and an optional #section.
list_operationsoptional resource, path_prefix, methodPublic API operations as method, path, operation ID, summary, resource, and CLI command. Without filters, it pages through every operation.
read_operationone of operation_id, route, or cli_name; optional sectionOne operation. The default overview gives authentication, scopes, idempotency, parameters, the request body's top-level fields, responses, and error codes. request, response, errors, and examples give the details.
read_schemaschema, optional pointer, depthOne schema's fields: types, required and nullable flags, enum values, constraints, and descriptions. Nested schemas appear as read_schema calls instead of being expanded.
search_flint_helpqueryPublic threads on Flint Help, a separate site, each marked answered or not, for error messages and questions the docs don't cover.

The server tells the client how to use them when it connects. This is the text it sends in initialize:

Flint Pay developer docs, read-only. To find something, call search_docs, or call list_docs with no arguments for the collections and the newcomer path. Open results with the call each result gives: read_doc for pages, read_operation for one API operation, read_schema for a schema's fields. Results hold up to 16 KiB by default (max_bytes allows 2048 to 65536); a longer result ends with the exact call that continues it. search_flint_help searches Flint Help, a separate site with community answers. Every docs page is also Markdown at its URL plus .md, indexed at https://developers.withflintpay.com/llms.txt.

For a change to a Flint call, the loop is discover, read in bounded parts, then refine:

  1. Discover. Call list_operations with a resource, or search_docs with a question, to find the operation.
  2. Read. Call read_operation with the operation_id a result gives. The overview is enough to choose the right operation and see its credential, scopes, and error codes.
  3. Refine. Call read_operation with section: "request" for every body field. When a field names a schema, such as → Money, call the read_schema it gives. When a result ends with a next: line, run that call to read the next part.

Write the request from what the last two reads returned. Use search_docs and read_doc for workflows that span calls, such as refunds or webhooks.

The server enforces a size budget on every result, footer included. Results hold up to 16 KiB by default. Pass max_bytes, from 2048 to 65536, to change that. A result that doesn't fit ends with a footer like this one, where next: is the exact call that returns the following part:

Text
---
target: operation:createRefund · part 1 of 3 · revision 3f9a1c2b7d4e
next: read_operation {"operation_id":"createRefund","cursor":"..."}

The last part says next: none. A cursor belongs to one docs revision, so one from before a docs update comes back as an error that names the call to start again.

Call it from your own client#

The server speaks MCP's Streamable HTTP transport without sessions: each JSON-RPC 2.0 message is a POST, and each response is a single JSON body. You can call it with curl:

cURL
curl -s https://developers.withflintpay.com/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"read_operation","arguments":{"operation_id":"createRefund"}}}'

The result's content holds one text item with the Markdown and its footer, and isError is false:

JSON
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [{ "type": "text", "text": "# Create refund\n\n`POST /v1/refunds` ..." }],
    "isError": false
  }
}
  • Methods. initialize, ping, tools/list, and tools/call. Any other method returns JSON-RPC error -32601.
  • Protocol versions. initialize accepts 2025-11-25 and 2025-06-18 and echoes the version you request. For any other version it answers with 2025-11-25. A request that sends an unsupported MCP-Protocol-Version header gets 400.
  • Notifications. A message with no id, such as notifications/initialized, gets 202 with no body.
  • No batches. Send one JSON-RPC message per POST. An array, of any length, returns 400 with error -32600. A body over 64 KiB returns 413.
  • Tool errors. An unknown page, operation ID, section, or argument comes back as a normal result with "isError": true and a message in content that names the closest valid values, so the agent can correct the call. An unknown tool name returns error -32602.
  • No stream. The server never initiates messages, so GET returns 405.
  • Rate limit. The server limits requests per client and answers 429 when you go over.

Docs as Markdown#

Append .md to the URL of any docs page to get it as Markdown, which suits an agent that can fetch URLs but has no MCP. Guides, API resources, error codes, webhook events, CLI commands, the changelog, lookups, blog posts, and the index pages all have one:

cURL
curl -s https://developers.withflintpay.com/docs/guides/idempotency.md

Every Markdown response is bounded, and a page that doesn't fit is split into parts:

  • Parts. A long page starts with a contents list. Each part ends with a Next: link, and the response carries a Link: <url>; rel="next" header, so an agent can follow either one. The last part has neither.
  • Sections. Add ?section=<id> to read one section by the id in the contents list, such as /docs/guides/webhooks.md?section=retries. On the error, event, and CLI pages, section reads one entry.
  • Size. Add ?max_bytes= to change the part size. The default is 64 KiB, and the range is 4 KiB to 256 KiB.
  • Operations and schemas. Each API operation and schema has its own page: /docs/api/operations/createRefund.md and /docs/api/schemas/Money.md. An operation page takes ?section=overview, request, response, errors, or examples.
  • Changelog. /changelog.md lists entries and takes since, tag, and breaking filters, such as /changelog.md?breaking=true.

Two files index the site for agents that crawl:

  • /llms.txt is the index: every guide, API resource, and article with its .md link and a one-line description. Start here to pick the pages a task needs.
  • /llms/manifest.json lists the collections as JSON, each with the shard files that list its documents, their sizes, and their section counts. Use it to fetch every document without parsing llms.txt.

/llms-full.txt is retired: it returns 410 and points to llms.txt and the manifest, because the docs no longer fit in one file.

SKILL.md#

/SKILL.md is the public HTTP API in one Markdown file, written for agents. Download it to keep a reference on disk that works offline:

cURL
curl -fsS https://developers.withflintpay.com/SKILL.md -o flint-api-reference.md

It covers:

  • Base URL and auth. The API host, flint_test_... and flint_live_... keys, and the other credential types.
  • Shared conventions. JSON style, response envelopes, pagination, idempotency, sparse updates, the error envelope, and rate limits.
  • ID prefixes. The prefix of every resource ID, so an agent can tell an order ID from a payment intent ID.
  • One section per resource. Every public /v1 route, with request rules, list filters, and notes on behavior.
  • Quick start examples. Five curl requests for common flows, right after the auth section.
  • SDKs. The Node and PHP package names, how to build a client, and which money shape each uses.

The file runs to a few hundred kilobytes. Have the agent search it, or read the conventions and the sections for the resources the task touches, rather than loading it into every task. For the exact fields of one operation, read_operation or the API reference is more precise.

OpenAPI spec#

The OpenAPI 3.1 document describes every public /v1 path, schema, enum, and error envelope. It needs no API key:

cURL
curl -s --compressed https://api.withflintpay.com/v1/openapi.json -o flint-openapi.json

Use it to generate a client or to validate request bodies an agent writes. OpenAPI covers API versions and what the spec includes.

Use an SDK in Node or PHP#

In a Node or PHP backend, the official SDKs keep amounts exact, send idempotency keys, and verify webhook signatures, so the agent doesn't hand-write those parts. Install the package for your language and build a client from your API key:

Shell
npm install @flintpay/node@next
composer require "flintpay/flint:^8.0@beta"
TypeScript
import { Client } from "@flintpay/node";

const flint = new Client({ apiKey: process.env.FLINT_API_KEY! });

In PHP, the same client is new Client(new ClientOptions(apiKey: getenv('FLINT_API_KEY'))). Keep the key on your server, never in browser or mobile code.

The money shape differs. SDK amounts and quantities are integer strings, such as "2500", so a value never passes through floating point. Raw HTTP requests send JSON integers, such as 2500. Don't mix SDK examples with raw fetch calls in the same codebase. The SDK guide covers calls, errors, and webhook verification, and money and amounts explains both shapes.

Tell the agent when to look#

An agent uses the docs server when its instructions say to. Add a short section to the file your agent reads for project instructions: AGENTS.md for Codex, Cursor, and most other agents, or CLAUDE.md for Claude Code. Scope it to Flint work so unrelated tasks don't spend context on it.

Markdown
## Flint Pay

For any change to a Flint API call:

- Look up the operation first with the flint-docs MCP server (`list_operations`,
  then `read_operation`) and follow its request schema exactly. Without MCP, fetch
  the page's Markdown by appending .md to its developers.withflintpay.com URL.
- Use only sandbox keys (`flint_test_...`), read from the environment.
- Money is an object with integer minor units and an uppercase currency:
  {"amount": 2500, "currency": "USD"} is $25.00.
- Send an Idempotency-Key header on every write, and reuse the same key only
  when retrying the same request.
- In Node or PHP projects, call Flint through @flintpay/node or flintpay/flint.
  SDK amounts are integer strings ("2500"); raw HTTP amounts are JSON
  integers (2500).
- Sell one-time and digital products as catalog products (product_type
  "digital") through a payment link or an order checkout session, and grant
  access on the order.paid webhook event. Use quick_pay only for a one-off
  amount with no product.
- On an error, follow `error.remediation.retry`. Ask me before acting on a
  `next_actions` entry with `requires_human_confirmation: true`.

The rules after the first come from money and amounts, idempotency, and error handling. They are the mistakes that most often turn a plausible request into a rejected one, or a retry into a duplicate charge. An Idempotency-Key is safe on every write: routes that don't use one ignore it.

For a chat assistant with no tools, paste the conventions section of SKILL.md and the sections for the resources in your task, along with the task itself.

Let an agent call the API#

The Flint CLI exposes its commands as MCP tools with flint mcp serve, a local server over stdio. An agent can then create a customer, take a test payment, refund it, and read webhook events in your sandbox, using the credential you signed in with. Register it next to the docs server:

Shell
claude mcp add --transport stdio flint -- flint mcp serve
Docs MCP serverflint mcp serve
RunsHosted at developers.withflintpay.com/mcpOn your machine, started by the agent client
TransportStreamable HTTPstdio
CredentialNoneYour CLI login, profile, or FLINT_API_KEY
Can doSearch and read docs and schemasCall the API: create, read, update, and delete resources

Warning: Give agents a sandbox

Start the server with a sandbox key (flint_test_...) or a profile that points at a sandbox. Live calls need you to start the server with --allow-live, and the agent still has to mark each live call.

By default, flint mcp serve exposes five discovery tools: flint_search, flint_describe, flint_read, flint_write, and flint_help. The agent finds an operation, inspects its public arguments, then calls it by operation ID, such as refunds.create. The default tools/list is about 6 KB, down from about 226 KB in 0.14.x.

The person who starts the server sets its limits:

  • Tools. --tools orders,refunds.create opts into typed tools for groups or operation IDs, plus scoped search, describe, and help. Typed names use only lowercase letters, digits, and underscores, such as payment_intents_create. See the CLI guide for measured tools/list sizes. --tools default is removed. --read-only removes write tools and refuses every write, including dry runs.
  • Account. The profile, merchant guard, context, and timeout are fixed at startup. Credential class limits discovery and calls. Sign in and import keys in your terminal. CLI 0.20.6 can return credentials in tool results, including secret_key from api-keys.create. CLI releases with MCP credential masking save the secret to a private local file instead.
  • Confirmation. Sensitive or irreversible writes require confirm: true in every environment. A sandbox agent checks the effect and confirms without asking a person. Live access needs --allow-live and per-call live: true; a gated live or unverified write also asks you through MCP elicitation. Without elicitation, CONFIRMATION_NEEDS_USER returns an exact terminal command that prompts you, using the same credential and project directory. --allow-destructive permits agent confirmation there.
  • Dry runs. The agent checks a write with top-level dry_run: true, outside arguments. The result describes the effect, affected resources, and amounts. Other controls, such as confirm, select, and idempotency_key, are top-level too; _flint is removed.
  • Results. Reads are capped at 49,152 bytes; use select, filters, or a smaller page_size for larger results. Lists default to 10 items per page. Completed writes return the full result with a warning if oversized.

An agent that runs shell commands instead of MCP can read the CLI's schemas as JSON, build a body that matches, and check it locally before the request:

Shell
flint schema commands refunds --output json
flint schema input refunds.create --output json
flint refunds create --input refund.json --idempotency-key refund-ord-1042 \
  --dry-run=client --output json

--output json also turns off prompts, so no command waits for input an agent can't give. Routes that require an idempotency key, such as refunds create, fail locally until the agent passes --idempotency-key, even on a dry run, so it has to choose a key it can reuse on a retry. Agents and MCP in the CLI guide covers every flag, the execution controls, and a Cursor configuration.

When the agent gets stuck#

  • Search. The docs server's search_flint_help tool finds answered threads. In a terminal, flint help search searches the installed command, event, and reference-topic catalog offline. Neither needs a credential.
  • Ask a person. flint support open --ai-agent --no-open prints a Flint Help link with the request ID, product area, and environment filled in. --ai-agent labels the thread as opened by an agent. A person reviews it and posts it from a browser; the CLI never posts on its own. See Getting help.
  • Read the error. Every API error has error.doc_url, which links to the code in the error catalog, and error.request_id, which finds the request in your request logs.

Next steps#

Flint CLIInstall the CLI, sign in to a sandbox, and run flint mcp serve.Error handlingThe error envelope, retry values, and next_actions an agent can act on.API & agent onboardingCreate a Flint account and its first sandbox key from your backend or an agent.

Was this helpful?