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

# 获取充值发票 API：追踪银行转账

> 查询 Didit 充值发票：了解其状态、已到账金额、已计入余额的部分，以及仍待通过银行转账付款的金额。

Didit 的获取充值发票 API 会返回您的某张充值发票的当前状态，帮助您的财务自动化流程了解该发票是否已支付、还有哪些内容待发送，以及已有多少金额计入您的余额。
使用[创建充值发票](https://docs.didit.me/zh/management-api/billing/create-top-up-invoice.md)来创建发票。

获取充值发票提示
        将提示词复制到剪贴板



      
      

\<pre>

\`Goal: Read a Didit top-up invoice to know whether it is paid, what is still to send and what was added to the balance.

Endpoint: GET https://verification.didit.me/v3/billing/top-up-invoices/{top_up_id}/
Auth header: x-api-key: <DIDIT_API_KEY>
top_up_id: the id returned by POST /v3/billing/top-up-invoices/.

curl:
curl 'https://verification.didit.me/v3/billing/top-up-invoices/9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47/' \
-H 'x-api-key: YOUR_API_KEY'

Response 200: the same invoice body as the create call, in its current state.
Settle on status and the amounts: open (waiting), part_paid (send amount_open with the same reference before due_at), paid (credit_amount was added), expired (due_at passed; what arrived stays added), cancelled (cancelled in the console before anything arrived), failed (never issued, nothing owed).
confirmed_at is the latest confirmed transfer, a part payment included; closed_at is null for a paid invoice. Never use them to decide settlement. Give payment instructions only while status is open or part_paid and amount_open is above 0, and stop polling once status is paid, expired, cancelled or failed. Use due_at as returned: new invoices are due 45 days after issue, older ones keep their own date.
404 top_up_not_found for an id that is not one of the organization's top-up invoices; 404 billing_not_available when billing is not available yet.`

\</pre>



      
      

粘贴到

## 读取状态与金额| `status` | 含义 |
| - | - |
| `open` | 等待转账。 |
| `part_paid` | `total` 的一部分已到账，并已将对应的额度计入余额。请在 `due_at` 之前，使用相同的付款参考转入 `amount_open`。 |
| `paid` | `total` 已全部到账，`credit_amount` 已计入余额。 |
| `expired` | `due_at` 已过，而 `total` 尚未全部到账。已到账的部分保持计入；此后仍以该付款参考到账的转账，将按其实付金额计入。 |
| `cancelled` | 有人在控制台中取消了该发票，且取消前没有任何款项到账。 |
| `failed` | 发票未能开具。无需付款。 |- `amount_received` 为已到账金额，`amount_credited` 为已计入您余额的金额，`amount_open` 为仍需转账的金额。
- 仅当发票可接收转账（`open` 或 `part_paid`）时，才会返回 `bank_details`。只有在此时且 `amount_open` 大于零时，才提供付款说明。
- 一旦 `status` 为 `paid`、`expired`、`cancelled` 或 `failed`，即停止跟进该发票。
- `due_at` 为发票上载明的日期，请按返回值原样使用。新发票自开具之日起 45 天到期；按早前条款开具的发票保留其原有到期日。
- 判断结算情况时，以 `status` 和各项金额为准。`confirmed_at` 为最近一次已确认转账的时间（包括部分付款），对已付款发票，`closed_at` 为 null。## 错误| HTTP | `code` | 含义 |
| - | - | - |
| 404 | `top_up_not_found` | 您的组织下没有使用此 ID 的充值发票。 |
| 404 | `billing_not_available` | 您的组织尚不可使用计费功能。 |


## OpenAPI

````yaml zh/openapi-25.json GET /v3/billing/top-up-invoices/{top_up_id}/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: 身份验证 API。使用 x-api-key 请求头进行身份验证。
servers:
  - url: https://verification.didit.me
security: []
tags:
  - name: Bank Data
    description: >-
      Bank
      Link、连接、账户、余额、交易、机构和覆盖范围。对真实银行的一次性读取已向生产环境中的应用开放。与真实银行的持续访问目前尚未向生产环境中的应用开放：它可用于沙盒应用，通过
      Didit Test Bank 提供，并将按国家/地区逐步开放。沙盒中不收费。使用 API
      密钥发起的调用需要能够访问银行数据的密钥：完全访问密钥可以访问，而限定范围的密钥需要在 scopes 中包含 `bank-data`（读取类请求需要
      read，改变数据的操作需要 write）。缺少该范围的限定范围密钥会被拒绝，调用返回 `403
      bank_data_access_denied`。账户检查是例外：它需要对会话的写入权限或完全访问权限，而不需要 Bank data
      范围。原始银行数据（账户、余额、交易和变更信息流）同样会拒绝未携带 API 密钥的请求。


      除账户检查外，`/v3/bank/` 下的所有拒绝响应都具有相同的 JSON
      响应体（`code`、`message`、`request_id`、`field`、`next_action`、`retry_after`）。不是操作的路径、不是
      UUID 的 ID 或未知的子资源，对所有方法都返回 `404 not_found`。任何意外错误都返回 `500 internal_error`
      并附带 `request_id`。在银行数据不可用的情况下，每个操作都会返回平台的标准 `404`，与未知路由的返回完全相同。
paths:
  /v3/billing/top-up-invoices/{top_up_id}/:
    get:
      tags:
        - Billing
      summary: 获取充值发票
      description: >-
        读取组织的某张充值发票：其
        `status`、已到账金额（`amount_received`）、已计入余额的金额（`amount_credited`）、仍需支付的金额（`amount_open`），以及在仍可接受转账时的
        `bank_details`。请以 `status` 和金额为准，而不是时间戳；当 `status` 为
        `paid`、`expired`、`cancelled` 或 `failed` 时，即停止跟进。
      operationId: billing_top_up_invoices_retrieve
      parameters:
        - name: top_up_id
          in: path
          required: true
          description: 发票的 `id`，来自 `POST /v3/billing/top-up-invoices/`。
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: 发票当前状态。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingTopUpInvoice'
              examples:
                Open:
                  value:
                    id: 9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47
                    lane: bank_transfer
                    status: open
                    credit_amount: '5000.00'
                    total: '5000.00'
                    tax: '0.00'
                    currency: usd
                    amount_received: '0.00'
                    amount_credited: '0.00'
                    amount_open: '5000.00'
                    presented: null
                    method:
                      type: customer_balance
                      name: Bank transfer
                    invoice_number: 7F3A2C1B-0012
                    hosted_invoice_url: https://invoice.example.com/i/7F3A2C1B-0012
                    invoice_pdf: https://invoice.example.com/i/7F3A2C1B-0012/pdf
                    po_number: PO-88213
                    due_at: '2027-01-14T10:00:00Z'
                    confirmed_at: null
                    closed_at: null
                    failure_reason: null
                    created_at: '2026-11-30T10:00:00Z'
                    bank_details:
                      currency: USD
                      amount_due: '5000.00'
                      account_holder_name: Didit
                      bank_name: Example Bank, N.A.
                      account_number: '000123456789'
                      routing_number: '000000000'
                      swift_code: EXAMUS33XXX
                      reference: 7F3A2C1B-0012
                Part paid:
                  value:
                    id: 9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47
                    lane: bank_transfer
                    status: part_paid
                    credit_amount: '1000.00'
                    total: '1100.00'
                    tax: '100.00'
                    currency: usd
                    amount_received: '550.00'
                    amount_credited: '500.00'
                    amount_open: '550.00'
                    presented: null
                    method:
                      type: customer_balance
                      name: Bank transfer
                    invoice_number: 7F3A2C1B-0012
                    hosted_invoice_url: https://invoice.example.com/i/7F3A2C1B-0012
                    invoice_pdf: https://invoice.example.com/i/7F3A2C1B-0012/pdf
                    po_number: null
                    due_at: '2027-01-14T10:00:00Z'
                    confirmed_at: '2026-12-04T09:12:00Z'
                    closed_at: null
                    failure_reason: null
                    created_at: '2026-11-30T10:00:00Z'
                    bank_details:
                      currency: USD
                      amount_due: '550.00'
                      account_holder_name: Didit
                      bank_name: Example Bank, N.A.
                      account_number: '000123456789'
                      routing_number: '000000000'
                      swift_code: EXAMUS33XXX
                      reference: 7F3A2C1B-0012
        '401':
          description: API 密钥或应用的访问令牌已过期或被撤销：请更换凭证。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceDetailError'
              examples:
                Expired key:
                  value:
                    detail: This API key has expired.
        '403':
          description: 未发送任何凭证，或该凭证无法在此组织中使用充值发票。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceDetailError'
              examples:
                No credential:
                  value:
                    detail: Authentication credentials were not provided.
        '404':
          description: >-
            `top_up_not_found`：该组织下没有此 ID
            对应的充值发票。`billing_not_available`：该组织暂时无法使用账单功能。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceError'
              examples:
                Not found:
                  value:
                    code: top_up_not_found
                    detail: Top-up not found.
        '429':
          description: 超出速率限制；请退避，并在 `Retry-After` 指示的时间间隔后重试。
          content:
            application/json:
              examples:
                Throttled:
                  value:
                    detail: >-
                      GET request rate limit exceeded. You can make up to 600
                      requests per minute.
                    reference: RL-00000000000040008000000000000001
                    limit: 600
                    remaining: 0
                    reset: 1794358860
                    window_seconds: 60
              schema:
                $ref: '#/components/schemas/RateLimitBudgetError'
          headers:
            Retry-After:
              $ref: '#/components/headers/BudgetRetryAfter'
            X-RateLimit-Scope:
              $ref: '#/components/headers/BudgetXRateLimitScope'
            X-RateLimit-Limit:
              $ref: '#/components/headers/BudgetXRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/BudgetXRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/BudgetXRateLimitReset'
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl
            'https://verification.didit.me/v3/billing/top-up-invoices/9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47/'
            \
              -H 'x-api-key: YOUR_API_KEY'
components:
  schemas:
    BillingTopUpInvoice:
      type: object
      description: 通过银行转账支付的充值发票，与控制台“充值”对话框签发的发票相同。请通过 `status` 和金额了解其当前状态；时间戳仅记录事件。
      required:
        - id
        - lane
        - status
        - credit_amount
        - total
        - tax
        - currency
        - amount_received
        - amount_credited
        - amount_open
        - created_at
      properties:
        id:
          type: string
          format: uuid
          description: 发票标识符：请使用 `GET /v3/billing/top-up-invoices/{top_up_id}/` 重新读取。
        lane:
          type: string
          enum:
            - bank_transfer
          description: 始终为 `bank_transfer`。
        status:
          type: string
          enum:
            - open
            - part_paid
            - paid
            - expired
            - cancelled
            - failed
          description: >-
            `open`：等待转账。`part_paid`：已收到部分 `total`，并已将对应比例的额度计入账户；请在 `due_at`
            之前使用相同的备注发送 `amount_open`。`paid`：已收到全部 `total`，并已计入
            `credit_amount`。`expired`：在收到全部 `total` 之前已超过
            `due_at`；已收到的金额仍会计入账户，之后带有该备注的转账仍会按其金额计入。`cancelled`：在收到任何款项之前，有人通过控制台取消了该发票（款项到账后，发票无法再取消）。`failed`：发票未能开具；未开具任何发票。
        credit_amount:
          type: string
          description: '`total` 全额付清时添加到余额中的金额，以美元计，不含税。'
          example: '5000.00'
        total:
          type: string
          description: 发票要求支付的金额，以美元计，含税。可能高于 `credit_amount`。
          example: '5000.00'
        tax:
          type: string
          description: 发票上的税款，以美元计。无适用税款时为 `0.00`。
          example: '5000.00'
        currency:
          type: string
          enum:
            - usd
          description: 始终为 `usd`。
        amount_received:
          type: string
          description: 目前已到账的金额，以美元计。
          example: '5000.00'
        amount_credited:
          type: string
          description: >-
            截至目前已计入余额的金额（以美元计）。部分付款会按其支付的 `total` 所占比例增加额度：对于 1,100.00 的发票，支付
            550.00，对应 1,000.00 的额度，会增加 500.00。
          example: '5000.00'
        amount_open:
          type: string
          description: >-
            当 `status` 为 `open` 或 `part_paid` 时仍需支付的金额，以美元计：请严格转入此金额，并以
            `invoice_number` 作为备注。发票结清后忽略此字段。
          example: '5000.00'
        presented:
          type: object
          nullable: true
          description: 充值发票中始终为 null。
          properties:
            amount:
              type: string
            currency:
              type: string
        method:
          type: object
          nullable: true
          description: 付款方式，与计费历史中的名称一致。
          properties:
            type:
              type: string
              example: customer_balance
            name:
              type: string
              example: Bank transfer
        invoice_number:
          type: string
          nullable: true
          description: 发票编号。请将其作为备注填入转账中：没有该编号的转账无法与发票匹配。
        hosted_invoice_url:
          type: string
          format: uri
          nullable: true
          description: 发票页面，含银行信息。
        invoice_pdf:
          type: string
          format: uri
          nullable: true
          description: PDF 格式的发票。
        po_number:
          type: string
          nullable: true
          description: 发票上印制的采购订单号（若已提交）。
        due_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            发票上列明的到期日。请使用该值，切勿自行计算。新发票自开具之日起 45 天到期；按早期条款开具的发票保留其开具时的到期日。若到期时
            `total` 未全部到账，状态变为 `expired`；已付清的发票保持 `paid`。
        confirmed_at:
          type: string
          format: date-time
          nullable: true
          description: 最近一笔转账得到确认的时间，包括部分付款。这并不表示发票已结清：请查看 `status` 和 `amount_open`。
        closed_at:
          type: string
          format: date-time
          nullable: true
          description: 发票失败、过期或被取消的时间。对于未付款、部分付款或已付清的发票，为 null。
        failure_reason:
          type: string
          nullable: true
          description: 失败或过期的原因，以及失败或过期的时间。
        created_at:
          type: string
          format: date-time
          description: 签发时间。
        bank_details:
          type: object
          nullable: true
          description: >-
            用于接收转账的收款信息，在发票可以接收转账（`open` 或
            `part_paid`）期间提供。发票关闭后为空；当前无法读取银行信息时也为空，此时请使用
            `hosted_invoice_url`，其中同样会显示银行信息。出错时不包含在 `open_invoice` 中。
          required:
            - currency
            - amount_due
            - account_holder_name
            - bank_name
            - account_number
            - routing_number
            - swift_code
            - reference
          properties:
            currency:
              type: string
              description: 始终为 `USD`。
            amount_due:
              type: string
              description: 需支付的金额，以美元计：与 `amount_open` 相同。
            account_holder_name:
              type: string
              description: 收款账户。
            bank_name:
              type: string
              description: 收款银行。
            account_number:
              type: string
              description: 收款账号。
            routing_number:
              type: string
              description: 适用于 ACH 和美国电汇。
            swift_code:
              type: string
              description: 适用于国际电汇。
            reference:
              type: string
              description: 发票编号。必须包含在转账中。
    TopUpInvoiceDetailError:
      type: object
      description: 拒绝响应，仅包含 `detail`：凭据已过期或已撤销（401）、缺少密钥或凭据缺少相应权限（403），或请求体不是有效 JSON（400）。
      required:
        - detail
      additionalProperties: false
      properties:
        detail:
          type: string
          description: 供人阅读的说明。
    TopUpInvoiceError:
      type: object
      description: 充值发票请求的错误响应体。
      required:
        - code
        - detail
      properties:
        code:
          type: string
          enum:
            - idempotency_key_required
            - billing_details_required
            - top_up_invoice_open
            - idempotency_key_conflict
            - top_up_not_allowed
            - top_up_not_completed
            - billing_customer_missing
            - billing_not_available
            - top_up_not_found
            - payment_provider_error
          description: 稳定的错误代码。
        detail:
          type: string
          description: 供人阅读的说明。
        missing:
          type: array
          items:
            type: string
          description: >-
            对于 `billing_details_required`：仍需保存的计费信息，例如 `legal_name` 或
            `address.line1`。
        open_invoice:
          description: >-
            对于 `top_up_invoice_open`：处于 open 或 part paid 状态的发票，不含
            `bank_details`（请读取该发票以获取付款信息）。若在回答写入前已关闭，则为 null：请重新创建发票。
          oneOf:
            - $ref: '#/components/schemas/BillingTopUpInvoice'
            - $ref: '#/components/schemas/TopUpInvoiceNoOpenInvoice'
    RateLimitBudgetError:
      type: object
      description: 仅在速率限制中间件预算拒绝时返回。其他 429 错误（包括幂等性冲突和端点特定上限）不保证返回这些元数据字段。
      required:
        - detail
        - reference
        - limit
        - remaining
        - reset
        - window_seconds
      properties:
        detail:
          type: string
          description: 已有的可读预算拒绝信息。
        reference:
          type: string
          pattern: ^RL-[0-9a-f]{32}$
          description: 不透明的支持参考编号：RL- 后跟 32 个小写 UUID 十六进制字符。
        limit:
          type: integer
          description: 超出限额的作用域对应的预算；与 X-RateLimit-Limit 相同。
        remaining:
          type: integer
          minimum: 0
          description: 剩余额度，下限为零；与 X-RateLimit-Remaining 相同。
        reset:
          type: integer
          format: int64
          description: 窗口重置时间，以 Unix 秒表示；与 X-RateLimit-Reset 相同。
        window_seconds:
          type: integer
          description: 固定窗口时长（秒），不是剩余等待时间。重试前请遵循 Retry-After。
      example:
        detail: >-
          Write request rate limit exceeded. You can make up to 300 requests per
          minute.
        reference: RL-00000000000040008000000000000001
        limit: 300
        remaining: 0
        reset: 1794358860
        window_seconds: 60
    TopUpInvoiceNoOpenInvoice:
      description: 没有发票：处于 open 状态的发票在回答写入前已关闭。
      enum:
        - null
      nullable: true
  headers:
    BudgetRetryAfter:
      description: 需等待的秒数，向上取整到下一个时间窗口。出现在中间件预算拒绝响应中。
      schema:
        type: integer
    BudgetXRateLimitScope:
      description: 已超出预算的范围。出现在中间件预算拒绝响应中。
      schema:
        type: string
    BudgetXRateLimitLimit:
      description: 超出限额的作用域的预算；与请求体限制相同。出现在中间件预算拒绝响应中。
      schema:
        type: integer
    BudgetXRateLimitRemaining:
      description: 剩余额度，下限为零；与响应体中的 remaining 相同。仅出现在中间件额度拒绝的响应中。
      schema:
        type: integer
    BudgetXRateLimitReset:
      description: 以 Unix 秒表示的重置时间；与正文中的 reset 相同。出现在中间件预算拒绝响应中。
      schema:
        type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        您的应用 API 密钥，可在 Business Console 的开发者 -> API
        密钥中获取。主密钥拥有完全访问权限。命名密钥可以设置范围：可按资源设置无权限、只读或读写，可限定为部分工作流或已批准的会话，可限定为一组 IP
        地址，并可设置过期日期。401 表示密钥错误、已被撤销或已过期；403 表示未发送密钥、密钥无权访问该资源或执行该操作，或请求来自其 IP
        列表之外的地址；会话相关路由返回 404，表示该会话不在密钥的工作流或状态范围内。没有媒体访问权限的密钥会将图片、视频和 PDF 的 URL
        返回为 null；没有会话写入权限的密钥会将会话链接和令牌返回为 null。请参阅
        https://docs.didit.me/console/api-keys。
    BearerAuth:
      type: http
      scheme: bearer
      description: 应用的客户端凭证访问令牌。

````

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