Documentation Rules
The 3βDocument Ruleβ
β 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
1οΈβ£ Business Use Case Document β What & Whyβ
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
- Lifecycle meaning (Status β Meaning β Action)
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 payment fails and no money is captured.
2οΈβ£ Integration Document β How to Integrate & Operateβ
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 forPAYMENT_SUCCEEDEDorPAYMENT_FAILED.
Do not poll allocation IDs.
3οΈβ£ Internal Engineering Document β How It Works Insideβ
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)β
π Lifecycle: Where It Belongsβ
β
Lifecycle meaning β Business Document
β
Lifecycle tracking β Integration Document
β
Lifecycle implementation β Internal Document
``
Examplesβ
Business Use Case (Lifecycle Meaning)β
Status Referenceβ
| Status | Meaning | Merchant Action |
|---|---|---|
| COMPLETED | Both cards charged successfully | Fulfill the order |
| FAILED | One or more cards failed | Prompt customer to retry |
| PENDING | Payment is still processing | Wait for webhook |
Integration Document (Lifecycle Tracking)β
Status Handlingβ
Polling Guidelinesβ
- Poll using
paymentIdormerchantTransactionId - 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 Engineering (Lifecycle Implementation)β
Internal Status Flowβ
- AUTHORIZED β CAPTURE_INITIALIZED β COMPLETED
- AUTHORIZED β FAILED β CANCELLED (rollback)
Internal statuses are not exposed to merchants.
π Doc Structure Lint β What to Expectβ
scripts/lintDocStructure.js (via yarn lint:docs) validates every file under docs/01-business/ and docs/03-developers/ against its guideline. Violations are posted as a PR comment and block merge.
Run it locally before pushing:
yarn lint:docs
node scripts/lintDocStructure.js --files path/to/your-doc.md
Which Files Are Lintedβ
| Folder | Guideline Applied |
|---|---|
docs/01-business/** | Business Use Case Guidelines |
docs/03-developers/** (except error-codes) | Integration Document Guidelines |
docs/03-developers/5-convenient-checkout-api/4-error-codes/** | API Error Code Guidelines |
Always skipped: docs/contributing-guide/**, docs/whats-new/**, index.md / index.mdx, _category_.json
β Check 1 β Missing Required Sectionsβ
Every doc must contain these H2 headings:
| Guideline | Required ## Headings |
|---|---|
| Business | Key Benefits Β· How It Works Β· Business Rules Β· Scenarios Β· Related Documentation |
| Integration | [Feature] Processing Flow Β· API Request Β· API Response Β· Status Handling Β· Error Handling Β· FAQ Β· Integration Checklist Β· Related Documentation |
| Error Codes | Error Summary Β· Error Details |
Failure message:
Missing sections:
β’ Key Benefits
β’ How It Works
Fix: Add the missing ## heading and its content.
β Check 2 β Wrong Section Orderβ
Required headings that are present must appear in the same relative order as the guideline defines.
Failure message:
Order issues:
β’ "Scenarios" should appear after "Business Rules" per guideline β found in wrong order
Fix: Re-order sections to match the guideline sequence.
β Check 3 β Missing Required Content Blockβ
Certain admonitions must appear in every doc regardless of headings:
| Guideline | Required Block | Where |
|---|---|---|
| Business | :::tip Get Started | After H1 intro, before ## Key Benefits |
| Integration | :::tip Integration Details | Near the top, before ## API Request |
Failure message:
Missing required content:
β’ Business docs must include a `:::tip Get Started` admonition after the intro.
Fix β Business docs:
:::tip[Get Started]
To integrate [Feature Name], follow the [Integration Guide](/docs/developers/...) for step-by-step instructions and API details.
:::
Fix β Integration docs:
:::tip[Integration Details]
- **Prerequisites:** β¦
- **Endpoint:** β¦
- **Scope:** β¦
- **API Version:** β¦
:::
β Check 4 β Forbidden Content (Business Docs Only)β
| What's Forbidden | Example | Fix |
|---|---|---|
| HTTP verb + versioned path | POST /v2/payments | Move to integration doc |
curl commands | curl -X POST ... | Move to integration doc |
| Shell/curl code blocks | ```bash Β· ```curl | Move to integration doc |
| API Version references | API Version: v2 | Remove β business docs are version-agnostic |
| OpenAPI / Swagger mentions | openapi, swagger | Link from integration doc instead |
## API Request / ## API Response sections | β | These belong in integration docs |
## API Endpoint / ## API Spec references | β | Same |
Exception: Content inside <Audience include="internal"> is skipped.
Failure message:
Content violations:
β’ Line 42: Business docs must not contain API endpoint references.
β POST /v2/payments/allocations
Fix: Remove the flagged content and add a link under ## Related Documentation instead.
βΉοΈ How Headings Are Matchedβ
- Leading numbering stripped:
## 3. Business RulesβBusiness Rules - Trailing dash descriptions stripped:
## Webhooks β Event ReferenceβWebhooks - Markdown formatting stripped:
## **Key Benefits**βKey Benefits - Case-insensitive, non-alphanumeric characters ignored
- Headings inside fenced code blocks are ignored
[Feature Name] Processing Flowuses a suffix match β any##ending withProcessing Flowsatisfies the requirement (e.g.,## Disputes Processing Flow)
π Quick Fix Checklistβ
Before pushing, run yarn lint:docs and confirm:
- Every required
##section exists in the correct order - Business docs have a
:::tip Get Startedblock after the H1 - Integration docs have a
:::tip Integration Detailsblock near the top - Business docs contain no API endpoints, curl commands, or API Version references
- Internal-only technical details are wrapped in
<Audience include="internal">