<!-- Generated from the reviewed public OpenAPI contract. Do not edit this file. -->

# Billing



**Type:** object

Required means required **within its containing object**, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.


| Field | Type | Presence | Description / constraints |
| --- | --- | --- | --- |
| ` cancel_at_period_end ` | boolean | Optional | — |
| ` current_period_end ` | anyOf: string (date-time); null | Optional | — |
| ` mode ` | ` off `, ` mock `, ` stripe ` | Required | — |
| ` object ` | Exactly ` billing ` | Required | — |
| ` org ` | string | Required | Public org_… reference (not a UUID). pattern: ` ^org_[0-7][0-9A-HJKMNP-TV-Z]{25}$ ` |
| ` plan ` | anyOf: object; null | Optional | — |
| ` recharge ` | anyOf: object; null | Optional | — |
| ` status ` | ` preview `, ` trial_ended `, ` subscription_required `, ` active `, ` suspended `, ` canceled ` | Required | — |
| ` suspension ` | anyOf: object; null | Optional | — |
| ` trial ` | anyOf: object; null | Optional | — |
| ` wallet ` | anyOf: object; null | Optional | — |


**JSON Schema**
```json
{
  "additionalProperties": true,
  "properties": {
    "cancel_at_period_end": {
      "type": "boolean"
    },
    "current_period_end": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "mode": {
      "enum": [
        "off",
        "mock",
        "stripe"
      ],
      "type": "string"
    },
    "object": {
      "const": "billing"
    },
    "org": {
      "description": "Public org_… reference (not a UUID)",
      "pattern": "^org_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
      "type": "string"
    },
    "plan": {
      "anyOf": [
        {
          "additionalProperties": true,
          "properties": {
            "max_lines": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ]
            },
            "monthly_micros": {
              "anyOf": [
                {
                  "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
                  "pattern": "^[0-9]+$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "price_book_version": {
              "type": "string"
            }
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "recharge": {
      "anyOf": [
        {
          "additionalProperties": true,
          "properties": {
            "amount_micros": {
              "anyOf": [
                {
                  "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
                  "pattern": "^[0-9]+$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "pending": {
              "anyOf": [
                {
                  "additionalProperties": true,
                  "properties": {
                    "amount_micros": {
                      "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
                      "pattern": "^[0-9]+$",
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "threshold_micros": {
              "anyOf": [
                {
                  "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
                  "pattern": "^[0-9]+$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "unpaid": {
              "anyOf": [
                {
                  "additionalProperties": true,
                  "properties": {
                    "amount_micros": {
                      "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
                      "pattern": "^[0-9]+$",
                      "type": "string"
                    },
                    "failed_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "subscription",
                        "recharge"
                      ],
                      "type": "string"
                    },
                    "reason": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "enum": [
        "preview",
        "trial_ended",
        "subscription_required",
        "active",
        "suspended",
        "canceled"
      ],
      "type": "string"
    },
    "suspension": {
      "anyOf": [
        {
          "additionalProperties": true,
          "properties": {
            "lines_held_after": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "reason": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "suspended_at": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "trial": {
      "anyOf": [
        {
          "additionalProperties": true,
          "properties": {
            "allowance_micros": {
              "anyOf": [
                {
                  "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
                  "pattern": "^[0-9]+$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "ends_at": {
              "format": "date-time",
              "type": "string"
            },
            "used_micros": {
              "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
              "pattern": "^[0-9]+$",
              "type": "string"
            }
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "wallet": {
      "anyOf": [
        {
          "additionalProperties": true,
          "properties": {
            "available_micros": {
              "description": "Signed integer USD micros as a decimal string",
              "pattern": "^-?[0-9]+$",
              "type": "string"
            },
            "balance_micros": {
              "description": "Signed integer USD micros as a decimal string",
              "pattern": "^-?[0-9]+$",
              "type": "string"
            },
            "reserved_micros": {
              "description": "Integer USD micros as a decimal string; $1 = 1000000 micros",
              "pattern": "^[0-9]+$",
              "type": "string"
            }
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "object",
    "org",
    "mode",
    "status"
  ],
  "type": "object"
}
```
