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:
- Reference it can read. The hosted docs MCP server, every guide and API reference page as Markdown, a one-file API reference, and the OpenAPI spec. None of them needs an API key or touches your account.
- A way to act. The Flint CLI runs a local MCP server,
flint mcp serve, that calls the API with your credential inside limits you set.
| Source | Use it when | Credential |
|---|---|---|
| Docs MCP server | The agent supports MCP and looks things up as it works | None |
.md pages | The agent can fetch URLs but has no MCP | None |
/SKILL.md | You want the whole reference on disk to search offline | None |
| OpenAPI spec | You generate code or validate requests against the schema | None |
flint mcp serve | The agent should create and read resources in your sandbox | Your CLI login or API key |
- Coding agent sends list_operations for refunds to Docs MCP server
- Docs MCP server returns operation IDs, such as createRefund to Coding agent
- Coding agent sends read_operation createRefund to Docs MCP server
- Docs MCP server returns authentication, parameters, and the request body's top-level fields to Coding agent
- Coding agent sends read_operation createRefund, section request to Docs MCP server
- Docs MCP server returns every body field, with the next call for nested schemas to Coding agent
- Coding agent sends flint_write: refunds.create with a sandbox order to Flint CLI
- Flint CLI sends POST /v1/refunds with your test key to Flint API
- Flint API returns the refund to Flint CLI
- 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 to | Build it with | Event to act on |
|---|---|---|
| Sell a product once: a course, templates, or a download | Sell 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.js | order.paid |
| Ship goods, or hand them over at pickup or by local delivery | The fulfillment API, which ships physical goods and records pickup, local delivery, and service handoffs | fulfillment.created |
| Charge a plan every month or year | Subscription billing | subscription.payment_succeeded |
| Bill a business customer on terms | Invoices | invoice.paid |
| Give money back | Refunds | refund.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:
{
"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:
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#
claude mcp add --transport http flint-docs https://developers.withflintpay.com/mcp
codex mcp add flint-docs --url https://developers.withflintpay.com/mcp
The Codex CLI, the Codex IDE extension, and the ChatGPT desktop app share this configuration.
Add the server to .cursor/mcp.json in your project, or to ~/.cursor/mcp.json for every project:
{
"mcpServers": {
"flint-docs": {
"url": "https://developers.withflintpay.com/mcp"
}
}
}
Add the server to .vscode/mcp.json in your workspace:
{
"servers": {
"flint-docs": {
"type": "http",
"url": "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.
| Tool | Main arguments | What you get |
|---|---|---|
search_docs | query, optional kinds | Matching 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_docs | optional collection or parent | With no arguments, the collections and the newcomer path. With collection, its documents. With parent, a document's sections, operations, or entries. |
read_doc | target, optional section | A docs page as Markdown. target takes a docs path or URL, with or without .md, and an optional #section. |
list_operations | optional resource, path_prefix, method | Public API operations as method, path, operation ID, summary, resource, and CLI command. Without filters, it pages through every operation. |
read_operation | one of operation_id, route, or cli_name; optional section | One 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_schema | schema, optional pointer, depth | One 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_help | query | Public 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:
- Discover. Call
list_operationswith aresource, orsearch_docswith a question, to find the operation. - Read. Call
read_operationwith theoperation_ida result gives. The overview is enough to choose the right operation and see its credential, scopes, and error codes. - Refine. Call
read_operationwithsection: "request"for every body field. When a field names a schema, such as→ Money, call theread_schemait gives. When a result ends with anext: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:
---
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 -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:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [{ "type": "text", "text": "# Create refund\n\n`POST /v1/refunds` ..." }],
"isError": false
}
}
- Methods.
initialize,ping,tools/list, andtools/call. Any other method returns JSON-RPC error-32601. - Protocol versions.
initializeaccepts2025-11-25and2025-06-18and echoes the version you request. For any other version it answers with2025-11-25. A request that sends an unsupportedMCP-Protocol-Versionheader gets400. - Notifications. A message with no
id, such asnotifications/initialized, gets202with no body. - No batches. Send one JSON-RPC message per
POST. An array, of any length, returns400with error-32600. A body over 64 KiB returns413. - Tool errors. An unknown page, operation ID, section, or argument comes back as a normal result with
"isError": trueand a message incontentthat 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
GETreturns405. - Rate limit. The server limits requests per client and answers
429when 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 -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 aLink: <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,sectionreads 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.mdand/docs/api/schemas/Money.md. An operation page takes?section=overview,request,response,errors, orexamples. - Changelog.
/changelog.mdlists entries and takessince,tag, andbreakingfilters, 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
.mdlink 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 -fsS https://developers.withflintpay.com/SKILL.md -o flint-api-reference.md
It covers:
- Base URL and auth. The API host,
flint_test_...andflint_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
/v1route, 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 -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:
npm install @flintpay/node@next
composer require "flintpay/flint:^8.0@beta"
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.
## 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:
claude mcp add --transport stdio flint -- flint mcp serve
| Docs MCP server | flint mcp serve | |
|---|---|---|
| Runs | Hosted at developers.withflintpay.com/mcp | On your machine, started by the agent client |
| Transport | Streamable HTTP | stdio |
| Credential | None | Your CLI login, profile, or FLINT_API_KEY |
| Can do | Search and read docs and schemas | Call 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.createopts into typed tools for groups or operation IDs, plus scoped search, describe, and help. Typed names use only lowercase letters, digits, and underscores, such aspayment_intents_create. See the CLI guide for measuredtools/listsizes.--tools defaultis removed.--read-onlyremoves 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_keyfromapi-keys.create. CLI releases with MCP credential masking save the secret to a private local file instead. - Confirmation. Sensitive or irreversible writes require
confirm: truein every environment. A sandbox agent checks the effect and confirms without asking a person. Live access needs--allow-liveand per-calllive: true; a gated live or unverified write also asks you through MCP elicitation. Without elicitation,CONFIRMATION_NEEDS_USERreturns an exact terminal command that prompts you, using the same credential and project directory.--allow-destructivepermits agent confirmation there. - Dry runs. The agent checks a write with top-level
dry_run: true, outsidearguments. The result describes the effect, affected resources, and amounts. Other controls, such asconfirm,select, andidempotency_key, are top-level too;_flintis removed. - Results. Reads are capped at 49,152 bytes; use
select, filters, or a smallerpage_sizefor 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:
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_helptool finds answered threads. In a terminal,flint help searchsearches the installed command, event, and reference-topic catalog offline. Neither needs a credential. - Ask a person.
flint support open --ai-agent --no-openprints a Flint Help link with the request ID, product area, and environment filled in.--ai-agentlabels 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, anderror.request_id, which finds the request in your request logs.