> ## Documentation Index
> Fetch the complete documentation index at: https://flowglad.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Billing Details



## OpenAPI

````yaml https://app.flowglad.com/api/openapi get /api/v1/customers/{externalId}/billing
openapi: 3.1.0
info:
  title: Flowglad API
  version: 0.0.1
servers:
  - url: https://app.flowglad.com
security: []
externalDocs:
  url: https://docs.flowglad.com
paths:
  /api/v1/customers/{externalId}/billing:
    get:
      tags:
        - Customer
        - Customer Billing
      summary: Get Billing Details
      operationId: customers-getBilling
      parameters:
        - in: path
          name: externalId
          schema:
            description: The ID of the customer, as defined in your application
            type: string
          required: true
          description: The ID of the customer, as defined in your application
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  customer:
                    $ref: '#/components/schemas/CustomerClientSelectSchema'
                  subscriptions:
                    type: array
                    items:
                      $ref: '#/components/schemas/SubscriptionDetails'
                  invoices:
                    type: array
                    items:
                      type: object
                      properties:
                        invoice:
                          $ref: '#/components/schemas/InvoiceRecord'
                          description: >-
                            An invoice record, which describes a bill that can
                            be associated with a purchase, subscription, or
                            stand alone. Each invoice has a specific type that
                            determines its behavior and required fields.
                        invoiceLineItems:
                          type: array
                          items:
                            $ref: '#/components/schemas/InvoiceLineItemRecord'
                      required:
                        - invoice
                        - invoiceLineItems
                      additionalProperties: false
                  paymentMethods:
                    type: array
                    items:
                      $ref: '#/components/schemas/PaymentMethodClientSelectSchema'
                  purchases:
                    type: array
                    items:
                      $ref: '#/components/schemas/PurchaseRecord'
                      description: >-
                        A purchase record, which describes a transaction that
                        can be associated with either a subscription or single
                        payment price. Each purchase has a specific type that
                        determines its behavior and required fields.
                  currentSubscriptions:
                    description: >-
                      The current subscriptions for the customer. By default,
                      customers can only have one active subscription at a time.
                      This will only return multiple subscriptions if you have
                      enabled multiple subscriptions per customer.
                    type: array
                    items:
                      $ref: '#/components/schemas/SubscriptionDetails'
                  currentSubscription:
                    $ref: '#/components/schemas/SubscriptionDetails'
                    description: >-
                      The most recently created current subscription for the
                      customer. If createdAt timestamps tie, the most recently
                      updated subscription will be returned. If updatedAt also
                      ties, subscription id is used as the final tiebreaker.
                  catalog:
                    $ref: '#/components/schemas/PricingModelDetailsRecord'
                  pricingModel:
                    $ref: '#/components/schemas/PricingModelDetailsRecord'
                  billingPortalUrl:
                    description: The billing portal URL for the customer
                    type: string
                    format: uri
                required:
                  - customer
                  - subscriptions
                  - invoices
                  - paymentMethods
                  - purchases
                  - catalog
                  - pricingModel
                  - billingPortalUrl
                additionalProperties: false
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '403':
          description: Insufficient access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.FORBIDDEN'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.NOT_FOUND'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CustomerClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        email:
          type: string
        name:
          type: string
        invoiceNumberBase:
          anyOf:
            - type: string
            - type: 'null'
        archived:
          type: boolean
        logoURL:
          anyOf:
            - type: string
            - type: 'null'
        iconURL:
          anyOf:
            - type: string
            - type: 'null'
        domain:
          anyOf:
            - type: string
            - type: 'null'
        billingAddress:
          anyOf:
            - $ref: '#/components/schemas/BillingAddress'
            - type: 'null'
        externalId:
          type: string
        userId:
          anyOf:
            - type: string
            - type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - email
        - name
        - invoiceNumberBase
        - archived
        - logoURL
        - iconURL
        - domain
        - externalId
        - userId
        - pricingModelId
      additionalProperties: false
    SubscriptionDetails:
      oneOf:
        - $ref: '#/components/schemas/NonRenewingSubscriptionDetails'
        - $ref: '#/components/schemas/StandardSubscriptionDetails'
      type: object
      discriminator:
        propertyName: renews
        mapping:
          'false':
            $ref: '#/components/schemas/NonRenewingSubscriptionDetails'
          'true':
            $ref: '#/components/schemas/StandardSubscriptionDetails'
    InvoiceRecord:
      anyOf:
        - $ref: '#/components/schemas/PurchaseInvoiceClientSelectSchema'
        - $ref: '#/components/schemas/SubscriptionInvoiceClientSelectSchema'
        - $ref: '#/components/schemas/StandaloneInvoiceClientSelectSchema'
    InvoiceLineItemRecord:
      oneOf:
        - $ref: '#/components/schemas/StaticInvoiceLineItemClientSelectSchema'
        - $ref: '#/components/schemas/UsageInvoiceLineItemClientSelectSchema'
      type: object
      discriminator:
        propertyName: type
        mapping:
          static:
            $ref: '#/components/schemas/StaticInvoiceLineItemClientSelectSchema'
          usage:
            $ref: '#/components/schemas/UsageInvoiceLineItemClientSelectSchema'
    PaymentMethodClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        customerId:
          type: string
        pricingModelId:
          type: string
        billingDetails:
          type: object
          properties:
            name:
              anyOf:
                - type: string
                - type: 'null'
            email:
              anyOf:
                - type: string
                - type: 'null'
            address:
              type: object
              properties:
                name:
                  anyOf:
                    - type: string
                    - type: 'null'
                line1:
                  anyOf:
                    - type: string
                    - type: 'null'
                line2:
                  anyOf:
                    - type: string
                    - type: 'null'
                city:
                  anyOf:
                    - type: string
                    - type: 'null'
                state:
                  anyOf:
                    - type: string
                    - type: 'null'
                postal_code:
                  anyOf:
                    - type: string
                    - type: 'null'
                country:
                  type: string
                address:
                  anyOf:
                    - type: object
                      properties:
                        name:
                          anyOf:
                            - type: string
                            - type: 'null'
                        line1:
                          anyOf:
                            - type: string
                            - type: 'null'
                        line2:
                          anyOf:
                            - type: string
                            - type: 'null'
                        city:
                          anyOf:
                            - type: string
                            - type: 'null'
                        state:
                          anyOf:
                            - type: string
                            - type: 'null'
                        postal_code:
                          anyOf:
                            - type: string
                            - type: 'null'
                        country:
                          type: string
                      required:
                        - country
                      additionalProperties: false
                    - type: 'null'
              required:
                - country
              additionalProperties: false
          required:
            - address
          additionalProperties: false
        type:
          type: string
          enum:
            - card
            - link
            - us_bank_account
            - sepa_debit
        default:
          type: boolean
        paymentMethodData:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - customerId
        - pricingModelId
        - billingDetails
        - type
        - default
        - paymentMethodData
      additionalProperties: false
    PurchaseRecord:
      anyOf:
        - $ref: '#/components/schemas/SubscriptionPurchaseClientSelectSchema'
        - $ref: '#/components/schemas/SinglePaymentPurchaseClientSelectSchema'
        - $ref: '#/components/schemas/UsagePurchaseClientSelectSchema'
    PricingModelDetailsRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        isDefault:
          type: boolean
        name:
          type: string
        products:
          type: array
          items:
            $ref: '#/components/schemas/ProductWithPricesRecord'
        usageMeters:
          type: array
          items:
            $ref: '#/components/schemas/UsageMeterWithPricesRecord'
        defaultProduct:
          $ref: '#/components/schemas/ProductWithPricesRecord'
          description: >-
            The default product for the pricing model. If no product is
            explicitly set as default, will return undefined.
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - isDefault
        - name
        - products
        - usageMeters
      additionalProperties: false
    error.BAD_REQUEST:
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Invalid input data
          type: string
        code:
          description: The error code
          example: BAD_REQUEST
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.UNAUTHORIZED:
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Authorization not provided
          type: string
        code:
          description: The error code
          example: UNAUTHORIZED
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.FORBIDDEN:
      title: Insufficient access error (403)
      description: The error information
      example:
        code: FORBIDDEN
        message: Insufficient access
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Insufficient access
          type: string
        code:
          description: The error code
          example: FORBIDDEN
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.NOT_FOUND:
      title: Not found error (404)
      description: The error information
      example:
        code: NOT_FOUND
        message: Not found
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Not found
          type: string
        code:
          description: The error code
          example: NOT_FOUND
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.INTERNAL_SERVER_ERROR:
      title: Internal server error error (500)
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Internal server error
          type: string
        code:
          description: The error code
          example: INTERNAL_SERVER_ERROR
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    BillingAddress:
      type: object
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
        firstName:
          anyOf:
            - type: string
            - type: 'null'
        lastName:
          anyOf:
            - type: string
            - type: 'null'
        email:
          anyOf:
            - type: string
              format: email
              pattern: >-
                ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
            - type: 'null'
        address:
          type: object
          properties:
            name:
              anyOf:
                - type: string
                - type: 'null'
            line1:
              anyOf:
                - type: string
                - type: 'null'
            line2:
              anyOf:
                - type: string
                - type: 'null'
            city:
              anyOf:
                - type: string
                - type: 'null'
            state:
              anyOf:
                - type: string
                - type: 'null'
            postal_code:
              anyOf:
                - type: string
                - type: 'null'
            country:
              type: string
          required:
            - country
          additionalProperties: false
        phone:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - address
      additionalProperties: false
    NonRenewingSubscriptionDetails:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        startDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        customerId:
          type: string
        organizationId:
          type: string
        status:
          type: string
          enum:
            - active
            - canceled
            - credit_trial
        defaultPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        backupPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        trialEnd:
          description: Omitted.
          type: 'null'
        currentBillingPeriodStart:
          description: Omitted.
          type: 'null'
        currentBillingPeriodEnd:
          description: Omitted.
          type: 'null'
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        canceledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancelScheduledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancellationReason:
          anyOf:
            - type: string
            - type: 'null'
        replacedBySubscriptionId:
          anyOf:
            - type: string
            - type: 'null'
        isFreePlan:
          anyOf:
            - type: boolean
            - type: 'null'
        doNotCharge:
          anyOf:
            - type: boolean
            - type: 'null'
        priceId:
          type: string
        runBillingAtPeriodStart:
          anyOf:
            - type: boolean
            - type: 'null'
        interval:
          description: Omitted.
          type: 'null'
        intervalCount:
          description: Omitted.
          type: 'null'
        billingCycleAnchorDate:
          description: Omitted.
          type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        renews:
          type: boolean
          const: false
        pricingModelId:
          type: string
        scheduledAdjustmentAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        current:
          type: boolean
        subscriptionItems:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              createdAt:
                description: Epoch milliseconds.
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
              updatedAt:
                description: Epoch milliseconds.
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
              livemode:
                type: boolean
              subscriptionId:
                type: string
              name:
                anyOf:
                  - type: string
                  - type: 'null'
              addedDate:
                description: Epoch milliseconds.
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
              priceId:
                anyOf:
                  - type: string
                  - type: 'null'
              unitPrice:
                anyOf:
                  - description: A positive integer
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 9007199254740991
                  - type: number
                    const: 0
              quantity:
                anyOf:
                  - description: A positive integer
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 9007199254740991
                  - type: number
                    const: 0
              metadata:
                anyOf:
                  - $ref: '#/components/schemas/Metadata'
                  - type: 'null'
              type:
                type: string
                const: static
              externalId:
                anyOf:
                  - type: string
                  - type: 'null'
              expiredAt:
                description: >-
                  Used as a flag to soft delete a subscription item without
                  losing its history for auditability. If set, it will be
                  removed from the subscription items list and will not be
                  included in the billing period item list. Epoch milliseconds.
                anyOf:
                  - description: >-
                      Used as a flag to soft delete a subscription item without
                      losing its history for auditability. If set, it will be
                      removed from the subscription items list and will not be
                      included in the billing period item list. Epoch
                      milliseconds.
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  - type: 'null'
              manuallyCreated:
                type: boolean
              pricingModelId:
                type: string
              price:
                $ref: '#/components/schemas/PriceRecord'
            required:
              - id
              - createdAt
              - updatedAt
              - livemode
              - subscriptionId
              - name
              - addedDate
              - priceId
              - unitPrice
              - quantity
              - type
              - externalId
              - manuallyCreated
              - pricingModelId
              - price
            additionalProperties: false
        experimental:
          description: Experimental fields. May change without notice.
          type: object
          properties:
            featureItems:
              type: array
              items:
                $ref: >-
                  #/components/schemas/SubscriptionItemFeaturesClientSelectSchema
            usageMeterBalances:
              type: array
              items:
                description: >-
                  A usage meter and the available balance for that meter, scoped
                  to a given subscription.
                type: object
                properties:
                  id:
                    type: string
                  createdAt:
                    description: Epoch milliseconds.
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  updatedAt:
                    description: Epoch milliseconds.
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  livemode:
                    type: boolean
                  organizationId:
                    type: string
                  name:
                    description: The name of the usage meter
                    type: string
                    minLength: 1
                    maxLength: 255
                  pricingModelId:
                    type: string
                  slug:
                    description: The slug of the usage meter
                    type: string
                    minLength: 1
                    maxLength: 255
                  aggregationType:
                    description: >-
                      The type of aggregation to perform on the usage meter.
                      Defaults to "sum", which aggregates all the usage event
                      amounts for the billing period.
                      "count_distinct_properties" counts the number of distinct
                      properties in the billing period for a given meter.
                    type: string
                    enum:
                      - sum
                      - count_distinct_properties
                  availableBalance:
                    type: number
                  subscriptionId:
                    type: string
                required:
                  - id
                  - createdAt
                  - updatedAt
                  - livemode
                  - organizationId
                  - name
                  - pricingModelId
                  - slug
                  - aggregationType
                  - availableBalance
                  - subscriptionId
                additionalProperties: false
          required:
            - featureItems
            - usageMeterBalances
          additionalProperties: false
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - startDate
        - customerId
        - organizationId
        - status
        - defaultPaymentMethodId
        - backupPaymentMethodId
        - trialEnd
        - currentBillingPeriodStart
        - currentBillingPeriodEnd
        - cancellationReason
        - replacedBySubscriptionId
        - isFreePlan
        - doNotCharge
        - priceId
        - runBillingAtPeriodStart
        - interval
        - intervalCount
        - billingCycleAnchorDate
        - name
        - renews
        - pricingModelId
        - current
        - subscriptionItems
      additionalProperties: false
    StandardSubscriptionDetails:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        startDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        customerId:
          type: string
        organizationId:
          type: string
        status:
          type: string
          enum:
            - trialing
            - active
            - past_due
            - unpaid
            - cancellation_scheduled
            - incomplete
            - incomplete_expired
            - canceled
            - paused
        defaultPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        backupPaymentMethodId:
          anyOf:
            - type: string
            - type: 'null'
        trialEnd:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        currentBillingPeriodStart:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        currentBillingPeriodEnd:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        canceledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancelScheduledAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        cancellationReason:
          anyOf:
            - type: string
            - type: 'null'
        replacedBySubscriptionId:
          anyOf:
            - type: string
            - type: 'null'
        isFreePlan:
          anyOf:
            - type: boolean
            - type: 'null'
        doNotCharge:
          anyOf:
            - type: boolean
            - type: 'null'
        priceId:
          type: string
        runBillingAtPeriodStart:
          anyOf:
            - type: boolean
            - type: 'null'
        interval:
          type: string
          enum:
            - day
            - week
            - month
            - year
        intervalCount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        billingCycleAnchorDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        renews:
          type: boolean
          const: true
        pricingModelId:
          type: string
        scheduledAdjustmentAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        current:
          type: boolean
        subscriptionItems:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              createdAt:
                description: Epoch milliseconds.
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
              updatedAt:
                description: Epoch milliseconds.
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
              livemode:
                type: boolean
              subscriptionId:
                type: string
              name:
                anyOf:
                  - type: string
                  - type: 'null'
              addedDate:
                description: Epoch milliseconds.
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
              priceId:
                anyOf:
                  - type: string
                  - type: 'null'
              unitPrice:
                anyOf:
                  - description: A positive integer
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 9007199254740991
                  - type: number
                    const: 0
              quantity:
                anyOf:
                  - description: A positive integer
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 9007199254740991
                  - type: number
                    const: 0
              metadata:
                anyOf:
                  - $ref: '#/components/schemas/Metadata'
                  - type: 'null'
              type:
                type: string
                const: static
              externalId:
                anyOf:
                  - type: string
                  - type: 'null'
              expiredAt:
                description: >-
                  Used as a flag to soft delete a subscription item without
                  losing its history for auditability. If set, it will be
                  removed from the subscription items list and will not be
                  included in the billing period item list. Epoch milliseconds.
                anyOf:
                  - description: >-
                      Used as a flag to soft delete a subscription item without
                      losing its history for auditability. If set, it will be
                      removed from the subscription items list and will not be
                      included in the billing period item list. Epoch
                      milliseconds.
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  - type: 'null'
              manuallyCreated:
                type: boolean
              pricingModelId:
                type: string
              price:
                $ref: '#/components/schemas/PriceRecord'
            required:
              - id
              - createdAt
              - updatedAt
              - livemode
              - subscriptionId
              - name
              - addedDate
              - priceId
              - unitPrice
              - quantity
              - type
              - externalId
              - manuallyCreated
              - pricingModelId
              - price
            additionalProperties: false
        experimental:
          description: Experimental fields. May change without notice.
          type: object
          properties:
            featureItems:
              type: array
              items:
                $ref: >-
                  #/components/schemas/SubscriptionItemFeaturesClientSelectSchema
            usageMeterBalances:
              type: array
              items:
                description: >-
                  A usage meter and the available balance for that meter, scoped
                  to a given subscription.
                type: object
                properties:
                  id:
                    type: string
                  createdAt:
                    description: Epoch milliseconds.
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  updatedAt:
                    description: Epoch milliseconds.
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  livemode:
                    type: boolean
                  organizationId:
                    type: string
                  name:
                    description: The name of the usage meter
                    type: string
                    minLength: 1
                    maxLength: 255
                  pricingModelId:
                    type: string
                  slug:
                    description: The slug of the usage meter
                    type: string
                    minLength: 1
                    maxLength: 255
                  aggregationType:
                    description: >-
                      The type of aggregation to perform on the usage meter.
                      Defaults to "sum", which aggregates all the usage event
                      amounts for the billing period.
                      "count_distinct_properties" counts the number of distinct
                      properties in the billing period for a given meter.
                    type: string
                    enum:
                      - sum
                      - count_distinct_properties
                  availableBalance:
                    type: number
                  subscriptionId:
                    type: string
                required:
                  - id
                  - createdAt
                  - updatedAt
                  - livemode
                  - organizationId
                  - name
                  - pricingModelId
                  - slug
                  - aggregationType
                  - availableBalance
                  - subscriptionId
                additionalProperties: false
          required:
            - featureItems
            - usageMeterBalances
          additionalProperties: false
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - startDate
        - customerId
        - organizationId
        - status
        - defaultPaymentMethodId
        - backupPaymentMethodId
        - cancellationReason
        - replacedBySubscriptionId
        - isFreePlan
        - doNotCharge
        - priceId
        - runBillingAtPeriodStart
        - interval
        - intervalCount
        - name
        - renews
        - pricingModelId
        - current
        - subscriptionItems
      additionalProperties: false
    PurchaseInvoiceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        purchaseId:
          type: string
        invoiceNumber:
          type: string
        invoiceDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        billingPeriodId:
          description: Omitted.
          type: 'null'
        dueDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        customerId:
          type: string
        organizationId:
          type: string
        status:
          $ref: '#/components/schemas/InvoiceStatus'
        subscriptionId:
          description: Omitted.
          type: 'null'
        billingRunId:
          anyOf:
            - type: string
            - type: 'null'
        billingPeriodStartDate:
          description: Omitted.
          type: 'null'
        billingPeriodEndDate:
          description: Omitted.
          type: 'null'
        ownerMembershipId:
          anyOf:
            - type: string
            - type: 'null'
        pdfURL:
          anyOf:
            - type: string
              format: uri
            - type: 'null'
        receiptPdfURL:
          anyOf:
            - type: string
              format: uri
            - type: 'null'
        memo:
          anyOf:
            - type: string
            - type: 'null'
        bankPaymentOnly:
          anyOf:
            - type: boolean
            - type: 'null'
        type:
          type: string
          const: purchase
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        taxAmount:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        subtotal:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        taxType:
          anyOf:
            - anyOf:
                - type: string
                  enum:
                    - amusement_tax
                    - communications_tax
                    - gst
                    - hst
                    - igst
                    - jct
                    - lease_tax
                    - pst
                    - qst
                    - rst
                    - sales_tax
                    - vat
                    - none
                - type: 'null'
            - type: 'null'
        taxCountry:
          anyOf:
            - $ref: '#/components/schemas/CountryCode'
            - type: 'null'
        taxState:
          anyOf:
            - type: string
            - type: 'null'
        taxRatePercentage:
          anyOf:
            - type: string
            - type: 'null'
        applicationFee:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - purchaseId
        - invoiceNumber
        - invoiceDate
        - customerId
        - organizationId
        - status
        - billingRunId
        - ownerMembershipId
        - memo
        - bankPaymentOnly
        - type
        - currency
        - taxAmount
        - subtotal
        - taxState
        - taxRatePercentage
        - applicationFee
        - pricingModelId
      additionalProperties: false
    SubscriptionInvoiceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        purchaseId:
          description: Omitted.
          type: 'null'
        invoiceNumber:
          type: string
        invoiceDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        billingPeriodId:
          type: string
        dueDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        customerId:
          type: string
        organizationId:
          type: string
        status:
          $ref: '#/components/schemas/InvoiceStatus'
        subscriptionId:
          type: string
        billingRunId:
          anyOf:
            - type: string
            - type: 'null'
        billingPeriodStartDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        billingPeriodEndDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        ownerMembershipId:
          anyOf:
            - type: string
            - type: 'null'
        pdfURL:
          anyOf:
            - type: string
              format: uri
            - type: 'null'
        receiptPdfURL:
          anyOf:
            - type: string
              format: uri
            - type: 'null'
        memo:
          anyOf:
            - type: string
            - type: 'null'
        bankPaymentOnly:
          anyOf:
            - type: boolean
            - type: 'null'
        type:
          type: string
          const: subscription
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        taxAmount:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        subtotal:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        taxType:
          anyOf:
            - anyOf:
                - type: string
                  enum:
                    - amusement_tax
                    - communications_tax
                    - gst
                    - hst
                    - igst
                    - jct
                    - lease_tax
                    - pst
                    - qst
                    - rst
                    - sales_tax
                    - vat
                    - none
                - type: 'null'
            - type: 'null'
        taxCountry:
          anyOf:
            - $ref: '#/components/schemas/CountryCode'
            - type: 'null'
        taxState:
          anyOf:
            - type: string
            - type: 'null'
        taxRatePercentage:
          anyOf:
            - type: string
            - type: 'null'
        applicationFee:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - purchaseId
        - invoiceNumber
        - invoiceDate
        - billingPeriodId
        - customerId
        - organizationId
        - status
        - subscriptionId
        - billingRunId
        - ownerMembershipId
        - memo
        - bankPaymentOnly
        - type
        - currency
        - taxAmount
        - subtotal
        - taxState
        - taxRatePercentage
        - applicationFee
        - pricingModelId
      additionalProperties: false
    StandaloneInvoiceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        purchaseId:
          description: Omitted.
          type: 'null'
        invoiceNumber:
          type: string
        invoiceDate:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        billingPeriodId:
          description: Omitted.
          type: 'null'
        dueDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        stripePaymentIntentId:
          anyOf:
            - type: string
            - type: 'null'
        customerId:
          type: string
        organizationId:
          type: string
        status:
          $ref: '#/components/schemas/InvoiceStatus'
        subscriptionId:
          description: Omitted.
          type: 'null'
        billingRunId:
          anyOf:
            - type: string
            - type: 'null'
        billingPeriodStartDate:
          description: Omitted.
          type: 'null'
        billingPeriodEndDate:
          description: Omitted.
          type: 'null'
        ownerMembershipId:
          anyOf:
            - type: string
            - type: 'null'
        pdfURL:
          anyOf:
            - type: string
              format: uri
            - type: 'null'
        receiptPdfURL:
          anyOf:
            - type: string
              format: uri
            - type: 'null'
        memo:
          anyOf:
            - type: string
            - type: 'null'
        bankPaymentOnly:
          anyOf:
            - type: boolean
            - type: 'null'
        type:
          type: string
          const: standalone
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        taxAmount:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        subtotal:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        stripeTaxCalculationId:
          anyOf:
            - type: string
            - type: 'null'
        stripeTaxTransactionId:
          anyOf:
            - type: string
            - type: 'null'
        taxType:
          anyOf:
            - anyOf:
                - type: string
                  enum:
                    - amusement_tax
                    - communications_tax
                    - gst
                    - hst
                    - igst
                    - jct
                    - lease_tax
                    - pst
                    - qst
                    - rst
                    - sales_tax
                    - vat
                    - none
                - type: 'null'
            - type: 'null'
        taxCountry:
          anyOf:
            - $ref: '#/components/schemas/CountryCode'
            - type: 'null'
        taxState:
          anyOf:
            - type: string
            - type: 'null'
        taxRatePercentage:
          anyOf:
            - type: string
            - type: 'null'
        applicationFee:
          anyOf:
            - type: integer
              minimum: -2147483648
              maximum: 2147483647
            - type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - purchaseId
        - invoiceNumber
        - invoiceDate
        - billingPeriodId
        - stripePaymentIntentId
        - customerId
        - organizationId
        - status
        - subscriptionId
        - billingRunId
        - ownerMembershipId
        - memo
        - bankPaymentOnly
        - type
        - currency
        - taxAmount
        - subtotal
        - stripeTaxCalculationId
        - stripeTaxTransactionId
        - taxState
        - taxRatePercentage
        - applicationFee
        - pricingModelId
      additionalProperties: false
    StaticInvoiceLineItemClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        invoiceId:
          type: string
        quantity:
          type: integer
          minimum: -2147483648
          maximum: 2147483647
        priceId:
          anyOf:
            - type: string
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
        price:
          type: integer
          minimum: -2147483648
          maximum: 2147483647
        type:
          type: string
          const: static
        pricingModelId:
          type: string
        ledgerAccountId:
          type: 'null'
        ledgerAccountCredit:
          type: 'null'
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - invoiceId
        - quantity
        - priceId
        - description
        - price
        - type
        - pricingModelId
      additionalProperties: false
    UsageInvoiceLineItemClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        invoiceId:
          type: string
        quantity:
          type: integer
          minimum: -2147483648
          maximum: 2147483647
        priceId:
          anyOf:
            - type: string
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
        price:
          type: integer
          minimum: -2147483648
          maximum: 2147483647
        type:
          type: string
          const: usage
        pricingModelId:
          type: string
        billingRunId:
          type: string
        ledgerAccountId:
          type: string
        ledgerAccountCredit:
          type: number
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - invoiceId
        - quantity
        - priceId
        - description
        - price
        - type
        - pricingModelId
        - billingRunId
        - ledgerAccountId
        - ledgerAccountCredit
      additionalProperties: false
    Metadata:
      description: JSON object
      type: object
      propertyNames:
        type: string
      additionalProperties:
        anyOf:
          - type: string
            maxLength: 500
          - type: number
          - type: boolean
    SubscriptionPurchaseClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        name:
          type: string
        status:
          type: string
          enum:
            - open
            - pending
            - failed
            - paid
            - refunded
            - partial_refund
            - fraudulent
        customerId:
          type: string
        organizationId:
          type: string
        billingCycleAnchor:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        priceId:
          type: string
        quantity:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        priceType:
          type: string
          const: subscription
        trialPeriodDays:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        pricePerBillingCycle:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        intervalUnit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        intervalCount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        firstInvoiceValue:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        totalPurchaseValue:
          description: Omitted.
          type: 'null'
        bankPaymentOnly:
          anyOf:
            - type: boolean
            - type: 'null'
        purchaseDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        endDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        proposal:
          anyOf:
            - type: string
            - type: 'null'
        archived:
          anyOf:
            - type: boolean
            - type: 'null'
        billingAddress:
          anyOf:
            - $ref: '#/components/schemas/BillingAddress'
            - type: 'null'
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        pricingModelId:
          type: string
        position:
          type: number
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - name
        - status
        - customerId
        - organizationId
        - priceId
        - quantity
        - priceType
        - trialPeriodDays
        - pricePerBillingCycle
        - intervalUnit
        - intervalCount
        - firstInvoiceValue
        - totalPurchaseValue
        - bankPaymentOnly
        - proposal
        - archived
        - pricingModelId
        - position
      additionalProperties: false
    SinglePaymentPurchaseClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        name:
          type: string
        status:
          type: string
          enum:
            - open
            - pending
            - failed
            - paid
            - refunded
            - partial_refund
            - fraudulent
        customerId:
          type: string
        organizationId:
          type: string
        billingCycleAnchor:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        priceId:
          type: string
        quantity:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        priceType:
          type: string
          const: single_payment
        trialPeriodDays:
          description: Omitted.
          type: 'null'
        pricePerBillingCycle:
          description: Omitted.
          type: 'null'
        intervalUnit:
          description: Omitted.
          type: 'null'
        intervalCount:
          description: Omitted.
          type: 'null'
        firstInvoiceValue:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        totalPurchaseValue:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        bankPaymentOnly:
          anyOf:
            - type: boolean
            - type: 'null'
        purchaseDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        endDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        proposal:
          anyOf:
            - type: string
            - type: 'null'
        archived:
          anyOf:
            - type: boolean
            - type: 'null'
        billingAddress:
          anyOf:
            - $ref: '#/components/schemas/BillingAddress'
            - type: 'null'
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        pricingModelId:
          type: string
        position:
          type: number
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - name
        - status
        - customerId
        - organizationId
        - priceId
        - quantity
        - priceType
        - trialPeriodDays
        - pricePerBillingCycle
        - intervalUnit
        - intervalCount
        - firstInvoiceValue
        - totalPurchaseValue
        - bankPaymentOnly
        - proposal
        - archived
        - pricingModelId
        - position
      additionalProperties: false
    UsagePurchaseClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        name:
          type: string
        status:
          type: string
          enum:
            - open
            - pending
            - failed
            - paid
            - refunded
            - partial_refund
            - fraudulent
        customerId:
          type: string
        organizationId:
          type: string
        billingCycleAnchor:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        priceId:
          type: string
        quantity:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        priceType:
          type: string
          const: usage
        trialPeriodDays:
          description: Omitted.
          type: 'null'
        pricePerBillingCycle:
          description: Omitted.
          type: 'null'
        intervalUnit:
          description: Omitted.
          type: 'null'
        intervalCount:
          description: Omitted.
          type: 'null'
        firstInvoiceValue:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        totalPurchaseValue:
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        bankPaymentOnly:
          anyOf:
            - type: boolean
            - type: 'null'
        purchaseDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        endDate:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        proposal:
          anyOf:
            - type: string
            - type: 'null'
        archived:
          anyOf:
            - type: boolean
            - type: 'null'
        billingAddress:
          anyOf:
            - $ref: '#/components/schemas/BillingAddress'
            - type: 'null'
        metadata:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
        pricingModelId:
          type: string
        position:
          type: number
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - name
        - status
        - customerId
        - organizationId
        - priceId
        - quantity
        - priceType
        - trialPeriodDays
        - pricePerBillingCycle
        - intervalUnit
        - intervalCount
        - firstInvoiceValue
        - totalPurchaseValue
        - bankPaymentOnly
        - proposal
        - archived
        - pricingModelId
        - position
      additionalProperties: false
    ProductWithPricesRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        name:
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
        imageURL:
          anyOf:
            - type: string
            - type: 'null'
        organizationId:
          type: string
        active:
          type: boolean
        singularQuantityLabel:
          anyOf:
            - type: string
            - type: 'null'
        pluralQuantityLabel:
          anyOf:
            - type: string
            - type: 'null'
        pricingModelId:
          type: string
        default:
          type: boolean
        slug:
          description: Unique identifier for the product within its pricing model
          type: string
          minLength: 1
          maxLength: 255
        prices:
          type: array
          items:
            $ref: '#/components/schemas/PriceRecord'
        defaultPrice:
          $ref: '#/components/schemas/PriceRecord'
          description: >-
            The default price for the product. If no price is explicitly set as
            default, will return the first price created for the product..
        features:
          type: array
          items:
            $ref: '#/components/schemas/FeatureRecord'
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - name
        - description
        - imageURL
        - organizationId
        - active
        - singularQuantityLabel
        - pluralQuantityLabel
        - pricingModelId
        - default
        - slug
        - prices
        - defaultPrice
        - features
      additionalProperties: false
    UsageMeterWithPricesRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        name:
          description: The name of the usage meter
          type: string
          minLength: 1
          maxLength: 255
        pricingModelId:
          type: string
        slug:
          description: The slug of the usage meter
          type: string
          minLength: 1
          maxLength: 255
        aggregationType:
          description: >-
            The type of aggregation to perform on the usage meter. Defaults to
            "sum", which aggregates all the usage event amounts for the billing
            period. "count_distinct_properties" counts the number of distinct
            properties in the billing period for a given meter.
          type: string
          enum:
            - sum
            - count_distinct_properties
        prices:
          type: array
          items:
            $ref: '#/components/schemas/UsagePriceClientSelectSchema'
        defaultPrice:
          $ref: '#/components/schemas/UsagePriceClientSelectSchema'
          description: >-
            The default price for the usage meter. If no price is explicitly set
            as default, will return the first price.
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - name
        - pricingModelId
        - slug
        - aggregationType
        - prices
      additionalProperties: false
    PriceRecord:
      anyOf:
        - $ref: '#/components/schemas/SubscriptionPriceClientSelectSchema'
        - $ref: '#/components/schemas/SinglePaymentPriceClientSelectSchema'
        - $ref: '#/components/schemas/UsagePriceClientSelectSchema'
    SubscriptionItemFeaturesClientSelectSchema:
      oneOf:
        - $ref: '#/components/schemas/ToggleSubscriptionItemFeatureRecord'
        - $ref: '#/components/schemas/UsageCreditGrantSubscriptionItemFeatureRecord'
        - $ref: '#/components/schemas/ResourceSubscriptionItemFeatureRecord'
      type: object
      discriminator:
        propertyName: type
        mapping:
          toggle:
            $ref: '#/components/schemas/ToggleSubscriptionItemFeatureRecord'
          usage_credit_grant:
            $ref: '#/components/schemas/UsageCreditGrantSubscriptionItemFeatureRecord'
          resource:
            $ref: '#/components/schemas/ResourceSubscriptionItemFeatureRecord'
    InvoiceStatus:
      type: string
      enum:
        - draft
        - open
        - paid
        - uncollectible
        - void
        - refunded
        - partially_refunded
        - awaiting_payment_confirmation
    CurrencyCode:
      description: Currency code
      type: string
      enum:
        - USD
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLP
        - CNY
        - COP
        - CRC
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - ISK
        - JMD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KRW
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SEK
        - SGD
        - SHP
        - SLE
        - SOS
        - SRD
        - STD
        - SZL
        - THB
        - TJS
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - UYU
        - UZS
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
    CountryCode:
      description: ISO 3166-1 alpha-2 country code
      type: string
      enum:
        - AD
        - AE
        - AF
        - AG
        - AI
        - AL
        - AM
        - AO
        - AQ
        - AR
        - AS
        - AT
        - AU
        - AW
        - AX
        - AZ
        - BA
        - BB
        - BD
        - BE
        - BF
        - BG
        - BH
        - BI
        - BJ
        - BL
        - BM
        - BN
        - BO
        - BQ
        - BR
        - BS
        - BT
        - BV
        - BW
        - BY
        - BZ
        - CA
        - CC
        - CD
        - CF
        - CG
        - CH
        - CI
        - CK
        - CL
        - CM
        - CN
        - CO
        - CR
        - CU
        - CV
        - CW
        - CX
        - CY
        - CZ
        - DE
        - DJ
        - DK
        - DM
        - DO
        - DZ
        - EC
        - EE
        - EG
        - EH
        - ER
        - ES
        - ET
        - FI
        - FJ
        - FK
        - FM
        - FO
        - FR
        - GA
        - GB
        - GD
        - GE
        - GF
        - GG
        - GH
        - GI
        - GL
        - GM
        - GN
        - GP
        - GQ
        - GR
        - GS
        - GT
        - GU
        - GW
        - GY
        - HK
        - HM
        - HN
        - HR
        - HT
        - HU
        - ID
        - IE
        - IL
        - IM
        - IN
        - IO
        - IQ
        - IR
        - IS
        - IT
        - JE
        - JM
        - JO
        - JP
        - KE
        - KG
        - KH
        - KI
        - KM
        - KN
        - KP
        - KR
        - KW
        - KY
        - KZ
        - LA
        - LB
        - LC
        - LI
        - LK
        - LR
        - LS
        - LT
        - LU
        - LV
        - LY
        - MA
        - MC
        - MD
        - ME
        - MF
        - MG
        - MH
        - MK
        - ML
        - MM
        - MN
        - MO
        - MP
        - MQ
        - MR
        - MS
        - MT
        - MU
        - MV
        - MW
        - MX
        - MY
        - MZ
        - NA
        - NC
        - NE
        - NF
        - NG
        - NI
        - NL
        - 'NO'
        - NP
        - NR
        - NU
        - NZ
        - OM
        - PA
        - PE
        - PF
        - PG
        - PH
        - PK
        - PL
        - PM
        - PN
        - PR
        - PS
        - PT
        - PW
        - PY
        - QA
        - RE
        - RO
        - RS
        - RU
        - RW
        - SA
        - SB
        - SC
        - SD
        - SE
        - SG
        - SH
        - SI
        - SJ
        - SK
        - SL
        - SM
        - SN
        - SO
        - SR
        - SS
        - ST
        - SV
        - SX
        - SY
        - SZ
        - TC
        - TD
        - TF
        - TG
        - TH
        - TJ
        - TK
        - TL
        - TM
        - TN
        - TO
        - TR
        - TT
        - TV
        - TW
        - TZ
        - UA
        - UG
        - UM
        - US
        - UY
        - UZ
        - VA
        - VC
        - VE
        - VG
        - VI
        - VN
        - VU
        - WF
        - WS
        - XK
        - YE
        - YT
        - ZA
        - ZM
        - ZW
    FeatureRecord:
      oneOf:
        - $ref: '#/components/schemas/ToggleFeatureClientSelectSchema'
        - $ref: '#/components/schemas/UsageCreditGrantFeatureClientSelectSchema'
        - $ref: '#/components/schemas/ResourceFeatureClientSelectSchema'
      type: object
      discriminator:
        propertyName: type
        mapping:
          toggle:
            $ref: '#/components/schemas/ToggleFeatureClientSelectSchema'
          usage_credit_grant:
            $ref: '#/components/schemas/UsageCreditGrantFeatureClientSelectSchema'
          resource:
            $ref: '#/components/schemas/ResourceFeatureClientSelectSchema'
    UsagePriceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        intervalUnit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        name:
          anyOf:
            - type: string
            - type: 'null'
        intervalCount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        type:
          type: string
          const: usage
        trialPeriodDays:
          description: Omitted.
          type: 'null'
        isDefault:
          description: >-
            Whether or not this price is the default price. For product prices,
            this indicates the default price for that product. For usage prices,
            this indicates the default price for that usage meter.
          type: boolean
        unitPrice:
          description: >-
            The price per unit. This should be in the smallest unit of the
            currency. For example, if the currency is USD, GBP, CAD, EUR or SGD,
            the price should be in cents.
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        usageEventsPerUnit:
          description: >-
            The number of usage events per unit. Used to determine how to map
            usage events to quantities when raising invoices for usage.
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        productId:
          type: 'null'
        active:
          type: boolean
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        slug:
          anyOf:
            - type: string
            - type: 'null'
        usageMeterId:
          description: >-
            The usage meter that uses this price. All usage events on that meter
            must be associated with a price that is also associated with that
            usage meter.
          type: string
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - intervalUnit
        - name
        - intervalCount
        - type
        - trialPeriodDays
        - isDefault
        - unitPrice
        - usageEventsPerUnit
        - productId
        - active
        - currency
        - slug
        - usageMeterId
        - pricingModelId
      additionalProperties: false
    SubscriptionPriceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        intervalUnit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        name:
          anyOf:
            - type: string
            - type: 'null'
        intervalCount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        type:
          type: string
          const: subscription
        trialPeriodDays:
          description: >-
            The trial period in days. If the trial period is 0 or null, there
            will be no trial period.
          anyOf:
            - anyOf:
                - description: A positive integer
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
                - type: number
                  const: 0
            - type: 'null'
        isDefault:
          description: >-
            Whether or not this price is the default price. For product prices,
            this indicates the default price for that product. For usage prices,
            this indicates the default price for that usage meter.
          type: boolean
        unitPrice:
          description: >-
            The price per unit. This should be in the smallest unit of the
            currency. For example, if the currency is USD, GBP, CAD, EUR or SGD,
            the price should be in cents.
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        usageEventsPerUnit:
          description: Omitted.
          type: 'null'
        productId:
          description: The product this price belongs to. Required for subscription prices.
          type: string
        active:
          type: boolean
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        slug:
          anyOf:
            - type: string
            - type: 'null'
        usageMeterId:
          description: Omitted.
          type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - intervalUnit
        - name
        - intervalCount
        - type
        - isDefault
        - unitPrice
        - usageEventsPerUnit
        - productId
        - active
        - currency
        - slug
        - usageMeterId
        - pricingModelId
      additionalProperties: false
    SinglePaymentPriceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        intervalUnit:
          description: Omitted.
          type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        intervalCount:
          description: Omitted.
          type: 'null'
        type:
          type: string
          const: single_payment
        trialPeriodDays:
          description: Omitted.
          type: 'null'
        isDefault:
          description: >-
            Whether or not this price is the default price. For product prices,
            this indicates the default price for that product. For usage prices,
            this indicates the default price for that usage meter.
          type: boolean
        unitPrice:
          description: >-
            The price per unit. This should be in the smallest unit of the
            currency. For example, if the currency is USD, GBP, CAD, EUR or SGD,
            the price should be in cents.
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        usageEventsPerUnit:
          description: Omitted.
          type: 'null'
        productId:
          description: >-
            The product this price belongs to. Required for single payment
            prices.
          type: string
        active:
          type: boolean
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        slug:
          anyOf:
            - type: string
            - type: 'null'
        usageMeterId:
          description: Omitted.
          type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - name
        - type
        - isDefault
        - unitPrice
        - productId
        - active
        - currency
        - slug
        - pricingModelId
      additionalProperties: false
    ToggleSubscriptionItemFeatureRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        subscriptionItemId:
          type: string
        featureId:
          type: string
        productFeatureId:
          anyOf:
            - type: string
            - type: 'null'
        type:
          type: string
          const: toggle
        amount:
          type: 'null'
          const: null
        usageMeterId:
          type: 'null'
          const: null
        renewalFrequency:
          type: 'null'
          const: null
        expiredAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        detachedAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        detachedReason:
          anyOf:
            - type: string
            - type: 'null'
        manuallyCreated:
          type: boolean
        pricingModelId:
          type: string
        resourceId:
          type: 'null'
          const: null
        name:
          type: string
        slug:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - subscriptionItemId
        - featureId
        - type
        - manuallyCreated
        - pricingModelId
        - name
        - slug
      additionalProperties: false
    UsageCreditGrantSubscriptionItemFeatureRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        subscriptionItemId:
          type: string
        featureId:
          type: string
        productFeatureId:
          anyOf:
            - type: string
            - type: 'null'
        type:
          type: string
          const: usage_credit_grant
        amount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        usageMeterId:
          type: string
        renewalFrequency:
          type: string
          enum:
            - once
            - every_billing_period
        expiredAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        detachedAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        detachedReason:
          anyOf:
            - type: string
            - type: 'null'
        manuallyCreated:
          type: boolean
        pricingModelId:
          type: string
        resourceId:
          type: 'null'
          const: null
        name:
          type: string
        slug:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - subscriptionItemId
        - featureId
        - type
        - amount
        - usageMeterId
        - renewalFrequency
        - manuallyCreated
        - pricingModelId
        - name
        - slug
      additionalProperties: false
    ResourceSubscriptionItemFeatureRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        subscriptionItemId:
          type: string
        featureId:
          type: string
        productFeatureId:
          anyOf:
            - type: string
            - type: 'null'
        type:
          type: string
          const: resource
        amount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        usageMeterId:
          type: 'null'
          const: null
        renewalFrequency:
          type: 'null'
          const: null
        expiredAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        detachedAt:
          anyOf:
            - description: Epoch milliseconds.
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        detachedReason:
          anyOf:
            - type: string
            - type: 'null'
        manuallyCreated:
          type: boolean
        pricingModelId:
          type: string
        resourceId:
          type: string
        name:
          type: string
        slug:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - subscriptionItemId
        - featureId
        - type
        - amount
        - manuallyCreated
        - pricingModelId
        - resourceId
        - name
        - slug
      additionalProperties: false
    ToggleFeatureClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        type:
          type: string
          const: toggle
        slug:
          type: string
          minLength: 1
          maxLength: 255
        name:
          type: string
        description:
          type: string
        amount:
          type: 'null'
          const: null
        usageMeterId:
          type: 'null'
          const: null
        renewalFrequency:
          type: 'null'
          const: null
        pricingModelId:
          type: string
        resourceId:
          type: 'null'
          const: null
        active:
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - type
        - slug
        - name
        - description
        - pricingModelId
        - active
      additionalProperties: false
    UsageCreditGrantFeatureClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        type:
          type: string
          const: usage_credit_grant
        slug:
          type: string
          minLength: 1
          maxLength: 255
        name:
          type: string
        description:
          type: string
        amount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        usageMeterId:
          type: string
        renewalFrequency:
          type: string
          enum:
            - once
            - every_billing_period
        pricingModelId:
          type: string
        resourceId:
          type: 'null'
          const: null
        active:
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - type
        - slug
        - name
        - description
        - amount
        - usageMeterId
        - renewalFrequency
        - pricingModelId
        - active
      additionalProperties: false
    ResourceFeatureClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        type:
          type: string
          const: resource
        slug:
          type: string
          minLength: 1
          maxLength: 255
        name:
          type: string
        description:
          type: string
        amount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        usageMeterId:
          type: 'null'
          const: null
        renewalFrequency:
          type: 'null'
          const: null
        pricingModelId:
          type: string
        resourceId:
          type: string
        active:
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - type
        - slug
        - name
        - description
        - amount
        - pricingModelId
        - resourceId
        - active
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````