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

# 获取发票详情

> 查询发票详情

查询发票详情


## OpenAPI

````yaml openapi/v1-zh.yaml GET /api/v1/invoices/{invoice_id}
openapi: 3.0.3
info:
  title: Subotiz API
  description: Subotiz OpenAPI
  version: 1.0.0
servers:
  - url: https://{api}.subotiz.com
    variables:
      api:
        default: api
security:
  - sec0: []
tags:
  - name: 折扣
    description: 折扣
  - name: 发票
    description: 发票
  - name: 退款
    description: 退款
  - name: 商品管理
    description: 商品管理
  - name: 订阅
    description: 订阅
  - name: 商品定价
    description: 商品定价方案
  - name: 交易单
    description: 交易单
  - name: 支付流水
    description: 支付流水
  - name: 结账会话
    description: 结账会话
  - name: 顾客
    description: 顾客
  - name: 顾客门户
    description: 顾客门户
  - name: Webhook
    description: Webhook
  - name: 争议
    description: 争议订单
paths:
  /api/v1/invoices/{invoice_id}:
    get:
      tags:
        - 发票
      summary: 获取发票详情
      description: 查询发票详情
      operationId: v1-invoice-get-invoice
      parameters:
        - name: invoice_id
          in: path
          description: 发票ID
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/HeaderRequestID'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetInvoiceResponse'
components:
  parameters:
    HeaderRequestID:
      name: Request-Id
      in: header
      description: 请求的唯一标识符
      required: true
      schema:
        type: string
        default: 008e3967-a1b5-48bb-be14-d5bff5092e61
  schemas:
    GetInvoiceResponse:
      type: object
      properties:
        code:
          type: string
          description: error code
        message:
          type: string
          description: error message
        data:
          $ref: '#/components/schemas/GetInvoiceResponse_Data'
    GetInvoiceResponse_Data:
      type: object
      properties:
        invoice_id:
          type: string
          description: 发票ID
        merchant_id:
          type: string
          description: 商家ID
        trade_id:
          type: string
          description: 交易单ID
        subscription_id:
          type: string
          description: 订阅ID
        price_id:
          type: string
          description: 定价ID
        customer_id:
          type: string
          description: 顾客ID
        order_id:
          type: string
          description: 三方订单ID
        original_invoice_id:
          type: string
          description: 原始发票 ID，可用于在退款发票中查询订单原始发票
        refund_order_id:
          type: string
          description: 关联的退款单ID
        amount:
          type: string
          description: 支付金额，截断到2小数字
        currency:
          type: string
          description: 货币
        biz_status:
          type: string
          description: |-
            发票状态
            - open: 初始化
            - pending: 处理中
            - retrying: 等待重试
            - success: 支付成功
            - failed: 支付失败
            - refunded: 全部退款
            - partially_refunded: 部分退款
        invoice_type:
          type: string
          description: |-
            发票类型
            - initial: 首次支付
            - trial: 试用期
            - renewal: 订阅续订
            - refund: 退款
        paid_at:
          type: string
          description: 支付成功时间
        cycle_index:
          type: integer
          description: 当前所处的订阅周期
          format: int32
        created_at:
          type: string
          description: 创建时间
        metadata:
          type: object
          additionalProperties:
            type: string
          description: 一组可附加到对象上的键值对，允许您以结构化格式存储附加信息。
        Discounts:
          allOf:
            - $ref: '#/components/schemas/Discounts'
          description: 发票上的折扣，包括此发票的所有折扣信息
        price_version_id:
          type: string
          description: 定价方案版本 ID
        tax_amount:
          type: string
          description: 税额
        quantity:
          type: string
          description: 计费数量（席位数）；按使用量计费(billing_dimension=usage)时为 null
        quantity_unit:
          type: string
          description: 数量单位名称（商品级，默认 unit）
        payment_timing:
          type: string
          description: 付费时机：prepaid-预付费 / postpaid-后付费
        billing_dimension:
          type: string
          description: 计费维度：quantity-按购买量(席位) / usage-按用量 / mixed-混合(预留)
        price_type:
          type: string
          description: 价格结构：flat_price / package_price / tiers_price（存量只读可含 based_on_usage）
        quantity_tier_type:
          type: string
          description: 购买量侧阶梯子型：common / volume / grading
        price_tier_type:
          type: string
          description: 用量侧阶梯子型：common / volume / grading
        usage_amount:
          type: string
          description: 资源包用量（套餐含量，price_type=package_price 时透出；非本期实耗）
        unit_price:
          type: string
          description: 计费单价（每单位单价；阶梯落档时为落档单价）
        tier_breakdown:
          type: array
          items:
            $ref: '#/components/schemas/TierBreakdown'
          description: 试算分档明细（tiers_price 计费时透出每档量/单价/固定费/小计）
        usage:
          type: string
          description: 本期实耗用量（后付费 billing_dimension=usage 时透出；与导出 json:"usage"、用量上报接口语义对齐）
        merchant_price_id:
          type: string
          description: 该发票所属定价的商户侧定价 ID，返回商户当前配置值；取不到返回空串
    Discounts:
      type: object
      properties:
        current_period:
          type: array
          items:
            $ref: '#/components/schemas/CurrentPeriodDiscount'
          description: 当前时期的折扣详情
      description: 交易订单折扣信息
    TierBreakdown:
      type: object
      properties:
        tier_order:
          type: integer
          description: 档序，从 1 开始
          format: uint32
        quantity_min:
          type: string
          description: 该档下限
        quantity_max:
          type: string
          description: 该档上限；空表示 ∞
        units_in_tier:
          type: string
          description: 落入该档的数量/用量
        unit_price:
          type: string
          description: 该档单价
        flat_amount:
          type: string
          description: 该档固定费（与定价存储 flat_amount 同名）
        subtotal:
          type: string
          description: 该档小计
      description: |-
        试算分档明细（tier_breakdown[]，仅发票/结账 Calculate 结果透出，非定价配置）
         区间字段统一用 quantity_min/quantity_max（无独立落库表；用量维度由父级 billing_dimension 解释）
    CurrentPeriodDiscount:
      type: object
      properties:
        discount_id:
          type: string
          description: 折扣的唯一标识符
        discount_amount:
          type: string
          description: 折扣金额
        discount_code:
          type: string
          description: 使用的折扣代码
      description: 当前时期应用的折扣详情
  securitySchemes:
    sec0:
      type: http
      description: 'Bearer API Key 鉴权。格式：Authorization: Bearer {your_api_key}'
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.