Checking access…

Skip to main content

Documentation Rules

Who should read this page

Anyone authoring or editing content under docs/01-business/, docs/03-Integration/, or docs-ccg-internal/05-engineering-guide/, and anyone reviewing a documentation PR for structure/lint compliance. Read this page first, then jump to the specific guideline your content type needs using the table below.

Find Your Rule​

Not every content family fits the 3-Document Rule below — some have their own dedicated guideline instead. Start here, then jump to whichever page matches what you're writing:

📋 Jump to your content type
If you're writing…See
A business-facing feature/capability doc (docs/01-business/)Business Use Case Document below, then Business Use Case Guidelines
An API integration doc (docs/03-Integration/, not yet Diataxis-split)Integration Document below, then Integration Document Guidelines
A UI integration doc (a widget/hosted page consuming teams embed)UI Integration Document Guidelines
An internal engineering page (docs-ccg-internal/05-engineering-guide/)Internal Engineering Document below, then Engineering Guide Documentation Guidelines
API error code documentation (MDX page + JSON data file)API Error Code Document Guidelines — its own template, not covered by the 3-Document Rule
UI validation/error message tables (JSON-driven)UI Error Messages — Authoring Guide
A High-Level Design docHLD Template
An OpenAPI schema moduleOpenAPI Authoring Standards
A /docs/changelog entryChangelog Maintenance Guide
A dated notice readers need to seeAnnouncement Template — includes when an announcement is warranted
Something about who owns/reviews a doc areaDocumentation Owners
Something about the merchant/internal audience splitInternal vs. Merchant Content Guide

The 3‑Document Rule​

Ask yourself:

👤 Who should write this? Business docs are written by Product/TPM, not engineers. Integration and Internal Engineering docs are written by engineers. See "Written by" under each type below.

❓ Am I explaining WHAT it means? → Business doc

❓ Am I explaining HOW to call or track it? → Integration doc

❓ Am I explaining HOW it works internally? → Internal doc

The Integration row below is the legacy template; migrated pages follow Diataxis instead — see Integration Document Guidelines / Engineering Guide Documentation Guidelines.

1️⃣ Business Use Case Document — What & Why​

Written by: Product Manager or TPM (Technical Product Manager) — not engineers. If an engineer is drafting one, loop in Product/TPM to review before publishing. Audience: Product, Business, Support, Leadership, Engineers (for context)

Purpose:

  • Explain what the feature does
  • Explain why it exists
  • Explain what outcomes to expect

Includes:

  • Real‑world examples
  • Business rules & constraints
  • Scenarios and edge cases
  • Outcome meaning — what a result means to the merchant and customer, and what they can do next

Does NOT include:

  • API endpoints
  • Request/response payloads
  • Polling or webhook mechanics
  • Internal system states

✅ Example:

Split Tender Payments allow customers to pay with two cards.
If either card fails, the combined payment fails and CCG reverses any successful card allocation.


2️⃣ Integration Document — How to Integrate & Operate​

Written by: Engineers (backend/platform engineer who built or owns the API). Audience: API consumers, Integration engineers, CCG Platform Engineers

Purpose:

  • Explain how to call the API
  • Explain how to track status
  • Explain how to recover from failures

Includes:

  • API endpoints and headers
  • Sample request / response (use‑case specific)
  • Lifecycle tracking (polling + webhooks)
  • Retry rules and idempotency
  • Error handling guidance

Does NOT include:

  • Business justification
  • User‑level explanations
  • Internal DB / processor states (unless marked internal)

✅ Example:

Poll the parent paymentId.
Listen for PAYMENT_SUCCEEDED or PAYMENT_FAILED.
Do not poll allocation IDs.


3️⃣ Internal Engineering Document — How It Works Inside​

Written by: Engineers (the engineer who implemented the flow being documented). Audience: CCG / Platform Engineers only

Purpose:

  • Explain internal sequencing
  • Explain processor behavior
  • Explain internal statuses & rollback logic

Includes:

  • Architecture diagrams
  • Processor‑level flows
  • Internal status combinations
  • Implementation notes

Rule:

⚠️ Must always be wrapped in
<Audience include="internal">

✅ Example:

Internally, Split Tender uses PRE‑AUTH + CAPTURE with automatic cancellation on partial failure.

🧠 Lifecycle Rule (Most Important)​

A feature's lifecycle can appear in three document families, each covering a different facet:

✅ Outcome meaning → Business Document ✅ Lifecycle tracking → Integration Document
✅ Lifecycle implementation → Internal Document

The worked example below is one feature (Split Tender payments) shown across all three facets.

Business Document — Lifecycle Meaning​

Payment outcome — explain what a result means to the merchant and customer, and what they can do next. See Split Tender Payments for an example.

Integration Document — Lifecycle Tracking​

Status Handling

Polling guidelines:

  • Poll using paymentId or merchantTransactionId
  • Do not poll individual allocation IDs

Webhooks:

  • PAYMENT_SUCCEEDED → transaction completed
  • PAYMENT_FAILED → transaction failed (not final if retries remain)

Status computation:

  • All allocations succeed → COMPLETED
  • Any allocation fails → FAILED

Internal Document — Lifecycle Implementation​

🔒 InternalNot visible in the public site

Internal Status Flow

  • AUTHORIZED → CAPTURE_INITIALIZED → COMPLETED
  • AUTHORIZED → FAILED → CANCELLED (rollback)

Internal statuses are not exposed to merchants.

Doc Structure Lint​

yarn lint:docs validates document structure, OpenAPI example consistency, link/anchor/slug integrity, slug collisions, product scope, and Optum Wallet tag leaks. Business capability pages have content-boundary checks but no mandatory heading sequence; legacy Integration and selected Engineering pages have their own structure checks. See Documentation Lints Reference for the structure rules, the full list of validation scripts, what each checks, and which ones actually run in a PR check versus needing a manual run.