Zum Inhalt
HALOWERK

Finopswerk

credit grant finalization ledger

Reconstruct a finite supplied credit-grant ledger from original amounts, scope, priority and invoice event order. Preview does not consume; finalization does; void restores prior grant allocations subject to expiry; credit-note events do not restore grants. Exact finite integer specialization with disclosed stable final ties, not Stripe-runtime/financial/account validity. One missing grant amount preserves all 101 correlated source jobs. A schema-valid unknown is a successful result at the.

POST https://finops.halowerk.com/v1/credit-grant-finalization-ledger

Eingaben

Felder des veröffentlichten Eingabeschemas
FeldTypPflichtBeschreibung
grantsarrayJa
invoicesarrayJa
eventsarrayJa
reportobjectJa
Vollständiges Eingabeschema anzeigen
{
  "type": "object",
  "properties": {
    "grants": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,15}$",
            "minLength": 1,
            "maxLength": 16
          },
          "amount_minor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "enum": [
              "USD",
              "EUR"
            ]
          },
          "created": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000
          },
          "effective_at": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99
          },
          "promotional": {
            "type": "boolean"
          },
          "prices": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,15}$",
              "minLength": 1,
              "maxLength": 16
            },
            "minItems": 0,
            "maxItems": 3
          }
        },
        "required": [
          "id",
          "amount_minor",
          "currency",
          "created",
          "effective_at",
          "expires_at",
          "priority",
          "promotional",
          "prices"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 4
    },
    "invoices": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,15}$",
            "minLength": 1,
            "maxLength": 16
          },
          "currency": {
            "enum": [
              "USD",
              "EUR"
            ]
          },
          "period_end": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000
          },
          "subscription": {
            "type": "boolean"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "price": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,15}$",
                  "minLength": 1,
                  "maxLength": 16
                },
                "kind": {
                  "enum": [
                    "metered",
                    "licensed",
                    "legacy",
                    "one_off"
                  ]
                },
                "amount_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 1000
                }
              },
              "required": [
                "price",
                "kind",
                "amount_minor"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 3
          }
        },
        "required": [
          "id",
          "currency",
          "period_end",
          "subscription",
          "lines"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 3
    },
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "enum": [
              "preview",
              "finalize",
              "void",
              "credit_note"
            ]
          },
          "invoice": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,15}$",
            "minLength": 1,
            "maxLength": 16
          },
          "at": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000
          }
        },
        "required": [
          "type",
          "invoice",
          "at"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 6
    },
    "report": {
      "type": "object",
      "properties": {
        "events": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "credited_minor": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 3000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "uncovered_minor": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 3000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "restored_minor": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 3000
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "credited_minor",
              "uncovered_minor",
              "restored_minor"
            ],
            "additionalProperties": false
          },
          "minItems": 1,
          "maxItems": 6
        },
        "remaining_minor": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "minItems": 1,
          "maxItems": 4
        }
      },
      "required": [
        "events",
        "remaining_minor"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "grants",
    "invoices",
    "events",
    "report"
  ],
  "additionalProperties": false
}

Originalschema öffnen

Veröffentlichtes Eingabebeispiel

{
  "grants": [
    {
      "id": "promo",
      "amount_minor": 50,
      "currency": "USD",
      "created": 0,
      "effective_at": 0,
      "expires_at": 80,
      "priority": 1,
      "promotional": true,
      "prices": [
        "api"
      ]
    },
    {
      "id": "paid",
      "amount_minor": 40,
      "currency": "USD",
      "created": 0,
      "effective_at": 0,
      "expires_at": null,
      "priority": 0,
      "promotional": false,
      "prices": []
    }
  ],
  "invoices": [
    {
      "id": "a",
      "currency": "USD",
      "period_end": 20,
      "subscription": true,
      "lines": [
        {
          "price": "api",
          "kind": "metered",
          "amount_minor": 30
        },
        {
          "price": "setup",
          "kind": "licensed",
          "amount_minor": 20
        }
      ]
    },
    {
      "id": "b",
      "currency": "USD",
      "period_end": 25,
      "subscription": true,
      "lines": [
        {
          "price": "api",
          "kind": "metered",
          "amount_minor": 45
        },
        {
          "price": "setup",
          "kind": "licensed",
          "amount_minor": 20
        }
      ]
    },
    {
      "id": "c",
      "currency": "USD",
      "period_end": 50,
      "subscription": true,
      "lines": [
        {
          "price": "api",
          "kind": "metered",
          "amount_minor": 60
        },
        {
          "price": "setup",
          "kind": "licensed",
          "amount_minor": 20
        }
      ]
    }
  ],
  "events": [
    {
      "type": "finalize",
      "invoice": "a",
      "at": 30
    },
    {
      "type": "preview",
      "invoice": "b",
      "at": 35
    },
    {
      "type": "finalize",
      "invoice": "b",
      "at": 40
    },
    {
      "type": "credit_note",
      "invoice": "a",
      "at": 45
    },
    {
      "type": "void",
      "invoice": "a",
      "at": 60
    },
    {
      "type": "finalize",
      "invoice": "c",
      "at": 70
    }
  ],
  "report": {
    "events": [
      {
        "credited_minor": 30,
        "uncovered_minor": 20,
        "restored_minor": 0
      },
      {
        "credited_minor": 45,
        "uncovered_minor": 20,
        "restored_minor": 0
      },
      {
        "credited_minor": 45,
        "uncovered_minor": 20,
        "restored_minor": 0
      },
      {
        "credited_minor": 0,
        "uncovered_minor": 0,
        "restored_minor": 0
      },
      {
        "credited_minor": 0,
        "uncovered_minor": 0,
        "restored_minor": 30
      },
      {
        "credited_minor": 45,
        "uncovered_minor": 35,
        "restored_minor": 0
      }
    ],
    "remaining_minor": [
      0,
      0
    ]
  }
}

Ergebnis & Dokumentation

Maschinenlesbare Dokumentation dieses Hubs

Quelle dieser Seite: der veröffentlichte HALOWERK-Katalog. Stand: 2026-11-07, 02:42 UTC.

Weitere Endpunkte dieses Hubs

Alle Endpunkte dieses Hubs →