{
 "schema": "aiblocks-page/1",
 "id": "agency-engineering-payments-billing-engineer",
 "type": "agent",
 "name": "Payments and billing engineer agent",
 "summary": "Plan a Stripe, Adyen, Braintree or PayPal build with no double charges, safe webhooks, a small card-data footprint and daily reconciliation.",
 "headline": "Payments and billing engineer agent",
 "subhead": "Describe your checkout, your payment provider and what you sell. It maps where money can go wrong and plans the fix. You get payment states, a webhook plan, keys that make retries safe, a failure test list and a daily check that your books match your payouts.",
 "job": {
  "id": "build-software",
  "name": "Build and ship software"
 },
 "level": "intermediate",
 "thinking": "high",
 "tested": true,
 "updated": "2026-11-03",
 "first_published": "2026-10-26",
 "inputs": [
  {
   "type": "question",
   "required": true,
   "label": "Question",
   "what": "the problem, decision or piece of work you want help with, and what a good outcome looks like"
  },
  {
   "type": "codebase",
   "required": false,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  },
  {
   "type": "spreadsheet",
   "required": false,
   "label": "Spreadsheet",
   "what": "a spreadsheet with its data, formulas and charts"
  }
 ],
 "outputs": [
  {
   "type": "plan",
   "required": true,
   "label": "Plan",
   "what": "a dated plan: what to do, in what order, with a decision rule for each step"
  }
 ],
 "you_give": [
  "Your payment provider, what you sell, and the currencies you take",
  "Your checkout flow and what happens after payment, including refunds",
  "Your stack, such as language, database and queue",
  "A sample webhook payload, with names, emails and keys removed (optional)",
  "A payout report and your order list for the same dates, if the problem is a mismatch (optional)"
 ],
 "you_get": [
  "A map of the money flow from checkout to payout, with each place it can fail",
  "Payment and subscription states, with every change and what must happen",
  "A webhook plan covering verify, store, dedupe and process",
  "The idempotency key to use for each money action",
  "Card-data scope advice and a failure test list",
  "A daily reconciliation check, and the questions still open"
 ],
 "use_when": [
  "You are adding Stripe, Adyen, Braintree or PayPal checkout and never want to charge twice.",
  "Orders ship twice or not at all because payment webhooks arrive late or twice.",
  "You sell subscriptions and need rules for trials, upgrades, failed payments and cancels.",
  "Your payout from the processor doesn't match your orders and you can't see why."
 ],
 "skip_when": [
  "You want your store's checkout settings checked, such as Shopify payments. Use the Payments and checkout settings checker.",
  "You want to learn why subscribers cancel. Use the Subscription churn auditor.",
  "You need to change live payments, issue refunds or answer a dispute. Do that in your processor's dashboard, with a qualified person for PCI sign-off."
 ],
 "output_sample": {
  "input": [
   "Your payment provider, what you sell and your currencies",
   "Your checkout flow and what happens after payment",
   "Your stack, such as language, database and queue",
   "A sample webhook payload with personal data removed (optional)",
   "A payout report and order list for the same dates (optional)"
  ],
  "prerequisites": [
   "An AI that can read pasted text or files, such as Claude, ChatGPT or Gemini",
   "A test mode on your payment provider, to run the failure tests (optional)"
  ],
  "output": [
   {
    "name": "Money flow",
    "contains": "Each step from checkout to payout, and where it can fail."
   },
   {
    "name": "State tables",
    "contains": "Every payment and subscription state, what triggers each change and what must happen."
   },
   {
    "name": "Idempotency keys",
    "contains": "The key for each money action, so a retry can't repeat it."
   },
   {
    "name": "Webhook handling",
    "contains": "How events are verified, saved, repeated safely and marked complete, including a crash case."
   },
   {
    "name": "Card data scope",
    "contains": "Which integration style keeps card numbers off your servers, and the PCI level that brings."
   },
   {
    "name": "Failure tests",
    "contains": "Declines, 3-D Secure, replays and out-of-order events to try in test mode."
   },
   {
    "name": "Reconciliation",
    "contains": "A daily check of your ledger against the processor's payouts, with the drift rule and alert."
   },
   {
    "name": "Runbook and open questions",
    "contains": "Refund, dispute and retry steps, and what is still missing."
   }
  ]
 },
 "output_shape": "MONEY FLOW\n  <who pays> | <currencies> | <one-time or recurring> | <refund rule> | <payout path>\n  Where it can fail: <step> | <what goes wrong>\n\nSTATE TABLES\n  <state> -> <state> | <trigger> | <what your system must do>\n\nIDEMPOTENCY KEYS\n  <money action> | <key built from> | <retry behaviour>\n\nWEBHOOK HANDLING\n  Verify signature | Save event | Skip repeats by event ID | Process | Mark complete | <what happens on a crash>\n\nCARD DATA SCOPE\n  <integration style> | <PCI validation level> | <why>\n\nFAILURE TESTS\n  <case, such as decline, 3-D Secure, replay, out of order> | <expected result>\n\nRECONCILIATION\n  <ledger total> against <processor payout> | <drift rule> | <alert>\n\nRUNBOOK\n  Refunds | Disputes | Retry schedule | Provider outage\n\nOPEN QUESTIONS\n  MISSING: <what> | <why it matters>",
 "how_to_use": [
  "Download the pack and add it to your AI as a skill. Or open a new chat and paste SKILL.md, then references/source-agent.md.",
  "Describe your provider, products, currencies and flow. Paste a sample webhook with all personal data and keys removed.",
  "Never paste card numbers, secret API keys or webhook signing secrets into any chat.",
  "It cannot reach your payment account or run on a schedule. It plans the daily check for your own system to run. To check a mismatch now, paste the payout report and the order list for the same dates.",
  "Read \"Money flow\" and \"State tables\" first. Check them against how your business really works.",
  "Run the failure test list in your provider's test mode before you go live.",
  "Ask a payments or security expert to review the design before it touches real money."
 ],
 "checks": [
  "The result addresses your actual task and cites the evidence used.",
  "Examples, role-play experience and targets are kept separate from verified results.",
  "Claims of tests, memory, tool access or completed actions match what actually happened."
 ],
 "next": [
  {
   "name": "Stripe payments builder",
   "url": "https://useaiblocks.com/skills/stripe-payments-builder",
   "why": "Build it"
  }
 ],
 "source": {
  "by": "Michael Sitarzewski and Agency Agents contributors",
  "repo": "msitarzewski/agency-agents",
  "url": "https://github.com/msitarzewski/agency-agents/blob/b37b5bb33b78f2c1d6567d98e25ca818e3259219/engineering/engineering-payments-billing-engineer.md",
  "licence": "MIT",
  "original_name": "Payments & Billing Engineer",
  "commit": "b37b5bb33b78f2c1d6567d98e25ca818e3259219"
 },
 "credits": [
  {
   "title": "Payments & Billing Engineer",
   "by": "Michael Sitarzewski and Agency Agents contributors",
   "url": "https://github.com/msitarzewski/agency-agents/blob/b37b5bb33b78f2c1d6567d98e25ca818e3259219/engineering/engineering-payments-billing-engineer.md",
   "used": "Original agent profile, preserved in references/source-agent.md; AI Blocks adds setup and review instructions."
  }
 ],
 "files": [
  "LICENSE",
  "references/source-agent.md",
  "SETUP.md",
  "source.json"
 ],
 "links": {
  "page": "https://useaiblocks.com/agents/agency-engineering-payments-billing-engineer",
  "markdown": "https://useaiblocks.com/agents/agency-engineering-payments-billing-engineer.md",
  "json": "https://useaiblocks.com/agents/agency-engineering-payments-billing-engineer.json",
  "instructions": "https://useaiblocks.com/skills/agency-engineering-payments-billing-engineer/SKILL.md",
  "download": "https://useaiblocks.com/skills/agency-engineering-payments-billing-engineer.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/agency-engineering-payments-billing-engineer",
  "api_document": "https://useaiblocks.com/api/v1/documents/agent/agency-engineering-payments-billing-engineer",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
