{
  "openapi": "3.0.0",
  "paths": {
    "/v1/customers": {
      "get": {
        "operationId": "Customer_list",
        "parameters": [
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Customer objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Customer"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List customers",
        "tags": [
          "Customer"
        ]
      },
      "post": {
        "operationId": "Customer_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomerDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Customer object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a customer",
        "tags": [
          "Customer"
        ]
      }
    },
    "/v1/customers/{id}": {
      "get": {
        "operationId": "Customer_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Customer object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a customer",
        "tags": [
          "Customer"
        ]
      },
      "patch": {
        "operationId": "Customer_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCustomerDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Customer object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Update a customer",
        "tags": [
          "Customer"
        ]
      }
    },
    "/v1/customer_portals": {
      "post": {
        "operationId": "CustomerPortal_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomerPortalDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The CustomerPortal object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerPortal"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a customer portal link",
        "tags": [
          "CustomerPortal"
        ]
      },
      "get": {
        "operationId": "CustomerPortal_list",
        "parameters": [
          {
            "name": "customer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of CustomerPortal objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CustomerPortal"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List customer portal links",
        "tags": [
          "CustomerPortal"
        ]
      }
    },
    "/v1/customer_portals/{id}": {
      "get": {
        "operationId": "CustomerPortal_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The CustomerPortal object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerPortal"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a customer portal link",
        "tags": [
          "CustomerPortal"
        ]
      },
      "delete": {
        "operationId": "CustomerPortal_revoke",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The CustomerPortal object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerPortal"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Revoke a customer portal link",
        "tags": [
          "CustomerPortal"
        ]
      }
    },
    "/v1/products": {
      "get": {
        "operationId": "Product_list",
        "parameters": [
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Product objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List products",
        "tags": [
          "Product"
        ]
      },
      "post": {
        "operationId": "Product_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProductDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Product object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a product",
        "tags": [
          "Product"
        ]
      }
    },
    "/v1/products/{id}": {
      "get": {
        "operationId": "Product_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Product object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a product",
        "tags": [
          "Product"
        ]
      },
      "patch": {
        "operationId": "Product_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProductDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Product object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Update a product",
        "tags": [
          "Product"
        ]
      }
    },
    "/v1/prices": {
      "get": {
        "operationId": "Price_list",
        "parameters": [
          {
            "name": "product",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Price objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Price"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List prices",
        "tags": [
          "Price"
        ]
      },
      "post": {
        "operationId": "Price_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePriceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Price object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Price"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a price",
        "tags": [
          "Price"
        ]
      }
    },
    "/v1/prices/{id}": {
      "get": {
        "operationId": "Price_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Price object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Price"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a price",
        "tags": [
          "Price"
        ]
      },
      "patch": {
        "operationId": "Price_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePriceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Price object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Price"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Update a price",
        "tags": [
          "Price"
        ]
      }
    },
    "/v1/invoices": {
      "get": {
        "operationId": "Invoice_list",
        "parameters": [
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Invoice objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Invoice"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List invoices",
        "tags": [
          "Invoice"
        ]
      }
    },
    "/v1/invoices/{id}": {
      "get": {
        "operationId": "Invoice_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Invoice object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve an invoice",
        "tags": [
          "Invoice"
        ]
      }
    },
    "/v1/credit_notes": {
      "get": {
        "operationId": "CreditNote_list",
        "parameters": [
          {
            "name": "invoice",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of CreditNote objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CreditNote"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List credit notes",
        "tags": [
          "CreditNote"
        ]
      }
    },
    "/v1/credit_notes/{id}": {
      "get": {
        "operationId": "CreditNote_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The CreditNote object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNote"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a credit note",
        "tags": [
          "CreditNote"
        ]
      }
    },
    "/v1/payment_methods": {
      "get": {
        "operationId": "PaymentMethod_list",
        "parameters": [
          {
            "name": "customer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of PaymentMethod objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PaymentMethod"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List a customer's saved payment methods",
        "tags": [
          "PaymentMethod"
        ]
      }
    },
    "/v1/payment_methods/{id}": {
      "get": {
        "operationId": "PaymentMethod_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The PaymentMethod object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethod"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a payment method",
        "tags": [
          "PaymentMethod"
        ]
      },
      "delete": {
        "operationId": "PaymentMethod_detach",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The PaymentMethod object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethod"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Detach a payment method",
        "tags": [
          "PaymentMethod"
        ]
      }
    },
    "/v1/payment_methods/{id}/set_default": {
      "post": {
        "operationId": "PaymentMethod_setDefault",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The PaymentMethod object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethod"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Set a customer's default payment method",
        "tags": [
          "PaymentMethod"
        ]
      }
    },
    "/v1/payments": {
      "post": {
        "operationId": "Payment_create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Unique key identifying this request, so a retry replays the original response instead of repeating the work. Required when `payment_method` is set: an off-session charge that is retried without one would charge the card twice.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePaymentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Payment object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "`payment_error`: the card issuer declined the off-session charge. `error.code` names the reason (`insufficient_funds`, `expired_card`, `incorrect_cvc`, `processing_error`, or the generic `card_declined`). Only possible when `payment_method` is set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a payment",
        "tags": [
          "Payment"
        ]
      },
      "get": {
        "operationId": "Payment_list",
        "parameters": [
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expand",
            "required": false,
            "in": "query",
            "description": "Relations to include on each payment, as `expand[]=line_items`. `line_items` is omitted from the response otherwise. A bare `expand=line_items` is accepted too.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "line_items"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Payment objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Payment"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List payments",
        "tags": [
          "Payment"
        ]
      }
    },
    "/v1/payments/{id}": {
      "get": {
        "operationId": "Payment_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Payment object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a payment",
        "tags": [
          "Payment"
        ]
      }
    },
    "/v1/payment_sessions": {
      "post": {
        "operationId": "PaymentSession_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePaymentSessionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The PaymentSession object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSession"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a payment session",
        "tags": [
          "PaymentSession"
        ]
      }
    },
    "/v1/payment_sessions/{id}": {
      "get": {
        "operationId": "PaymentSession_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The PaymentSession object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSession"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a payment session",
        "tags": [
          "PaymentSession"
        ]
      }
    },
    "/v1/refunds": {
      "post": {
        "operationId": "Refund_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefundDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Refund object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Refund"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a refund",
        "tags": [
          "Refund"
        ]
      },
      "get": {
        "operationId": "Refund_list",
        "parameters": [
          {
            "name": "payment",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Refund objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Refund"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List refunds",
        "tags": [
          "Refund"
        ]
      }
    },
    "/v1/refunds/{id}": {
      "get": {
        "operationId": "Refund_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Refund object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Refund"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a refund",
        "tags": [
          "Refund"
        ]
      }
    },
    "/v1/meters": {
      "post": {
        "operationId": "Meter_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMeterDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Meter object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Meter"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a meter",
        "tags": [
          "Meter"
        ]
      },
      "get": {
        "operationId": "Meter_list",
        "parameters": [
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "archived",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Meter objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Meter"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List meters",
        "tags": [
          "Meter"
        ]
      }
    },
    "/v1/meters/{id}": {
      "get": {
        "operationId": "Meter_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Meter object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Meter"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a meter",
        "tags": [
          "Meter"
        ]
      },
      "delete": {
        "operationId": "Meter_archive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Meter object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Meter"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Archive a meter",
        "tags": [
          "Meter"
        ]
      }
    },
    "/v1/events": {
      "post": {
        "operationId": "UsageEvent_ingestOne",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IngestEventDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The UsageEventResult object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageEventResult"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Ingest a usage event",
        "tags": [
          "UsageEvent"
        ]
      },
      "get": {
        "operationId": "UsageEvent_list",
        "parameters": [
          {
            "name": "customer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "event_name",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of UsageEvent objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/UsageEvent"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List usage events",
        "tags": [
          "UsageEvent"
        ]
      }
    },
    "/v1/events/batch": {
      "post": {
        "operationId": "UsageEvent_ingestBatch",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IngestEventBatchDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The UsageEventResult object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageEventResult"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Ingest a batch of usage events",
        "tags": [
          "UsageEvent"
        ]
      }
    },
    "/v1/meters/{id}/quantities": {
      "get": {
        "operationId": "MeterQuantities_quantities",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period_start",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period_end",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The MeterQuantity object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeterQuantity"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Aggregate a customer's usage on a meter over a period",
        "tags": [
          "MeterQuantities"
        ]
      }
    },
    "/v1/customer-meters/{customerId}/{meterId}": {
      "get": {
        "operationId": "CustomerMeter_retrieve",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "meterId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The CustomerMeterBalance object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerMeterBalance"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a customer's live meter balance",
        "tags": [
          "CustomerMeter"
        ]
      }
    },
    "/v1/customer-state/{customerId}": {
      "get": {
        "operationId": "CustomerState_retrieve",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The CustomerState object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a customer's billing state",
        "tags": [
          "CustomerState"
        ]
      }
    },
    "/v1/subscriptions": {
      "post": {
        "operationId": "Subscription_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSubscriptionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Subscription object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create a subscription",
        "tags": [
          "Subscription"
        ]
      },
      "get": {
        "operationId": "Subscription_list",
        "parameters": [
          {
            "name": "customer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Subscription objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Subscription"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List subscriptions",
        "tags": [
          "Subscription"
        ]
      }
    },
    "/v1/subscriptions/{id}": {
      "get": {
        "operationId": "Subscription_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Subscription object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a subscription",
        "tags": [
          "Subscription"
        ]
      },
      "post": {
        "operationId": "Subscription_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSubscriptionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Subscription object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Update a subscription",
        "tags": [
          "Subscription"
        ]
      }
    },
    "/v1/subscriptions/{id}/cancel": {
      "post": {
        "operationId": "Subscription_cancel",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelSubscriptionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Subscription object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Cancel a subscription",
        "tags": [
          "Subscription"
        ]
      }
    },
    "/v1/subscriptions/{id}/uncancel": {
      "post": {
        "operationId": "Subscription_uncancel",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The Subscription object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Reverse a scheduled cancellation",
        "tags": [
          "Subscription"
        ]
      }
    },
    "/v1/subscriptions/{id}/pause": {
      "post": {
        "operationId": "Subscription_pause",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The Subscription object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Pause a subscription",
        "tags": [
          "Subscription"
        ]
      }
    },
    "/v1/subscriptions/{id}/resume": {
      "post": {
        "operationId": "Subscription_resume",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The Subscription object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Resume a paused subscription",
        "tags": [
          "Subscription"
        ]
      }
    },
    "/v1/subscription_items": {
      "post": {
        "operationId": "SubscriptionItem_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSubscriptionItemDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The SubscriptionItem object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionItem"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Add an item to a subscription",
        "tags": [
          "SubscriptionItem"
        ]
      }
    },
    "/v1/subscription_items/{id}": {
      "get": {
        "operationId": "SubscriptionItem_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The SubscriptionItem object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionItem"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve a subscription item",
        "tags": [
          "SubscriptionItem"
        ]
      },
      "post": {
        "operationId": "SubscriptionItem_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSubscriptionItemDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The SubscriptionItem object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionItem"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Update a subscription item",
        "tags": [
          "SubscriptionItem"
        ]
      },
      "delete": {
        "operationId": "SubscriptionItem_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "proration_behavior",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Deleted object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Remove an item from a subscription",
        "tags": [
          "SubscriptionItem"
        ]
      }
    },
    "/v1/invoice_items": {
      "post": {
        "operationId": "InvoiceItem_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvoiceItemDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The InvoiceItem object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceItem"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_error`: the `Idempotency-Key` is still in flight or was reused with a different body. See https://docs.borga.is/api/idempotency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Create an invoice item",
        "tags": [
          "InvoiceItem"
        ]
      },
      "get": {
        "operationId": "InvoiceItem_list",
        "parameters": [
          {
            "name": "customer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscription",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pending",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "starting_after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of InvoiceItem objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InvoiceItem"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists. Fetch it with `starting_after` set to the last id. Absent on endpoints that do not paginate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "List invoice items",
        "tags": [
          "InvoiceItem"
        ]
      }
    },
    "/v1/invoice_items/{id}": {
      "get": {
        "operationId": "InvoiceItem_retrieve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The InvoiceItem object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceItem"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request_error`: the body or query failed validation, or refers to an object that does not exist or is in the wrong state. `error.param` names the field when there is one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`authentication_error`: the API key is missing, malformed or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`permission_error`: the key may not do this, for example a publishable key on a secret-only route or a live key before live mode is enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`invalid_request_error` with code `resource_not_found`: no object with this id in this merchant and mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limit_error`: too many requests. Wait `Retry-After` seconds and retry with the same `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "`api_error`: something failed on Borga's side or at a provider. Safe to retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Any other error. `error.code` says which; see https://docs.borga.is/errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Retrieve an invoice item",
        "tags": [
          "InvoiceItem"
        ]
      }
    }
  },
  "info": {
    "title": "Borga API",
    "description": "Borga is a payments platform for Iceland. The public API is REST over HTTPS, uses JSON, and is authenticated with API keys (`Bearer sk_live_…` or `sk_test_…`). Publishable keys (`pk_…`) are used from the browser for embedded checkout flows.",
    "version": "v1",
    "contact": {
      "name": "Borga",
      "url": "https://docs.borga.is",
      "email": "a@borga.is"
    },
    "termsOfService": "https://borga.is/skilmalar"
  },
  "tags": [],
  "servers": [
    {
      "url": "https://api.borga.is",
      "description": "Production"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "scheme": "bearer",
        "bearerFormat": "API key",
        "type": "http",
        "description": "Use a secret API key for server-side calls (`sk_live_…` or `sk_test_…`) or a publishable key (`pk_…`) for browser-side calls to the embedded checkout endpoints."
      },
      "IdempotencyKey": {
        "type": "apiKey",
        "in": "header",
        "name": "Idempotency-Key"
      }
    },
    "schemas": {
      "CreateCustomerDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Required; stored as given (not lowercased). Used for receipts and\nportal links.",
            "format": "email"
          },
          "name": {
            "type": "string",
            "description": "Display name shown in the dashboard and on invoices."
          },
          "phone": {
            "type": "string",
            "description": "Free-form phone number; not validated."
          },
          "kennitala": {
            "type": "string",
            "description": "Icelandic national id (person or company). Needed for bank-invoice\ncollection, where the claim is addressed to it. Not checksum-validated\nhere."
          },
          "external_id": {
            "type": "string",
            "description": "The merchant's own id for this customer. Usage events can reference it\nas `external_customer_id` instead of the `cus_…` id."
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the customer."
          },
          "vat_number": {
            "type": "string",
            "description": "VAT registration number, printed on the provider's invoice."
          },
          "billing_address_line1": {
            "type": "string",
            "description": "Street address, first line."
          },
          "billing_address_line2": {
            "type": "string",
            "description": "Street address, second line."
          },
          "billing_city": {
            "type": "string",
            "description": "City or town."
          },
          "billing_postal_code": {
            "type": "string",
            "description": "Postal code as a string (Icelandic codes have leading digits that matter)."
          },
          "billing_country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 (e.g. \"IS\", \"DK\"). Uppercased on write.",
            "minLength": 2,
            "maxLength": 2
          }
        },
        "required": [
          "email"
        ]
      },
      "UpdateCustomerDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "New email; must still be a valid address.",
            "format": "email"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "phone": {
            "type": "string",
            "description": "Free-form phone number."
          },
          "kennitala": {
            "type": "string",
            "description": "Icelandic national id; see `CreateCustomerDto.kennitala`."
          },
          "external_id": {
            "type": "string",
            "description": "The merchant's own id. An empty string clears it (public API only)."
          },
          "metadata": {
            "type": "object",
            "description": "Replaces the whole metadata map, not a merge."
          },
          "vat_number": {
            "type": "string",
            "description": "VAT registration number, printed on the provider's invoice."
          },
          "billing_address_line1": {
            "type": "string",
            "description": "Street address, first line."
          },
          "billing_address_line2": {
            "type": "string",
            "description": "Street address, second line."
          },
          "billing_city": {
            "type": "string",
            "description": "City or town."
          },
          "billing_postal_code": {
            "type": "string",
            "description": "Postal code as a string (Icelandic codes have leading digits that matter)."
          },
          "billing_country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 (e.g. \"IS\", \"DK\"). Uppercased on write.",
            "minLength": 2,
            "maxLength": 2
          }
        }
      },
      "CreateCustomerPortalDto": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "string",
            "description": "The `cus_…` id the portal shows invoices for."
          },
          "expires_in": {
            "type": "number",
            "description": "Seconds from now until the portal URL expires. Default 3600, max 86400.",
            "minimum": 60,
            "maximum": 86400
          },
          "reusable": {
            "type": "boolean",
            "description": "Default true. When false, portal is consumed on first access."
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the portal."
          }
        },
        "required": [
          "customer"
        ]
      },
      "CreateProductDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Shown to the customer on invoice lines for this product's prices."
          },
          "description": {
            "type": "string",
            "description": "Optional longer description; not shown on invoices."
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the product."
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateProductDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "New display name; existing invoice lines keep the old one."
          },
          "description": {
            "type": "string",
            "description": "Optional longer description."
          },
          "active": {
            "type": "boolean",
            "description": "`false` archives the product; its prices keep billing."
          },
          "metadata": {
            "type": "object",
            "description": "Replaces the whole metadata map, not a merge."
          }
        }
      },
      "RecurringDto": {
        "type": "object",
        "properties": {
          "interval": {
            "type": "string",
            "description": "Billing cadence unit. Combined with `interval_count`.",
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ]
          },
          "interval_count": {
            "type": "number",
            "description": "Number of `interval`s per period (`month` + 3 is quarterly). Defaults to 1.",
            "minimum": 1
          },
          "usage_type": {
            "type": "string",
            "description": "`licensed` (default) bills `quantity × unit_amount` per period;\n`metered` bills the meter's aggregated quantity through `tiers` and\nrequires `meter` on the price.",
            "enum": [
              "licensed",
              "metered"
            ]
          },
          "aggregate_usage": {
            "type": "string",
            "description": "Accepted for Stripe compatibility and stored in the `recurring` JSON,\nbut not read by the billing engine: aggregation is defined on the\nMeter, not the price.",
            "enum": [
              "sum",
              "max",
              "last_during_period"
            ]
          }
        },
        "required": [
          "interval"
        ]
      },
      "CreatePriceDto": {
        "type": "object",
        "properties": {
          "product": {
            "type": "string",
            "description": "The `prod_…` id this price belongs to. Must be the merchant's."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code, uppercased on input; defaults to `ISK`. Validated and\nnormalized because billing derives the invoice currency from the price\nand claims ledger rows by exact string match: an unnormalized value\nwould strand them as pending forever.",
            "enum": [
              "ISK",
              "EUR",
              "USD",
              "GBP",
              "DKK",
              "NOK",
              "SEK"
            ]
          },
          "type": {
            "type": "string",
            "description": "`recurring` prices can be subscribed to; `one_time` cannot.",
            "enum": [
              "one_time",
              "recurring"
            ]
          },
          "unit_amount": {
            "type": "number",
            "description": "Per-unit amount in the currency's minor unit (whole krónur for ISK),\nexcluding tax. Omit for tiered/metered prices, where `tiers` price the\nquantity instead.",
            "minimum": 0
          },
          "recurring": {
            "description": "Required in practice for `type: \"recurring\"`; ignored for `one_time`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/RecurringDto"
              }
            ]
          },
          "tiers_mode": {
            "type": "string",
            "description": "How `tiers` apply: `graduated` prices each band separately, `volume`\nprices every unit at the band the total lands in. Used together with\n`meter` for usage-based pricing.",
            "enum": [
              "graduated",
              "volume"
            ]
          },
          "tiers": {
            "description": "Bands sorted by `up_to`; the last band uses `up_to: null` for\n\"unbounded\". `unit_amount` is per unit in the band and `flat_amount` is\nadded once when any units fall in it, both in minor units. Stored as\ngiven; not validated beyond being present.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "meter": {
            "type": "string",
            "description": "The `mtr_…` id whose aggregated quantity this price bills. Required when\n`recurring.usage_type` is `metered` (`missing_meter` otherwise)."
          },
          "included_units": {
            "type": "number",
            "description": "Free metered units per period before `tiers` apply. A subscription\nitem's own `included_units` overrides this.",
            "minimum": 0
          },
          "accounting_code": {
            "type": "string",
            "description": "GL account code in the merchant's accounting system. Copied onto each\ninvoice line item created from this price."
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the price."
          }
        },
        "required": [
          "product",
          "type"
        ]
      },
      "UpdatePriceDto": {
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean",
            "description": "`false` archives the price: it stays on existing subscriptions but is\nhidden from pickers."
          },
          "accounting_code": {
            "type": "string",
            "description": "GL account code; an empty string clears it."
          },
          "metadata": {
            "type": "object",
            "description": "Replaces the whole metadata map, not a merge."
          }
        }
      },
      "LineItemDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "description": "Units of this line, 1 to 1,000,000.",
            "minimum": 1,
            "maximum": 1000000
          },
          "unit_amount": {
            "type": "integer",
            "description": "Price per unit in minor units of the payment's currency, EXCLUDING tax.\nNegative on a discount line.",
            "minimum": -2000000000,
            "maximum": 2000000000
          },
          "tax_rate": {
            "type": "integer",
            "description": "Tax rate in basis points, 0 to 10000 (2400 = 24%). Required, not\ndefaulted: a silently defaulted rate books a whole invoice wrong without\nanyone noticing.",
            "minimum": 0,
            "maximum": 10000
          },
          "description": {
            "type": "string",
            "description": "Shown on the checkout page and the provider invoice. 1 to 500 chars.",
            "minLength": 1,
            "maxLength": 500
          },
          "accounting_code": {
            "type": "string",
            "description": "Ledger account for this line in the accounting provider. Falls back to\nthe merchant's default accounting code, resolved and frozen at create.",
            "minLength": 1,
            "maxLength": 50
          },
          "metadata": {
            "type": "object",
            "description": "Any JSON object, stored on the line."
          }
        },
        "required": [
          "quantity",
          "unit_amount",
          "tax_rate",
          "description"
        ]
      },
      "CreatePaymentDto": {
        "type": "object",
        "properties": {
          "line_items": {
            "description": "What the payment is for, line by line. Supplies `amount` when omitted.",
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItemDto"
            }
          },
          "amount": {
            "type": "number",
            "description": "Amount in minor units of `currency`, 1 to 2,000,000,000. Optional with\n`line_items`: derived from the lines, and checked against them in the\ncontroller when both are sent.",
            "minimum": 1,
            "maximum": 2000000000
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code, uppercased on input. Defaults to `ISK`.",
            "enum": [
              "ISK",
              "EUR",
              "USD",
              "GBP",
              "DKK",
              "NOK",
              "SEK"
            ]
          },
          "customer": {
            "type": "string",
            "description": "Attach the Payment to an existing Customer (`cus_…`). With\n`payment_method` it must be that card's customer, or be omitted."
          },
          "payment_method": {
            "type": "string",
            "description": "Charge a saved card (`pm_…`) immediately, with the payer not present:\nan off-session, merchant-initiated charge. The payment method must be\nactive and carry a processor token, and the Payment is created against\nits customer, so `customer` may be omitted (or must match). Requires an\n`Idempotency-Key` header.\n\nWithout this field the endpoint keeps its original behaviour: it only\nrecords a Payment in status `created`, to be collected by a session."
          },
          "description": {
            "type": "string",
            "description": "Free text shown on the checkout page and the provider invoice."
          },
          "external_reference": {
            "type": "string",
            "description": "Your order or invoice reference. Copied to webhook payloads."
          },
          "metadata": {
            "type": "object",
            "description": "Any JSON object."
          }
        }
      },
      "SubscriptionIntentItemDto": {
        "type": "object",
        "properties": {
          "price": {
            "type": "string",
            "description": "A recurring Price id (`price_…`) owned by this merchant."
          },
          "quantity": {
            "type": "number",
            "description": "Defaults to 1.",
            "minimum": 1
          }
        },
        "required": [
          "price"
        ]
      },
      "SubscriptionIntentDto": {
        "type": "object",
        "properties": {
          "items": {
            "description": "At least one recurring price.",
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionIntentItemDto"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "CreatePaymentSessionDto": {
        "type": "object",
        "properties": {
          "line_items": {
            "description": "What the payment is for, line by line. Mutually exclusive with `payment`,\nwhich inherits its payment's lines.",
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItemDto"
            }
          },
          "payment": {
            "type": "string",
            "description": "Attach the session to an existing Payment in status `created` instead of\ncreating one. Either `payment` or `amount` is required."
          },
          "amount": {
            "type": "number",
            "description": "Amount in the currency's smallest unit (whole krónur for ISK), 1 to\n2,000,000,000. Creates a new Payment. Required unless `payment` or\n`line_items` is set; with `line_items` it is derived from the lines.",
            "minimum": 1,
            "maximum": 2000000000
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code. Defaults to `ISK`.",
            "enum": [
              "ISK",
              "EUR",
              "USD",
              "GBP",
              "DKK",
              "NOK",
              "SEK"
            ]
          },
          "customer_email": {
            "type": "string",
            "description": "Pre-fills and locks the payer's email on the checkout page.",
            "format": "email"
          },
          "customer_kennitala": {
            "type": "string",
            "description": "Pre-fills and locks the payer's kennitala for bank-invoice collection.\nChecksum-validated (mod-11); see `isValidKennitala` in `@borga/shared`."
          },
          "external_reference": {
            "type": "string",
            "description": "Your order or invoice reference. Copied to the Payment and to webhook payloads."
          },
          "metadata": {
            "type": "object",
            "description": "Any JSON object. Copied to the Payment."
          },
          "return_url": {
            "type": "string",
            "description": "Hosted sessions: where the payer is sent after checkout, with\n`?session=ps_…` appended. HTTPS on an allowed redirect domain;\n`http://localhost` is accepted in test mode. Give it with `cancel_url`\nor leave both out, and the payer stays on Borga's confirmation page.\nAccepted but unused for embedded sessions."
          },
          "cancel_url": {
            "type": "string",
            "description": "Hosted sessions: where the payer is sent if they go back. Same rules as `return_url`; without it no way back is offered."
          },
          "enabled_methods": {
            "description": "Payment methods to offer. Defaults to `[\"card\", \"apple_pay\", \"google_pay\"]`;\nadd `\"bank_invoice\"` to offer krafa (hosted only, PayDay required).",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "locale": {
            "type": "string",
            "description": "Checkout language tag such as `is` (default) or `en`. Other tags fall back to English.",
            "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$"
          },
          "mode": {
            "type": "string",
            "description": "`hosted` (default) redirects the payer to checkout.borga.is; `embedded` returns a `client_secret` for borga.js.",
            "enum": [
              "hosted",
              "embedded"
            ]
          },
          "origin": {
            "type": "string",
            "description": "Required for embedded sessions created with a secret key: the origin\n(scheme and host, no path) of the page that opens Borga checkout. Pinned\non the session and used to gate `frame-ancestors`. Ignored for\npublishable keys, which use the request's browser `Origin` header and\nvalidate it against the key's `allowed_origins`."
          },
          "save_payment_method": {
            "type": "boolean",
            "description": "Tokenise the card after payment and attach it to `customer` as a\nPaymentMethod for later charges. Requires `customer`."
          },
          "customer": {
            "type": "string",
            "description": "Attach the Payment to an existing Customer. Required when `save_payment_method` is true."
          },
          "subscription": {
            "description": "Start a subscription with these recurring prices when the payment\nsucceeds. `amount` is charged as the first period upfront and should\nequal one period of the licensed items; the card is tokenised\n(`save_payment_method` is forced true) and a Customer is created from the\npayer's email when `customer` is not supplied.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionIntentDto"
              }
            ]
          }
        }
      },
      "CreateRefundDto": {
        "type": "object",
        "properties": {
          "payment": {
            "type": "string",
            "description": "The Payment to refund (`pay_…`); must be `succeeded` or `processing`."
          },
          "amount": {
            "type": "number",
            "description": "Amount in minor units of the payment's currency. Defaults to the whole\nrefundable balance: the amount less succeeded and still-pending refunds.",
            "minimum": 1,
            "maximum": 2000000000
          },
          "reason": {
            "type": "string",
            "description": "Free text, stored on the refund and returned on it."
          },
          "metadata": {
            "type": "object",
            "description": "Any JSON object."
          }
        },
        "required": [
          "payment"
        ]
      },
      "CreateMeterDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name, e.g. \"API Requests\". Not used for matching.",
            "maxLength": 200
          },
          "event_name": {
            "type": "string",
            "description": "Matches `event_name` on ingested usage events. Several meters may share\nan event name and differ by `filter`.",
            "maxLength": 200
          },
          "aggregate_type": {
            "type": "string",
            "description": "How matching events collapse into a quantity. `count` and `sum` are\nmaintained incrementally on ingest; `max`, `min`, `avg` and `unique`\nare recomputed from the event store.",
            "enum": [
              "count",
              "sum",
              "max",
              "min",
              "avg",
              "unique"
            ]
          },
          "aggregate_property": {
            "type": "string",
            "description": "Dotted path into the event metadata to aggregate, e.g.\n`metadata.total_tokens` (the `metadata.` prefix is optional). Required\nfor every type except `count` (`missing_aggregate_property`)."
          },
          "filter": {
            "type": "object",
            "description": "Flat map of metadata paths to expected values; an event counts only\nwhen every entry matches (loose string equality). Omit to match all\nevents with `event_name`."
          },
          "unit_label": {
            "type": "string",
            "description": "Unit shown in the dashboard and `quantities` responses, e.g. \"tokens\".",
            "maxLength": 100
          },
          "unit_multiplier": {
            "type": "number",
            "description": "Divide the raw aggregate by this before pricing (1,000,000 to price\n\"per 1M tokens\" while storing raw counts). Partial units round down.",
            "minimum": 1
          }
        },
        "required": [
          "name",
          "event_name",
          "aggregate_type"
        ]
      },
      "IngestEventDto": {
        "type": "object",
        "properties": {
          "idempotency_key": {
            "type": "string",
            "description": "Caller-chosen dedup key, unique per merchant and mode. A repeat is\nskipped silently and counted in `duplicates`. Strongly recommended for\nat-least-once producers.",
            "maxLength": 200
          },
          "event_name": {
            "type": "string",
            "description": "Routes the event to every unarchived meter with this `event_name`.",
            "maxLength": 200
          },
          "customer": {
            "type": "string",
            "description": "A `cus_…` id. Must exist for the merchant (`resource_not_found`)."
          },
          "external_customer_id": {
            "type": "string",
            "description": "The merchant's own id for the customer, matched against\n`Customer.external_id`. Ignored when `customer` is given."
          },
          "timestamp": {
            "type": "string",
            "description": "ISO 8601 time the usage happened; defaults to now. Decides which\nbilling period the event falls in. Rejected if more than 60 s in the\nfuture (`future_timestamp`)."
          },
          "metadata": {
            "type": "object",
            "description": "Arbitrary JSON. Meter filters and `aggregate_property` read from here."
          }
        },
        "required": [
          "event_name"
        ]
      },
      "IngestEventBatchDto": {
        "type": "object",
        "properties": {
          "events": {
            "description": "1 to 1000 events, processed in order.",
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IngestEventDto"
            }
          }
        },
        "required": [
          "events"
        ]
      },
      "SubscriptionItemInput": {
        "type": "object",
        "properties": {
          "price": {
            "type": "string",
            "description": "A `price_…` id of type `recurring` owned by the calling merchant."
          },
          "quantity": {
            "type": "number",
            "description": "Seats or units of the price. Defaults to 1.",
            "minimum": 1
          },
          "credit_rollover": {
            "type": "boolean",
            "description": "Carry unused included units into the next period instead of resetting\nthem at the period boundary. Defaults to `false`."
          },
          "included_units": {
            "type": "number",
            "description": "Free metered units per period for this item. Overrides the price's own\n`included_units` when set; `null`/absent falls back to the price.",
            "minimum": 0
          },
          "trial_included_units": {
            "type": "number",
            "description": "Free metered units during the trial instead of `included_units`. Unset\nmeans the trial has the same allowance as a paid period. One item per\nmeter, so this is the meter's trial allowance.",
            "minimum": 0
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the subscription item."
          }
        },
        "required": [
          "price"
        ]
      },
      "DiscountInput": {
        "type": "object",
        "properties": {
          "amount_off": {
            "type": "number",
            "description": "Fixed discount in the subscription's currency, in minor units.",
            "minimum": 0
          },
          "percent_off": {
            "type": "number",
            "description": "Percentage discount, 0 to 100. Ignored when `amount_off` is set.",
            "minimum": 0
          },
          "duration": {
            "type": "string",
            "description": "How long the discount lasts. Only `\"once\"` (next invoice) exists.",
            "enum": [
              "once"
            ]
          }
        }
      },
      "CreateSubscriptionDto": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "string",
            "description": "The `cus_…` id to subscribe. Must belong to the calling merchant."
          },
          "items": {
            "description": "At least one recurring price. All must share interval and currency.",
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionItemInput"
            }
          },
          "collection_method": {
            "type": "string",
            "description": "`charge_automatically` (default) charges the customer's default card\neach cycle; `send_invoice` issues a bank claim through the accounting\nprovider and waits `days_until_due` for payment.",
            "enum": [
              "charge_automatically",
              "send_invoice"
            ]
          },
          "trial_period_days": {
            "type": "number",
            "description": "Length of a free trial. The trial is the first period: nothing licensed\nis charged for it, and the trial-end cycle starts the first paid period.",
            "minimum": 1
          },
          "days_until_due": {
            "type": "number",
            "description": "Days the customer has to pay each invoice. Only meaningful with\n`send_invoice`; defaults to 14 there and is stored as `null` otherwise.",
            "minimum": 0
          },
          "discount": {
            "description": "Discount for the next invoice. Stored as given on the subscription.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DiscountInput"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the subscription."
          }
        },
        "required": [
          "customer",
          "items"
        ]
      },
      "UpdateSubscriptionDto": {
        "type": "object",
        "properties": {
          "cancel_at_period_end": {
            "type": "boolean",
            "description": "`true` schedules the cancellation for `current_period_end` (the final\nperiod is still billed); `false` clears a pending cancellation."
          },
          "discount": {
            "nullable": true,
            "description": "Replace the discount. Explicit `null` removes it.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/DiscountInput"
              }
            ]
          },
          "collection_method": {
            "type": "string",
            "description": "Switch collection method. Switching to `send_invoice` on a subscription\nthat never had a deadline sets `days_until_due` to 14 unless given.",
            "enum": [
              "charge_automatically",
              "send_invoice"
            ]
          },
          "days_until_due": {
            "type": "number",
            "description": "Payment deadline in days for `send_invoice` invoices.",
            "minimum": 0
          },
          "metadata": {
            "type": "object",
            "description": "Replaces the whole metadata map, not a merge."
          }
        }
      },
      "CancelSubscriptionDto": {
        "type": "object",
        "properties": {
          "at_period_end": {
            "type": "boolean",
            "description": "`true` keeps the subscription active until `current_period_end`, bills\nthe final period, then cancels. `false` (default) ends it now with a\nfinal invoice for the usage so far and the elapsed share of the\nlicensed items; nothing is refunded."
          }
        }
      },
      "CreateSubscriptionItemDto": {
        "type": "object",
        "properties": {
          "subscription": {
            "type": "string",
            "description": "The `sub_…` id to add the item to. Canceled subscriptions are rejected."
          },
          "price": {
            "type": "string",
            "description": "A recurring `price_…` id. Must match the subscription's existing billing\ninterval and currency (`invalid_subscription` otherwise)."
          },
          "quantity": {
            "type": "number",
            "description": "Seats or units of the price. Defaults to 1.",
            "minimum": 1
          },
          "proration_behavior": {
            "type": "string",
            "description": "What to do with the mid-period adjustment, if any: `create_prorations`\n(default) puts it on the next cycle invoice, `always_invoice` bills it\nnow on an out-of-cycle invoice, `none` records nothing.",
            "enum": [
              "create_prorations",
              "always_invoice",
              "none"
            ]
          },
          "credit_rollover": {
            "type": "boolean",
            "description": "Carry unused included units into the next period. Defaults to `false`."
          },
          "included_units": {
            "type": "number",
            "description": "Free metered units per period; overrides the price's `included_units`.",
            "minimum": 0
          },
          "trial_included_units": {
            "type": "number",
            "description": "Free metered units during the trial instead of `included_units`. Unset\nmeans the trial has the same allowance as a paid period. One item per\nmeter, so this is the meter's trial allowance.",
            "minimum": 0
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the subscription item."
          }
        },
        "required": [
          "subscription",
          "price"
        ]
      },
      "UpdateSubscriptionItemDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "number",
            "description": "New quantity. `0` is accepted and bills nothing at period end; remove\nthe item instead to drop the line entirely.",
            "minimum": 0
          },
          "proration_behavior": {
            "type": "string",
            "description": "Where the adjustment for a quantity change lands; see\n`CreateSubscriptionItemDto`.",
            "enum": [
              "create_prorations",
              "always_invoice",
              "none"
            ]
          },
          "credit_rollover": {
            "type": "boolean",
            "description": "Carry unused included units into the next period."
          },
          "included_units": {
            "type": "number",
            "description": "Free metered units per period; overrides the price's `included_units`.",
            "minimum": 0
          },
          "trial_included_units": {
            "type": "number",
            "description": "Free metered units during the trial instead of `included_units`. Unset\nmeans the trial has the same allowance as a paid period. One item per\nmeter, so this is the meter's trial allowance.",
            "minimum": 0
          },
          "metadata": {
            "type": "object",
            "description": "Replaces the whole metadata map, not a merge."
          }
        }
      },
      "CreateInvoiceItemDto": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "string",
            "description": "The `cus_…` id the charge belongs to."
          },
          "subscription": {
            "type": "string",
            "description": "Optional `sub_…` id. Must belong to `customer` (`mismatch` otherwise)\nand, when `currency` is given, bill in the same currency."
          },
          "amount": {
            "type": "number",
            "description": "Per-unit amount in the currency's minor unit (whole krónur for ISK).\nNegative amounts are credits."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code, uppercased on input. Defaults to the subscription's\nbilling currency when `subscription` is set, otherwise `ISK`.",
            "enum": [
              "ISK",
              "EUR",
              "USD",
              "GBP",
              "DKK",
              "NOK",
              "SEK"
            ]
          },
          "description": {
            "type": "string",
            "description": "Becomes the invoice line text the customer sees."
          },
          "quantity": {
            "type": "number",
            "description": "Units of `amount`. Defaults to 1.",
            "minimum": 1
          },
          "metadata": {
            "type": "object",
            "description": "Free-form key/value map stored on the invoice item."
          }
        },
        "required": [
          "customer",
          "amount",
          "description"
        ]
      },
      "Error": {
        "type": "object",
        "description": "The error envelope returned with every non-2xx status. See https://docs.borga.is/errors.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "code",
              "message"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "payment_error",
                  "idempotency_error",
                  "rate_limit_error",
                  "api_error"
                ],
                "description": "The class of problem; maps to the HTTP status."
              },
              "code": {
                "type": "string",
                "description": "Stable machine-readable code. Branch on this, never on `message`."
              },
              "message": {
                "type": "string",
                "description": "Human-readable explanation. May change."
              },
              "param": {
                "type": "string",
                "description": "The request field that caused the error, when there is one."
              },
              "doc_url": {
                "type": "string",
                "format": "uri",
                "description": "Documentation page for this code."
              },
              "request_id": {
                "type": "string",
                "description": "Quote this when contacting support."
              }
            }
          }
        }
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`cus_…`"
          },
          "email": {
            "type": "string",
            "description": "Used for receipts and portal links. `list({ email })` matches it case-insensitively."
          },
          "name": {
            "type": "string",
            "description": "Person or company name printed on invoices.",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "kennitala": {
            "type": "string",
            "description": "Icelandic national id (10 digits). Required for bank-invoice (krafa) collection, since the claim is addressed to it.",
            "nullable": true
          },
          "external_id": {
            "type": "string",
            "description": "Your own id for this customer, usable in usage events.",
            "nullable": true
          },
          "vat_number": {
            "type": "string",
            "description": "VAT registration number printed on invoices.",
            "nullable": true
          },
          "billing_address": {
            "description": "`null` until any `billing_*` field has been set.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BillingAddress"
              }
            ],
            "type": "object",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the customer. Empty object when none."
          },
          "default_payment_method": {
            "type": "string",
            "description": "`pm_…` charged for `charge_automatically` subscriptions, or `null`. Set automatically by the first saved card and `paymentMethods.setDefault()`.",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "phone",
          "kennitala",
          "external_id",
          "vat_number",
          "billing_address",
          "metadata",
          "default_payment_method",
          "created_at",
          "updated_at"
        ],
        "description": "A payer you bill: the owner of saved cards, subscriptions, invoices and usage. Identified to you by `email`, and optionally by your own `external_id`."
      },
      "BillingAddress": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "description": "Street address, first line.",
            "nullable": true
          },
          "line2": {
            "type": "string",
            "description": "Street address, second line.",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "postal_code": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2.",
            "nullable": true
          }
        },
        "required": [
          "line1",
          "line2",
          "city",
          "postal_code",
          "country"
        ],
        "description": "Postal address printed on the customer's invoices."
      },
      "Metadata": {
        "type": "object",
        "additionalProperties": {},
        "description": "Free-form key/value map stored on most resources. Borga never interprets it."
      },
      "CustomerPortal": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`cprt_…`"
          },
          "customer": {
            "type": "string",
            "description": "`cus_…` the portal shows."
          },
          "url": {
            "type": "string",
            "description": "Share this URL with the payer. Hosted on checkout.borga.is."
          },
          "reusable": {
            "type": "boolean",
            "description": "`false` means the link stops working after its first visit."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired",
              "revoked",
              "consumed"
            ],
            "description": "Derived on read: `revoked` after `revoke()`, `expired` once `expires_at` has passed, `consumed` when a single-use link has been visited, otherwise `active`."
          },
          "expires_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "revoked_at": {
            "type": "string",
            "description": "ISO 8601 time of `revoke()`, or `null`.",
            "nullable": true
          },
          "last_accessed_at": {
            "type": "string",
            "description": "ISO 8601 time of the first visit, or `null` if never opened.",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the portal link. Empty object when none."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "customer",
          "url",
          "reusable",
          "status",
          "expires_at",
          "revoked_at",
          "last_accessed_at",
          "metadata",
          "created_at"
        ],
        "description": "A time-limited link to the hosted customer portal, where the payer can see their invoices, pay an open one and replace the card on file. No login is involved: whoever has the URL can use it until it expires, is consumed or is revoked, so deliver it over a channel you trust."
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`prod_…`"
          },
          "name": {
            "type": "string",
            "description": "Shown on invoice lines and in the dashboard."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "`false` hides the product from new subscriptions; existing ones keep billing."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the product. Empty object when none."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "active",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "description": "Something you sell, such as \"Pro plan\" or \"API access\". A product carries no amount itself; attach one or more Prices to it."
      },
      "Price": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`price_…`"
          },
          "product": {
            "type": "string",
            "description": "`prod_…` this price belongs to."
          },
          "active": {
            "type": "boolean",
            "description": "`false` prevents use in new subscriptions; existing ones keep billing."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code, e.g. `ISK`."
          },
          "type": {
            "type": "string",
            "enum": [
              "one_time",
              "recurring"
            ],
            "description": "`one_time` for single payments, `recurring` for subscriptions."
          },
          "unit_amount": {
            "type": "number",
            "description": "Per-unit amount in minor units, or `null` for tiered prices.",
            "nullable": true
          },
          "recurring": {
            "description": "Billing period and usage type. `null` for `one_time` prices.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PriceRecurring"
              }
            ],
            "type": "object",
            "nullable": true
          },
          "tiers": {
            "description": "Tier table, or `null` for flat prices.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceTier"
            },
            "nullable": true
          },
          "tiers_mode": {
            "type": "string",
            "enum": [
              "graduated",
              "volume"
            ],
            "description": "`graduated` prices each unit at the rate of the tier it falls in; `volume` prices all units at the rate of the tier the total reaches. `null` for flat prices.",
            "nullable": true
          },
          "meter": {
            "type": "string",
            "description": "`mtr_…` whose aggregated usage this price bills. Set on metered prices only.",
            "nullable": true
          },
          "included_units": {
            "type": "number",
            "description": "Units included per period before the tiers apply. `null` when none.",
            "nullable": true
          },
          "accounting_code": {
            "type": "string",
            "description": "Accounting (GL) code copied to invoice lines, or `null` for the merchant default.",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the price. Empty object when none."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "product",
          "active",
          "currency",
          "type",
          "unit_amount",
          "recurring",
          "tiers",
          "tiers_mode",
          "meter",
          "included_units",
          "accounting_code",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "description": "How much a Product costs and how it bills. Amounts are immutable once created; to change a price, create a new one and deactivate the old."
      },
      "PriceRecurring": {
        "type": "object",
        "properties": {
          "interval": {
            "$ref": "#/components/schemas/PriceInterval",
            "description": "Unit of the billing period."
          },
          "interval_count": {
            "type": "number",
            "description": "Number of `interval`s per period. Default 1; `3` with `month` is quarterly."
          },
          "usage_type": {
            "type": "string",
            "enum": [
              "licensed",
              "metered"
            ],
            "description": "`licensed` (default) bills `unit_amount * quantity` per period; `metered` bills usage aggregated by `meter` at period end and requires `meter` on the price."
          },
          "aggregate_usage": {
            "type": "string",
            "enum": [
              "sum",
              "max",
              "last_during_period"
            ],
            "description": "Accepted for Stripe compatibility. Borga aggregates according to the Meter's `aggregate.type` and does not read this field."
          }
        },
        "required": [
          "interval"
        ],
        "description": "How often, and on what basis, a recurring price bills."
      },
      "PriceInterval": {
        "type": "string",
        "enum": [
          "day",
          "week",
          "month",
          "year"
        ],
        "description": "Unit of a billing period. Combine with `interval_count` for e.g. quarterly."
      },
      "PriceTier": {
        "type": "object",
        "properties": {
          "up_to": {
            "type": "number",
            "description": "Upper bound of the tier, or `null` for the last (unbounded) tier.",
            "nullable": true
          },
          "unit_amount": {
            "type": "number",
            "description": "Per-unit amount in minor units for units that fall in this tier."
          },
          "flat_amount": {
            "type": "number",
            "description": "Fixed amount in minor units charged once when the tier is reached."
          }
        },
        "required": [
          "up_to"
        ],
        "description": "One step of a tiered price. Tiers are ordered by `up_to`; the last one has `up_to: null`."
      },
      "Invoice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`inv_…`"
          },
          "customer": {
            "type": "string",
            "description": "`cus_…` billed, or `null` for a guest payment.",
            "nullable": true
          },
          "payment": {
            "type": "string",
            "description": "`pay_…` that paid, or is paying, the invoice. `null` until a payment exists.",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/InvoiceStatus",
            "description": "See `InvoiceStatus`."
          },
          "subtotal": {
            "type": "number",
            "description": "Sum of line nets in minor units, before tax and discount."
          },
          "tax": {
            "type": "number",
            "description": "Total tax in minor units."
          },
          "total": {
            "type": "number",
            "description": "Amount due in minor units, after tax and discount."
          },
          "amount_paid": {
            "type": "number",
            "description": "Amount collected so far in minor units. Reduced by refunds."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code."
          },
          "accounting_provider": {
            "type": "string",
            "enum": [
              "payday",
              "dk"
            ],
            "description": "Which provider issued the invoice, or `null` if none is connected.",
            "nullable": true
          },
          "external_invoice_id": {
            "type": "string",
            "description": "The invoice's id in the accounting provider.",
            "nullable": true
          },
          "external_invoice_number": {
            "type": "string",
            "description": "The sequential invoice number the provider assigned at finalization.",
            "nullable": true
          },
          "pdf_url": {
            "type": "string",
            "description": "Link to the provider-rendered PDF, when one exists.",
            "nullable": true
          },
          "sync_error_message": {
            "type": "string",
            "description": "Provider error when `status` is `sync_failed`, otherwise `null`.",
            "nullable": true
          },
          "external_reference": {
            "type": "string",
            "description": "Your own reference, copied from the payment.",
            "nullable": true
          },
          "billing": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "nullable": true
              },
              "email": {
                "type": "string",
                "nullable": true
              },
              "kennitala": {
                "type": "string",
                "description": "Icelandic national id.",
                "nullable": true
              },
              "vat_number": {
                "type": "string",
                "nullable": true
              },
              "address": {
                "type": "object",
                "properties": {
                  "line1": {
                    "type": "string",
                    "nullable": true
                  },
                  "line2": {
                    "type": "string",
                    "nullable": true
                  },
                  "city": {
                    "type": "string",
                    "nullable": true
                  },
                  "postal_code": {
                    "type": "string",
                    "nullable": true
                  },
                  "country": {
                    "type": "string",
                    "description": "ISO 3166-1 alpha-2.",
                    "nullable": true
                  }
                },
                "required": [
                  "line1",
                  "line2",
                  "city",
                  "postal_code",
                  "country"
                ],
                "nullable": true
              }
            },
            "required": [
              "name",
              "email",
              "kennitala",
              "vat_number",
              "address"
            ],
            "description": "Snapshot of the payer details printed on the invoice."
          },
          "finalized_at": {
            "type": "string",
            "description": "ISO 8601 time the invoice left `draft`, or `null`.",
            "nullable": true
          },
          "paid_at": {
            "type": "string",
            "description": "ISO 8601 time the invoice became `paid`, or `null`.",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLine"
            },
            "description": "Present when retrieving a single invoice."
          }
        },
        "required": [
          "id",
          "customer",
          "payment",
          "status",
          "subtotal",
          "tax",
          "total",
          "amount_paid",
          "currency",
          "accounting_provider",
          "external_invoice_id",
          "external_invoice_number",
          "pdf_url",
          "sync_error_message",
          "external_reference",
          "billing",
          "finalized_at",
          "paid_at",
          "created_at"
        ],
        "description": "A legal invoice. The accounting provider (PayDay or DK+) issues it and is the source of truth; Borga stores a mirror with the provider's number and PDF. Invoices are created by Borga, for one-off payments and subscription cycles, never through the API."
      },
      "InvoiceStatus": {
        "type": "string",
        "enum": [
          "draft",
          "open",
          "paid",
          "void",
          "sync_failed"
        ],
        "description": "`draft` while lines are still being assembled at period end; `open` once finalized in the accounting provider and awaiting payment; `paid` when collected (a zero-total invoice is paid immediately); `void` when cancelled; `sync_failed` when the accounting provider rejected it, in which case the sync can be retried from the dashboard."
      },
      "InvoiceLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "description": "Text printed on the line."
          },
          "quantity": {
            "type": "number",
            "description": "Number of units."
          },
          "unit_amount": {
            "type": "number",
            "description": "Per unit, excluding tax, in minor units."
          },
          "tax_rate": {
            "type": "number",
            "description": "Basis points (2400 = 24%), or `null` when the provider did not report one.",
            "nullable": true
          },
          "tax_amount": {
            "type": "number",
            "description": "Tax on the whole line in minor units, or `null`.",
            "nullable": true
          },
          "accounting_code": {
            "type": "string",
            "description": "GL account code the line was booked under, or `null`.",
            "nullable": true
          }
        },
        "required": [
          "id",
          "description",
          "quantity",
          "unit_amount",
          "tax_rate",
          "tax_amount",
          "accounting_code"
        ],
        "description": "One line on an invoice, mirrored from the accounting provider."
      },
      "CreditNote": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`cn_…`"
          },
          "invoice": {
            "type": "string",
            "description": "`inv_…` being credited."
          },
          "amount": {
            "type": "number",
            "description": "Credited amount in minor units; equals the refund amount."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code."
          },
          "reason": {
            "type": "string",
            "enum": [
              "duplicate",
              "fraudulent",
              "order_change",
              "product_unsatisfactory",
              "other"
            ],
            "description": "Why it was issued. Refund-driven notes use `other`.",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "issued",
              "failed",
              "void"
            ],
            "description": "`pending` until the accounting provider accepts it, then `issued`; `failed` when the provider rejected it; `void` when cancelled."
          },
          "accounting_provider": {
            "type": "string",
            "enum": [
              "payday",
              "dk"
            ],
            "description": "Which provider issued the note, or `null` if none is connected.",
            "nullable": true
          },
          "external_credit_note_id": {
            "type": "string",
            "description": "The note's id in the accounting provider, once issued.",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "invoice",
          "amount",
          "currency",
          "reason",
          "status",
          "accounting_provider",
          "external_credit_note_id",
          "created_at"
        ],
        "description": "The accounting record of a refund against an invoice. Created by Borga when a refund of an invoiced payment succeeds, then issued in the accounting provider. Never created through the API."
      },
      "PaymentMethod": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`pm_…`"
          },
          "object": {
            "type": "string",
            "enum": [
              "payment_method"
            ],
            "description": "Always `payment_method`."
          },
          "customer": {
            "type": "string",
            "description": "`cus_…` the card is attached to."
          },
          "type": {
            "type": "string",
            "enum": [
              "card"
            ],
            "description": "Only cards are supported today."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "detached",
              "expired",
              "failed"
            ],
            "description": "`active` can be charged; `detached` was removed with `detach()` and cannot be charged again. `expired` and `failed` are reserved for cards the processor reports as unusable."
          },
          "card": {
            "description": "Display details of the card. `null` when the processor returned none.",
            "type": "object",
            "properties": {
              "brand": {
                "type": "string",
                "description": "Scheme such as `visa` or `mastercard`.",
                "nullable": true
              },
              "last4": {
                "type": "string",
                "description": "Last four digits of the card number.",
                "nullable": true
              },
              "exp_month": {
                "type": "number",
                "description": "Expiry month, 1 to 12.",
                "nullable": true
              },
              "exp_year": {
                "type": "number",
                "description": "Four-digit expiry year.",
                "nullable": true
              },
              "wallet_type": {
                "type": "string",
                "description": "`apple_pay` or `google_pay` when the card came from a wallet.",
                "nullable": true
              }
            },
            "required": [
              "brand",
              "last4",
              "exp_month",
              "exp_year",
              "wallet_type"
            ],
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "detached_at": {
            "type": "string",
            "description": "ISO 8601 time of `detach()`, or `null` while attached.",
            "nullable": true
          }
        },
        "required": [
          "id",
          "object",
          "customer",
          "type",
          "status",
          "card",
          "created_at",
          "detached_at"
        ],
        "description": "A card tokenised at checkout (`save_payment_method: true` or a subscription checkout) and attached to a Customer, so it can be charged again without the payer present. Borga never exposes the card number."
      },
      "Payment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`pay_…`"
          },
          "amount": {
            "type": "number",
            "description": "Amount in the currency's smallest unit. ISK has no minor unit: 1990 = 1.990 kr."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code, e.g. `ISK`, `EUR`."
          },
          "status": {
            "$ref": "#/components/schemas/PaymentStatus",
            "description": "See `PaymentStatus`."
          },
          "subtotal": {
            "type": "number",
            "description": "Sum of line nets. Equals `amount` when there are no lines."
          },
          "tax": {
            "type": "number",
            "description": "Sum of line tax. 0 when there are no lines."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            },
            "description": "What the payment is for. Empty when it has none, and **absent** on `list()` unless you pass `expand: [\"line_items\"]`, so narrow before use."
          },
          "customer": {
            "type": "string",
            "description": "`cus_…` the payment belongs to, or `null` for a guest payer.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Free-text description set at create time.",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the payment. Empty object when none."
          },
          "collection_method": {
            "type": "string",
            "enum": [
              "card",
              "bank_invoice",
              "wallet"
            ],
            "description": "How the money was, or is being, collected. `null` until the payer picks a method at checkout. `wallet` covers Apple Pay and Google Pay; see `wallet_type`.",
            "nullable": true
          },
          "refunded_amount": {
            "type": "number",
            "description": "Total of confirmed refunds, in minor units. Pending refunds are not included until the processor confirms them."
          },
          "external_reference": {
            "type": "string",
            "description": "Your own order or invoice reference, as supplied on create.",
            "nullable": true
          },
          "failure_reason": {
            "type": "string",
            "description": "Why a `failed` payment failed, e.g. `card_declined`, `insufficient_funds` or `expired_card`. `null` unless the status is `failed`.",
            "nullable": true
          },
          "card_brand": {
            "type": "string",
            "description": "Card scheme such as `visa` or `mastercard`, once a card has been used.",
            "nullable": true
          },
          "card_last4": {
            "type": "string",
            "description": "Last four digits of the card used, once a card has been used.",
            "nullable": true
          },
          "wallet_type": {
            "type": "string",
            "description": "`apple_pay` or `google_pay` when a wallet was used, otherwise `null`.",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601. Changes on every status transition and refund."
          }
        },
        "required": [
          "id",
          "amount",
          "currency",
          "status",
          "subtotal",
          "tax",
          "customer",
          "description",
          "metadata",
          "collection_method",
          "refunded_amount",
          "external_reference",
          "failure_reason",
          "card_brand",
          "card_last4",
          "wallet_type",
          "created_at",
          "updated_at"
        ],
        "description": "Money collected, or to be collected, from a payer. Most payments are created for you by a PaymentSession; the exception is an off-session charge of a saved card through `payments.create({ payment_method })`."
      },
      "PaymentStatus": {
        "type": "string",
        "enum": [
          "created",
          "processing",
          "succeeded",
          "failed",
          "canceled",
          "refunded"
        ],
        "description": "Where a Payment is in its life. `created` is waiting for a PaymentSession to collect it; `processing` means the card authorisation or bank claim is in flight; `succeeded` and `failed` are the outcomes; `canceled` means the session expired or the merchant canceled before collection; `refunded` means the whole amount has been refunded. A partial refund leaves the status at `succeeded` and raises `refunded_amount` instead."
      },
      "LineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`pli_…`"
          },
          "description": {
            "type": "string",
            "description": "Shown to the payer at checkout and copied to the invoice line."
          },
          "quantity": {
            "type": "number",
            "description": "Number of units; `amount` scales with it."
          },
          "unit_amount": {
            "type": "number",
            "description": "Per unit, excluding tax, in the currency's smallest unit."
          },
          "tax_rate": {
            "type": "number",
            "description": "Basis points. 2400 = 24%."
          },
          "tax_amount": {
            "type": "number",
            "description": "Tax on the whole line (`unit_amount * quantity * tax_rate / 10000`), rounded."
          },
          "amount": {
            "type": "number",
            "description": "Gross line total."
          },
          "accounting_code": {
            "type": "string",
            "description": "GL account code the line is booked under, or `null` for the merchant default.",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Metadata supplied on the line at create time. Empty object when none."
          }
        },
        "required": [
          "id",
          "description",
          "quantity",
          "unit_amount",
          "tax_rate",
          "tax_amount",
          "amount",
          "accounting_code",
          "metadata"
        ],
        "description": "One line of what a payment is for. `unit_amount` EXCLUDES tax, so `amount === unit_amount * quantity + tax_amount`."
      },
      "PaymentSession": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`ps_…`"
          },
          "payment": {
            "type": "string",
            "description": "The `pay_…` id of the Payment this session collects."
          },
          "payment_status": {
            "$ref": "#/components/schemas/PaymentStatus",
            "description": "Present when retrieving a session; the current status of `payment`."
          },
          "url": {
            "type": "string",
            "description": "Hosted checkout URL to redirect the payer to. `null` for embedded sessions.",
            "nullable": true
          },
          "return_url": {
            "type": "string",
            "description": "Where the payer lands after checkout, with `?session=ps_…` appended. Empty when none was given."
          },
          "cancel_url": {
            "type": "string",
            "description": "Where the payer lands if they go back from checkout. Empty when none was given."
          },
          "expires_at": {
            "type": "string",
            "description": "ISO 8601. After this the session can no longer be used to pay."
          },
          "status": {
            "$ref": "#/components/schemas/PaymentSessionStatus",
            "description": "See `PaymentSessionStatus`."
          },
          "enabled_methods": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentMethodType"
            },
            "description": "Methods offered at checkout, as resolved from the create request."
          },
          "mode": {
            "$ref": "#/components/schemas/PaymentSessionMode",
            "description": "`hosted` or `embedded`."
          },
          "locale": {
            "type": "string",
            "description": "Language tag checkout renders in, e.g. `is` or `en`."
          },
          "customer_email": {
            "type": "string",
            "description": "Email pre-filled on the checkout page, or `null`.",
            "nullable": true
          },
          "customer_kennitala": {
            "type": "string",
            "description": "Kennitala pre-filled for bank-invoice collection, or `null`.",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "client_secret": {
            "type": "string",
            "description": "Embedded sessions only, and only on the create response: the `pcs_…` secret the browser SDK uses to open the session.",
            "nullable": true
          }
        },
        "required": [
          "id",
          "payment",
          "url",
          "return_url",
          "cancel_url",
          "expires_at",
          "status",
          "enabled_methods",
          "mode",
          "locale",
          "customer_email",
          "customer_kennitala",
          "created_at"
        ],
        "description": "A single checkout attempt for one Payment. Create one, send the payer to `url` (hosted) or hand `client_secret` to borga.js (embedded), then rely on the `payment.succeeded` webhook or `retrieve()` for the outcome."
      },
      "PaymentSessionStatus": {
        "type": "string",
        "enum": [
          "open",
          "complete",
          "expired"
        ],
        "description": "`open` while the payer can still pay; `complete` once checkout finished (check `payment_status` for the outcome); `expired` once `expires_at` passed without a payment."
      },
      "PaymentMethodType": {
        "type": "string",
        "enum": [
          "card",
          "apple_pay",
          "google_pay",
          "bank_invoice"
        ],
        "description": "Payment methods a session can offer. `bank_invoice` (krafa, a claim in the payer's online banking) is hosted-only, needs a connected PayDay account and the payer's kennitala."
      },
      "PaymentSessionMode": {
        "type": "string",
        "enum": [
          "hosted",
          "embedded"
        ],
        "description": "How checkout is presented. `hosted` redirects the payer to a page on checkout.borga.is and back to your `return_url`; `embedded` opens checkout inside your own page through borga.js, using the session's `client_secret`."
      },
      "Refund": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`ref_…`"
          },
          "payment": {
            "type": "string",
            "description": "`pay_…` being refunded."
          },
          "amount": {
            "type": "number",
            "description": "Refunded amount in the currency's smallest unit."
          },
          "currency": {
            "type": "string",
            "description": "Same as the payment's currency."
          },
          "status": {
            "$ref": "#/components/schemas/RefundStatus",
            "description": "See `RefundStatus`."
          },
          "reason": {
            "type": "string",
            "description": "Free-text reason supplied on create, or `null`.",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the refund. Empty object when none."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601. Changes when the processor confirms or fails the refund."
          }
        },
        "required": [
          "id",
          "payment",
          "amount",
          "currency",
          "status",
          "reason",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "description": "A full or partial reversal of a Payment. When the refunded payment has an invoice, a CreditNote is issued in the accounting provider once the refund succeeds."
      },
      "RefundStatus": {
        "type": "string",
        "enum": [
          "pending",
          "succeeded",
          "failed"
        ],
        "description": "`pending` until the card processor confirms the reversal, then `succeeded` or `failed`. Only `succeeded` refunds count towards the payment's `refunded_amount`; `pending` ones still reserve the balance."
      },
      "Meter": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`mtr_…`"
          },
          "object": {
            "type": "string",
            "enum": [
              "meter"
            ],
            "description": "Always `meter`."
          },
          "name": {
            "type": "string",
            "description": "Display name, e.g. `LLM tokens`. Shown in the portal and on invoices."
          },
          "event_name": {
            "type": "string",
            "description": "Matches `event_name` on ingested usage events."
          },
          "aggregate": {
            "type": "object",
            "properties": {
              "type": {
                "$ref": "#/components/schemas/MeterAggregateType"
              },
              "property": {
                "type": "string",
                "nullable": true
              }
            },
            "required": [
              "type",
              "property"
            ],
            "description": "Aggregation rule. `property` is a metadata path such as `metadata.tokens`, or `null` for `count`."
          },
          "filter": {
            "description": "Metadata equality filter events must match, or `null` to match all.",
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          },
          "unit_label": {
            "type": "string",
            "description": "Display label for units, e.g. `tokens`, `requests`, `GB`.",
            "nullable": true
          },
          "unit_multiplier": {
            "type": "number",
            "description": "The aggregated value is divided by this before pricing, e.g. 1000000 for \"per 1M tokens\".",
            "nullable": true
          },
          "archived_at": {
            "type": "string",
            "description": "ISO 8601 time of `archive()`, or `null` while accepting events.",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "object",
          "name",
          "event_name",
          "aggregate",
          "filter",
          "unit_label",
          "unit_multiplier",
          "archived_at",
          "created_at",
          "updated_at"
        ],
        "description": "A rule that turns raw usage events into billable units. Metered prices reference a meter; at period end Borga aggregates the customer's matching events and prices the result against the price's tiers."
      },
      "MeterAggregateType": {
        "type": "string",
        "enum": [
          "count",
          "sum",
          "max",
          "min",
          "avg",
          "unique"
        ],
        "description": "How a meter turns matching events into one quantity per period. `count` counts events; `sum`, `max`, `min` and `avg` apply to the numeric `aggregate.property`; `unique` counts distinct values of it."
      },
      "UsageEventResult": {
        "type": "object",
        "properties": {
          "inserted": {
            "type": "number",
            "description": "Events stored."
          },
          "duplicates": {
            "type": "number",
            "description": "Events skipped because their `idempotency_key` was seen before."
          }
        },
        "required": [
          "inserted",
          "duplicates"
        ],
        "description": "Outcome of an ingest call. `inserted + duplicates` equals the number sent."
      },
      "UsageEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`ue_…`"
          },
          "object": {
            "type": "string",
            "enum": [
              "usage_event"
            ],
            "description": "Always `usage_event`."
          },
          "event_name": {
            "type": "string",
            "description": "The meter `event_name` this event feeds."
          },
          "customer": {
            "type": "string",
            "description": "`cus_…` the event was resolved to, or `null` if unlinked.",
            "nullable": true
          },
          "external_customer_id": {
            "type": "string",
            "description": "The `external_customer_id` supplied at ingest, or `null`.",
            "nullable": true
          },
          "timestamp": {
            "type": "string",
            "description": "ISO 8601 time the usage happened; decides which billing period it lands in."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "description": "Metadata supplied at ingest."
          },
          "idempotency_key": {
            "type": "string",
            "description": "Dedup key supplied at ingest, or `null`.",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601 time Borga stored the event."
          }
        },
        "required": [
          "id",
          "object",
          "event_name",
          "customer",
          "external_customer_id",
          "timestamp",
          "metadata",
          "idempotency_key",
          "created_at"
        ],
        "description": "A stored usage event, as returned by `usageEvents.list()`."
      },
      "MeterQuantity": {
        "type": "object",
        "properties": {
          "meter": {
            "type": "string",
            "description": "`mtr_…`"
          },
          "customer": {
            "type": "string",
            "description": "`cus_…`"
          },
          "period_start": {
            "type": "string",
            "description": "ISO 8601, as requested."
          },
          "period_end": {
            "type": "string",
            "description": "ISO 8601, as requested."
          },
          "quantity": {
            "type": "number",
            "description": "Aggregated value for the period, before `unit_multiplier`."
          },
          "unit_label": {
            "type": "string",
            "description": "The meter's `unit_label`.",
            "nullable": true
          }
        },
        "required": [
          "meter",
          "customer",
          "period_start",
          "period_end",
          "quantity",
          "unit_label"
        ],
        "description": "Result of `meters.quantities()`: one customer's usage on one meter over a period."
      },
      "CustomerMeterBalance": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "string",
            "description": "`cus_…`"
          },
          "meter": {
            "type": "string",
            "description": "`mtr_…`"
          },
          "period_start": {
            "type": "string",
            "description": "ISO 8601."
          },
          "period_end": {
            "type": "string",
            "description": "ISO 8601. Credits reset after this."
          },
          "consumed_units": {
            "type": "number",
            "description": "Units aggregated so far this period."
          },
          "included_units": {
            "type": "number",
            "description": "Units included by the subscription this period, rolled-over units included."
          },
          "balance": {
            "type": "number",
            "description": "Included units still unused. 0 once in overage."
          },
          "overage_units": {
            "type": "number",
            "description": "Units beyond the included allowance; billed at the metered rate at period end."
          }
        },
        "required": [
          "customer",
          "meter",
          "period_start",
          "period_end",
          "consumed_units",
          "included_units",
          "balance",
          "overage_units"
        ],
        "description": "Live state of a customer's meter in the current billing period: what they have used, what their subscription includes, and the overage that will be billed."
      },
      "CustomerState": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "string",
            "description": "`cus_…`"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "`sub_…`"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "trialing",
                    "active",
                    "past_due"
                  ]
                },
                "current_period_start": {
                  "type": "string",
                  "description": "ISO 8601."
                },
                "current_period_end": {
                  "type": "string",
                  "description": "ISO 8601."
                },
                "cancel_at_period_end": {
                  "type": "boolean",
                  "description": "`true` when the subscription ends at `current_period_end`."
                },
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "price": {
                        "type": "string"
                      },
                      "quantity": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "id",
                      "price",
                      "quantity"
                    ]
                  },
                  "description": "`si_…` id, `price_…` id and quantity of each item."
                }
              },
              "required": [
                "id",
                "status",
                "current_period_start",
                "current_period_end",
                "cancel_at_period_end",
                "items"
              ]
            },
            "description": "Subscriptions that are currently billing. Canceled and paused ones are left out."
          },
          "meters": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "meter": {
                  "type": "string",
                  "description": "`mtr_…`"
                },
                "name": {
                  "type": "string",
                  "description": "The meter's display name."
                },
                "unit_label": {
                  "type": "string",
                  "description": "The meter's `unit_label`, e.g. `tokens`.",
                  "nullable": true
                },
                "consumed_units": {
                  "type": "number",
                  "description": "Units aggregated so far this period."
                },
                "included_units": {
                  "type": "number",
                  "description": "Units the subscription includes this period, rollover included."
                },
                "balance": {
                  "type": "number",
                  "description": "Included units still unused."
                },
                "overage_units": {
                  "type": "number",
                  "description": "Units beyond the included allowance; billed at the metered rate."
                },
                "period_start": {
                  "type": "string",
                  "description": "ISO 8601."
                },
                "period_end": {
                  "type": "string",
                  "description": "ISO 8601."
                }
              },
              "required": [
                "meter",
                "name",
                "unit_label",
                "consumed_units",
                "included_units",
                "balance",
                "overage_units",
                "period_start",
                "period_end"
              ]
            },
            "description": "One entry per meter the customer has a balance on in the current period."
          }
        },
        "required": [
          "customer",
          "subscriptions",
          "meters"
        ],
        "description": "Everything a customer-facing billing page needs in one call: the customer's active, trialing and past-due subscriptions with their items, and the live balance of every meter they have usage on."
      },
      "Subscription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`sub_…`"
          },
          "object": {
            "type": "string",
            "enum": [
              "subscription"
            ],
            "description": "Always `subscription`."
          },
          "customer": {
            "type": "string",
            "description": "`cus_…` being billed."
          },
          "status": {
            "$ref": "#/components/schemas/SubscriptionStatus",
            "description": "See `SubscriptionStatus`."
          },
          "collection_method": {
            "$ref": "#/components/schemas/CollectionMethod",
            "description": "See `CollectionMethod`."
          },
          "days_until_due": {
            "type": "number",
            "description": "Days the payer has to settle each invoice. `null` for `charge_automatically`.",
            "nullable": true
          },
          "current_period_start": {
            "type": "string",
            "description": "ISO 8601. During a trial the period spans the trial."
          },
          "current_period_end": {
            "type": "string",
            "description": "ISO 8601. When the next cycle invoice is produced."
          },
          "cancel_at_period_end": {
            "type": "boolean",
            "description": "`true` when the subscription ends at `current_period_end`; see `cancel()`."
          },
          "canceled_at": {
            "type": "string",
            "description": "ISO 8601 time the cancellation was requested, or `null`.",
            "nullable": true
          },
          "ended_at": {
            "type": "string",
            "description": "ISO 8601 time billing actually stopped, or `null` while running.",
            "nullable": true
          },
          "trial_start": {
            "type": "string",
            "description": "ISO 8601 start of the trial, or `null` if there was none.",
            "nullable": true
          },
          "trial_end": {
            "type": "string",
            "description": "ISO 8601 end of the trial, or `null` if there was none.",
            "nullable": true
          },
          "pause_collection": {
            "description": "Truthy while the subscription is paused. Typed loosely; treat as a boolean."
          },
          "discount": {
            "description": "Discount applied to cycle invoices, or `null`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionDiscount"
              }
            ],
            "type": "object",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the subscription. Empty object when none."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionItem"
            },
            "description": "The prices being billed. Never empty."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "object",
          "customer",
          "status",
          "collection_method",
          "days_until_due",
          "current_period_start",
          "current_period_end",
          "cancel_at_period_end",
          "canceled_at",
          "ended_at",
          "trial_start",
          "trial_end",
          "pause_collection",
          "discount",
          "metadata",
          "items",
          "created_at",
          "updated_at"
        ],
        "description": "A customer's recurring commitment to one or more prices. Borga runs the billing cycle: at each `current_period_end` it aggregates usage, drafts and finalizes an invoice, and collects it per `collection_method`."
      },
      "SubscriptionStatus": {
        "type": "string",
        "enum": [
          "trialing",
          "active",
          "past_due",
          "unpaid",
          "canceled",
          "paused"
        ],
        "description": "Where a subscription is in its life. `trialing` until `trial_end`, then `active` while invoices are paid. `past_due` after a failed charge or a missed due date, while retries run; from there it recovers to `active` or, once retries are exhausted and the merchant has chosen so, ends as `canceled`. `paused` stops the licensed charge until `resume()` while usage keeps being metered and invoiced at period end. `canceled` is terminal. `unpaid` is reserved and not assigned today."
      },
      "CollectionMethod": {
        "type": "string",
        "enum": [
          "charge_automatically",
          "send_invoice"
        ],
        "description": "`charge_automatically` charges the customer's default saved card at the end of each period; `send_invoice` issues an invoice through the accounting provider (a bank claim when the customer has a kennitala) that the payer settles within `days_until_due`."
      },
      "SubscriptionDiscount": {
        "type": "object",
        "properties": {
          "amount_off": {
            "type": "number",
            "description": "Fixed reduction in the subscription currency's smallest unit, capped at the subtotal."
          },
          "percent_off": {
            "type": "number",
            "description": "Percentage reduction, 0 to 100. Ignored when `amount_off` is set."
          },
          "duration": {
            "type": "string",
            "enum": [
              "once"
            ],
            "description": "`once` clears the discount after the next cycle invoice."
          }
        },
        "description": "A discount applied to the cycle invoice's subtotal. Give either `amount_off` or `percent_off`. Without `duration` it applies every cycle until removed."
      },
      "SubscriptionItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`si_…`"
          },
          "object": {
            "type": "string",
            "enum": [
              "subscription_item"
            ],
            "description": "Always `subscription_item`."
          },
          "subscription": {
            "type": "string",
            "description": "`sub_…` the item belongs to."
          },
          "price": {
            "type": "string",
            "description": "`price_…` the item bills."
          },
          "quantity": {
            "type": "number",
            "description": "Seats or units multiplied into licensed prices. Default 1."
          },
          "credit_rollover": {
            "type": "boolean",
            "description": "`true` carries unused included units into the next period."
          },
          "included_units": {
            "type": "number",
            "description": "Included units per period overriding the price's `included_units`, or `null`.",
            "nullable": true
          },
          "trial_included_units": {
            "type": "number",
            "description": "Included units while the subscription is trialing, or `null` for the regular allowance.",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the item. Empty object when none."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "object",
          "subscription",
          "price",
          "quantity",
          "credit_rollover",
          "included_units",
          "trial_included_units",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "description": "One price within a subscription, with its quantity and credit settings."
      },
      "Deleted": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Always `true`."
          },
          "id": {
            "type": "string",
            "description": "Id of the object that was removed."
          }
        },
        "required": [
          "deleted",
          "id"
        ],
        "description": "Returned by delete-style endpoints that remove an object outright."
      },
      "InvoiceItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "`ii_…`"
          },
          "object": {
            "type": "string",
            "enum": [
              "invoice_item"
            ],
            "description": "Always `invoice_item`."
          },
          "customer": {
            "type": "string",
            "description": "`cus_…` the item will be billed to."
          },
          "subscription": {
            "type": "string",
            "description": "`sub_…` whose next invoice carries the item, or `null`.",
            "nullable": true
          },
          "invoice": {
            "type": "string",
            "description": "Set once the item has been pulled onto an invoice.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Per-unit amount in minor units. Negative for a credit."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code."
          },
          "description": {
            "type": "string",
            "description": "Text printed on the invoice line."
          },
          "quantity": {
            "type": "number",
            "description": "Number of units; the line total is `amount * quantity`."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata",
            "description": "Free-form data stored on the item. Empty object when none."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "object",
          "customer",
          "subscription",
          "invoice",
          "amount",
          "currency",
          "description",
          "quantity",
          "metadata",
          "created_at"
        ],
        "description": "A one-off charge or credit waiting for a customer's next invoice, such as a setup fee or a goodwill credit. Pulled onto the next subscription cycle invoice, after which `invoice` is set."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}
