{
  "title": "DN Partial-Invoice Allocation Ledger — original method record",
  "version": 1,
  "commissionId": "N031",
  "articleUrl": "https://decentralised.news/partial-stablecoin-invoice-payment-reconciliation-2027",
  "reviewedOn": "2026-11-29",
  "planningEdition": 2027,
  "creator": {
    "name": "Decentralised News",
    "url": "https://decentralised.news"
  },
  "dataClassification": "Original fictional teaching data; not observed merchant results.",
  "evidenceBoundary": "Official public documentation and original hypothetical arithmetic. No merchant account, paid transaction, referral earnings or production payout was tested.",
  "sources": [
    {
      "url": "https://docs.stripe.com/invoicing/partial-payments",
      "title": "Stripe: Accept partial payments for invoices",
      "checkedOn": "2026-11-29",
      "supportedClaims": [
        "Invoice accounting can retain multiple smaller payments against one invoice.",
        "Stripe's documented workflow uses attached payment records; this does not establish that arbitrary onchain transfers are native Stripe invoice payments."
      ]
    },
    {
      "url": "https://developers.circle.com/stablecoins/usdc-contract-addresses",
      "title": "Circle: USDC contract addresses",
      "checkedOn": "2026-11-29",
      "supportedClaims": [
        "Circle identifies USDC contracts separately by network."
      ]
    },
    {
      "url": "https://developers.circle.com/circle-mint/supported-chains-and-currencies",
      "title": "Circle Mint: Supported chains and currencies",
      "checkedOn": "2026-11-29",
      "supportedClaims": [
        "Circle Mint support depends on currency/network pairs and differs from token existence on a chain.",
        "The page warns against unsupported assets and bridged USDC for Circle Mint deposits."
      ]
    },
    {
      "url": "https://developers.circle.com/circle-mint/references/blockchain-confirmations",
      "title": "Circle Mint: Blockchain confirmations",
      "checkedOn": "2026-11-29",
      "supportedClaims": [
        "Circle specifies network-dependent confirmation requirements and discusses reorganisation risk."
      ]
    }
  ],
  "inputDefinitions": [
    {
      "field": "invoice",
      "label": "Invoice face amount (USD)"
    },
    {
      "field": "credits",
      "label": "Documented invoice credits (USD)"
    },
    {
      "field": "receipts",
      "label": "Synthetic receipt rows"
    }
  ],
  "syntheticInputs": {
    "invoice": "1200.00",
    "credits": "0.00",
    "receipts": "[\n  {\n    \"id\": \"demo:chain-a:event-1\",\n    \"amount\": \"400.00\",\n    \"state\": \"allocated\"\n  },\n  {\n    \"id\": \"demo:chain-b:event-2\",\n    \"amount\": \"550.00\",\n    \"state\": \"allocated\"\n  },\n  {\n    \"id\": \"demo:chain-a:event-3\",\n    \"amount\": \"250.00\",\n    \"state\": \"pending\"\n  },\n  {\n    \"id\": \"demo:chain-a:event-4\",\n    \"amount\": \"50.00\",\n    \"state\": \"unassigned\"\n  },\n  {\n    \"id\": \"demo:chain-a:event-1\",\n    \"amount\": \"400.00\",\n    \"state\": \"allocated\"\n  }\n]"
  },
  "workedOutput": {
    "summary": "The invoice still has a remaining unpaid balance; pending and unassigned receipts have not settled it.",
    "metrics": [
      {
        "label": "Allocated accepted receipts",
        "value": "USD 950.00"
      },
      {
        "label": "Remaining invoice amount",
        "value": "USD 250.00"
      },
      {
        "label": "Excess allocated amount",
        "value": "USD 0.00"
      },
      {
        "label": "Pending amount excluded",
        "value": "USD 250.00"
      },
      {
        "label": "Unassigned amount excluded",
        "value": "USD 50.00"
      },
      {
        "label": "Exact duplicate rows ignored",
        "value": "1"
      }
    ],
    "columns": [
      {
        "key": "id",
        "label": "Receipt event ID"
      },
      {
        "key": "state",
        "label": "Declared state"
      },
      {
        "key": "amount",
        "label": "Invoice-currency amount (USD)"
      },
      {
        "key": "counted",
        "label": "Applied to invoice"
      }
    ],
    "rows": [
      {
        "id": "demo:chain-a:event-1",
        "state": "allocated",
        "amount": "400.00",
        "counted": "Yes, under your declared allocation"
      },
      {
        "id": "demo:chain-b:event-2",
        "state": "allocated",
        "amount": "550.00",
        "counted": "Yes, under your declared allocation"
      },
      {
        "id": "demo:chain-a:event-3",
        "state": "pending",
        "amount": "250.00",
        "counted": "No"
      },
      {
        "id": "demo:chain-a:event-4",
        "state": "unassigned",
        "amount": "50.00",
        "counted": "No"
      }
    ],
    "notes": [
      "Amounts are already-valued invoice-currency USD amounts at cent precision, not raw token quantities. Verify the asset, network, recipient, confirmation rule and conversion agreement outside this worksheet.",
      "Use a stable unique event ID. Exact repeated rows count once; conflicting rows stop calculation. This only checks duplicates inside the supplied list.",
      "One invoice, no automatic transfer attribution, currency conversion, write-off, refund or posting to accounting software."
    ]
  },
  "calculationRules": [
    "Adjusted invoice = face amount − documented credits.",
    "Count unique rows marked allocated; keep pending, unassigned and excluded rows outside applied payments.",
    "Invoice remainder = adjusted invoice − allocated receipts; display any negative remainder as excess separately.",
    "Exact repeated normalized records count once; conflicting records with the same ID stop calculation."
  ],
  "knownAnswerAndValidationCases": [
    {
      "kind": "N031",
      "name": "partial with pending and duplicate",
      "input": {
        "invoice": "1200.00",
        "credits": "0.00",
        "receipts": "[\n  {\n    \"id\": \"demo:chain-a:event-1\",\n    \"amount\": \"400.00\",\n    \"state\": \"allocated\"\n  },\n  {\n    \"id\": \"demo:chain-b:event-2\",\n    \"amount\": \"550.00\",\n    \"state\": \"allocated\"\n  },\n  {\n    \"id\": \"demo:chain-a:event-3\",\n    \"amount\": \"250.00\",\n    \"state\": \"pending\"\n  },\n  {\n    \"id\": \"demo:chain-a:event-4\",\n    \"amount\": \"50.00\",\n    \"state\": \"unassigned\"\n  },\n  {\n    \"id\": \"demo:chain-a:event-1\",\n    \"amount\": \"400.00\",\n    \"state\": \"allocated\"\n  }\n]"
      },
      "expectedSummaryIncludes": "remaining unpaid balance",
      "expectedMetrics": {
        "Allocated accepted receipts": "USD 950.00",
        "Remaining invoice amount": "USD 250.00",
        "Exact duplicate rows ignored": "1"
      }
    },
    {
      "kind": "N031",
      "name": "excess allocation",
      "input": {
        "invoice": "100.00",
        "credits": "0.00",
        "receipts": "[{\"id\":\"r1\",\"amount\":\"120.00\",\"state\":\"allocated\"}]"
      },
      "expectedSummaryIncludes": "exceed",
      "expectedMetrics": {
        "Excess allocated amount": "USD 20.00"
      }
    },
    {
      "kind": "N031",
      "name": "conflicting duplicate",
      "input": {
        "invoice": "1200.00",
        "credits": "0.00",
        "receipts": "[{\"id\":\"r1\",\"amount\":\"1.00\",\"state\":\"pending\"},{\"id\":\"r1\",\"amount\":\"1.00\",\"state\":\"allocated\"}]"
      },
      "expectError": "Conflicting"
    },
    {
      "kind": "N031",
      "name": "raw six decimal token unsupported",
      "input": {
        "invoice": "1200.00",
        "credits": "0.00",
        "receipts": "[{\"id\":\"r1\",\"amount\":\"1.000001\",\"state\":\"allocated\"}]"
      },
      "expectError": "two decimal"
    }
  ],
  "limitations": [
    "Amounts are already-valued invoice-currency USD amounts at cent precision, not raw token quantities. Verify the asset, network, recipient, confirmation rule and conversion agreement outside this worksheet.",
    "Use a stable unique event ID. Exact repeated rows count once; conflicting rows stop calculation. This only checks duplicates inside the supplied list.",
    "One invoice, no automatic transfer attribution, currency conversion, write-off, refund or posting to accounting software."
  ],
  "notTested": [
    "Provider accounts",
    "Live customer or affiliate records",
    "Actual transfers or payouts",
    "Account eligibility",
    "Legal or accounting recognition",
    "Future provider rules"
  ],
  "privacy": "The embedded worksheet performs local arithmetic and does not connect to a provider account. Do not paste secrets or customer identities into teaching examples.",
  "calculationModule": "calculator.js"
}
