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

# Preview pending charges that will bill on the final invoice if not waived

> Return the queued (uninvoiced) Stripe invoice items for this workspace's customer.

Used by ``CancelPanel`` to surface orphan prorations BEFORE the user confirms
cancellation — a queued $134 charge from a prior plan-switch will still flush
onto the final cycle invoice unless explicitly waived via
``cancel?waive_pending_charges=true``.

Implementation note: uses ``InvoiceItem.list(pending=True)`` directly rather
than ``Invoice.create_preview`` because the latter conflates renewal recurring
line items with prorations and requires brittle line-flag classification on
Stripe API ``2025-03-31.basil`` (see comment on ``preview_change_plan``).



## OpenAPI

````yaml /openapi.json get /api/v1/workspaces/{workspace_id}/billing/cancel/preview
openapi: 3.1.0
info:
  description: Change Impact Engine for multi-repo systems
  title: Riftmap
  version: 1.12.2
servers: []
security: []
paths:
  /api/v1/workspaces/{workspace_id}/billing/cancel/preview:
    get:
      tags:
        - billing
      summary: >-
        Preview pending charges that will bill on the final invoice if not
        waived
      description: >-
        Return the queued (uninvoiced) Stripe invoice items for this workspace's
        customer.


        Used by ``CancelPanel`` to surface orphan prorations BEFORE the user
        confirms

        cancellation — a queued $134 charge from a prior plan-switch will still
        flush

        onto the final cycle invoice unless explicitly waived via

        ``cancel?waive_pending_charges=true``.


        Implementation note: uses ``InvoiceItem.list(pending=True)`` directly
        rather

        than ``Invoice.create_preview`` because the latter conflates renewal
        recurring

        line items with prorations and requires brittle line-flag classification
        on

        Stripe API ``2025-03-31.basil`` (see comment on
        ``preview_change_plan``).
      operationId: >-
        preview_cancel_api_v1_workspaces__workspace_id__billing_cancel_preview_get
      parameters:
        - in: path
          name: workspace_id
          required: true
          schema:
            format: uuid
            title: Workspace Id
            type: string
        - in: header
          name: X-Workspace-Id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Workspace-Id
        - in: cookie
          name: riftmap_access
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Riftmap Access
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelPreviewResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    CancelPreviewResponse:
      description: >-
        Pending charges that will be billed on the final cycle invoice if not
        waived.


        ``pending_total`` includes credits (negative items); ``pending_items``
        shows

        only positive lines so the UI surfaces what the user will actually pay.
      properties:
        currency:
          title: Currency
          type: string
        next_invoice_date:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Next Invoice Date
        pending_items:
          items:
            $ref: '#/components/schemas/PendingInvoiceItem'
          title: Pending Items
          type: array
        pending_total:
          title: Pending Total
          type: integer
      required:
        - pending_total
        - pending_items
        - next_invoice_date
        - currency
      title: CancelPreviewResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    PendingInvoiceItem:
      description: A queued (uninvoiced) Stripe invoice item — typically a proration.
      properties:
        amount:
          title: Amount
          type: integer
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        id:
          title: Id
          type: string
        period_end:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Period End
        period_start:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Period Start
      required:
        - id
        - description
        - amount
        - period_start
        - period_end
      title: PendingInvoiceItem
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-Key
      type: apiKey
    HTTPBearer:
      description: API key as Bearer token (rfm_live_... prefix)
      scheme: bearer
      type: http

````