{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agentaos-ai/json-schema/agentaos-ai-subscription-credit-schema.json",
  "title": "SubscriptionCredit",
  "description": "A credit you gave, with both figures it changes. Money is integer minor units.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agentaos-ai-subscriptions-api-openapi.yml#/components/schemas/SubscriptionCredit",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The credit's id at the payment processor. There is no id of ours."
    },
    "amountMinor": {
      "type": "integer",
      "description": "What you gave, positive."
    },
    "currency": {
      "type": "string",
      "description": "The subscription's, lower-case."
    },
    "reason": {
      "type": "string"
    },
    "creditBalanceMinor": {
      "type": "integer",
      "description": "All unspent credit on this customer's account with you."
    },
    "nextInvoiceMinor": {
      "type": "integer",
      "description": "What their next invoice would have taken before this credit."
    },
    "nextInvoiceDueAfterCreditMinor": {
      "type": "integer",
      "description": "What it will take now."
    },
    "nextInvoiceAt": {
      "type": "string",
      "format": "date-time"
    },
    "createdBy": {
      "type": "string",
      "format": "uuid",
      "description": "The person who gave it."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "amountMinor",
    "currency",
    "reason",
    "creditBalanceMinor",
    "nextInvoiceMinor",
    "nextInvoiceDueAfterCreditMinor",
    "nextInvoiceAt",
    "createdBy",
    "createdAt"
  ]
}