> ## 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.

# 提交数字凭证钱包响应 | Didit 数字身份钱包 API

> 将 Google Wallet 等数字凭证 API 钱包返回的凭证响应提交到您的页面或应用，由 Didit 完成验证决策。

对于启动响应中带有 `next_action.type = request_digital_credential` 的钱包（例如 Google Wallet），请使用此操作。
请在您的后端使用启动验证时所用的应用 API 密钥进行身份认证。

原样发送钱包返回的内容：浏览器中 `navigator.credentials.get` 返回的 `{protocol, data}`，或 Android Credential Manager 返回的已解析 `credentialJson`。
响应已针对 Didit 加密，因此请勿修改。
Didit 会依据受信任的签发方根证书检查签发方签名，依据已签名摘要核对每个返回值，并核验基于您的 `origin` 与本次请求生成的设备签名，然后决定该验证的结果。

每个响应只能提交一次。再次提交将返回已作出决定的验证结果。
不接受钱包响应的验证会返回 `409`，并附带 `error: "not_a_digital_credentials_wallet"`。

完整流程（包括浏览器和 Android 代码示例）请参阅[数字身份钱包 API](https://docs.didit.me/zh/standalone-apis/digital-id-wallets.md#digital-credentials-钱包（google-wallet）)。


## OpenAPI

````yaml zh/openapi-25.json POST /v3/id-verification/wallets/verifications/{request_id}/response/
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: []
paths:
  /v3/id-verification/wallets/verifications/{request_id}/response/:
    post:
      tags:
        - Digital ID wallets
      summary: 提交钱包响应
      description: >-
        数字凭证 API 钱包（Google Wallet）：针对 next_action 为 request_digital_credential
        的验证，将钱包返回给您页面或应用的内容发送过来。Didit
        会解密该内容，对照受信任签发方根证书核验签发方签名，对照签名摘要核验每个返回的值，并核验设备针对您的源站和此请求的签名，然后对验证做出决策：已通过（计费一次）或附带错误代码的已拒绝。一次性使用：第二次提交会返回已做出决策的验证。
      operationId: submit_wallet_verification_response
      parameters:
        - in: path
          name: request_id
          schema:
            type: string
            format: uuid
          description: start endpoint 返回的 request_id。
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/DigitalIdWalletApiWalletDigitalCredentialResponseRequest
            example:
              response:
                protocol: openid4vp-v1-signed
                data:
                  response: <compact JWE returned by the wallet>
          application/x-www-form-urlencoded:
            schema:
              $ref: >-
                #/components/schemas/DigitalIdWalletApiWalletDigitalCredentialResponseRequest
            example:
              response:
                protocol: openid4vp-v1-signed
                data:
                  response: <compact JWE returned by the wallet>
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/DigitalIdWalletApiWalletDigitalCredentialResponseRequest
            example:
              response:
                protocol: openid4vp-v1-signed
                data:
                  response: <compact JWE returned by the wallet>
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/DigitalIdWalletApiWalletVerificationResponse
              example:
                request_id: 00000000-0000-4000-8000-000000000001
                wallet_verification:
                  wallet:
                    id: google_wallet
                    name: Google Wallet
                    issuing_authority: >-
                      Google Wallet (ID pass) and US state issuers (mobile
                      driving licence)
                  country: USA
                  status: Approved
                  outcome: verified
                  error: null
                  interaction: digital_credentials
                  simulated: false
                  expires_at: '2026-01-01T10:10:00Z'
                  next_action: null
                  identity:
                    full_name: Alex Example
                    first_name: Alex
                    last_name: Example
                    date_of_birth: '1990-01-31'
                    nationality: USA
                    issuing_state: USA
                  attributes:
                    document_number: X0000000
                    document_expiry_date: '2030-01-31'
                  level_of_assurance: substantial
                  verified_at: '2026-01-01T10:01:00Z'
                  signature_valid: true
                  credential_type: person_identification
                vendor_data: your-customer-reference
                metadata:
                  reference: example
                created_at: '2026-01-01T10:00:00Z'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/DigitalIdWalletApiWalletVerificationStartBadRequest
          description: '字段验证错误（{field: [messages]}）。'
        '403':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/DigitalIdWalletApiClientCredentialsForbiddenErrorMessage
          description: '缺少凭据（x-api-key 或 Authorization: Bearer）。'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DigitalIdWalletApiWalletVerificationError'
          description: 错误 not_found：此应用下没有任何钱包验证具有该 request_id。
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DigitalIdWalletApiWalletVerificationError'
          description: 错误 not_a_digital_credentials_wallet：此验证不接收钱包响应。
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DigitalIdWalletApiWalletVerificationError'
          description: 错误 wallet_not_configured：此环境无法验证该钱包。
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl --request POST \
              --url https://verification.didit.me/v3/id-verification/wallets/verifications/REQUEST_ID/response/ \
              --header 'x-api-key: YOUR_API_KEY' \
              --header 'Content-Type: application/json' \
              --data '{
              "response": {
                "protocol": "openid4vp-v1-signed",
                "data": {
                  "response": "<compact JWE returned by the wallet>"
                }
              }
            }'
components:
  schemas:
    DigitalIdWalletApiWalletDigitalCredentialResponseRequest:
      type: object
      description: 对于 `request_digital_credential` 验证，钱包向您的页面或应用返回的内容。
      properties:
        response:
          type: object
          additionalProperties: {}
          description: >-
            钱包返回的确切内容：来自 navigator.credentials.get 的 DigitalCredential 的
            {protocol, data}，或 Android DigitalCredential 解析后的 credentialJson。已为
            Didit 加密；切勿修改。
      required:
        - response
    DigitalIdWalletApiWalletVerificationResponse:
      type: object
      description: 单次独立钱包验证，正如每个钱包 endpoint 返回的结果一样。
      properties:
        request_id:
          type: string
          format: uuid
        wallet_verification:
          $ref: '#/components/schemas/DigitalIdWalletApiWalletVerificationResult'
        vendor_data:
          type: string
          nullable: true
        metadata:
          type: object
          additionalProperties: {}
          nullable: true
          description: 启动时发送的元数据对象，或 null。
        created_at:
          type: string
          format: date-time
      required:
        - created_at
        - metadata
        - request_id
        - vendor_data
        - wallet_verification
    DigitalIdWalletApiWalletVerificationStartBadRequest:
      oneOf:
        - $ref: '#/components/schemas/DigitalIdWalletApiWalletVerificationError'
        - $ref: '#/components/schemas/DigitalIdWalletApiWalletVerificationFieldErrors'
    DigitalIdWalletApiClientCredentialsForbiddenErrorMessage:
      type: object
      properties:
        detail:
          type: string
          default: Forbidden - User doesn't have permission
    DigitalIdWalletApiWalletVerificationError:
      type: object
      properties:
        error:
          type: string
          description: 稳定的机器可读代码，例如 wallet_unavailable。
        detail:
          type: string
      required:
        - detail
        - error
    DigitalIdWalletApiWalletVerificationResult:
      type: object
      properties:
        wallet:
          allOf:
            - $ref: '#/components/schemas/DigitalIdWalletApiWallet'
          readOnly: true
        country:
          type: string
        status:
          type: string
          description: 待处理时为未完成，随后为已通过（已核验）或已拒绝。
        outcome:
          $ref: >-
            #/components/schemas/DigitalIdWalletApiWalletVerificationResultOutcomeEnum
        error:
          type: string
          nullable: true
          readOnly: true
        interaction:
          allOf:
            - $ref: '#/components/schemas/DigitalIdWalletApiInteractionEnum'
          readOnly: true
        simulated:
          type: boolean
          readOnly: true
        expires_at:
          type: string
          format: date-time
        next_action:
          allOf:
            - $ref: '#/components/schemas/DigitalIdWalletApiWalletNextAction'
          nullable: true
          readOnly: true
        identity:
          allOf:
            - $ref: '#/components/schemas/DigitalIdWalletApiWalletIdentity'
          nullable: true
          readOnly: true
        attributes:
          type: object
          additionalProperties: {}
          nullable: true
          readOnly: true
        level_of_assurance:
          type: string
          nullable: true
        verified_at:
          type: string
          format: date-time
          nullable: true
        signature_valid:
          type: boolean
          nullable: true
          description: 凭证签名验证通过后为 true；模拟凭证为 null。
        credential_type:
          type: string
          nullable: true
      required:
        - attributes
        - country
        - credential_type
        - error
        - expires_at
        - identity
        - interaction
        - level_of_assurance
        - next_action
        - outcome
        - signature_valid
        - simulated
        - status
        - verified_at
        - wallet
    DigitalIdWalletApiWalletVerificationFieldErrors:
      type: object
      description: 请求验证错误：每个被拒绝的字段及其消息。
      additionalProperties:
        type: array
        items:
          type: string
    DigitalIdWalletApiWallet:
      type: object
      properties:
        id:
          type: string
          description: 钱包的目录 ID，例如 bankid_se。
        name:
          type: string
        issuing_authority:
          type: string
          nullable: true
      required:
        - id
        - issuing_authority
        - name
    DigitalIdWalletApiWalletVerificationResultOutcomeEnum:
      enum:
        - pending
        - verified
        - cancelled
        - timeout
        - failed
      type: string
      description: |-
        * `pending` - 待处理
        * `verified` - 已验证
        * `cancelled` - 用户已取消
        * `timeout` - 已超时
        * `failed` - 已失败
    DigitalIdWalletApiInteractionEnum:
      enum:
        - redirect
        - in_app
        - digital_credentials
      type: string
      description: |-
        * `redirect` - 重定向
        * `in_app` - 应用内
        * `digital_credentials` - 数字凭证
    DigitalIdWalletApiWalletNextAction:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/DigitalIdWalletApiWalletNextActionTypeEnum'
          description: >-
            redirect：将用户浏览器重定向至 url。confirm_in_app：向用户显示
            verification_code，用户核对该验证码与其钱包应用中的代码一致后在应用内确认；随后进行轮询。request_digital_credential：在您最初发起流程的源上通过用户手势调用
            digital_credentials.request 请求钱包，然后将返回的内容发送至 POST
            .../verifications/{request_id}/response/。


            * `redirect` - redirect

            * `confirm_in_app` - confirm_in_app

            * `request_digital_credential` - request_digital_credential
        url:
          type: string
          format: uri
          description: 仅限 redirect：用户使用钱包登录的页面。
        digital_credentials:
          allOf:
            - $ref: >-
                #/components/schemas/DigitalIdWalletApiWalletDigitalCredentialsRequest
          description: 仅限 request_digital_credential：传递给钱包的请求内容。
        verification_code:
          type: string
          description: 仅限 confirm_in_app：钱包应用上同步显示的 4 位比对码。
        poll_interval_seconds:
          type: integer
          description: >-
            仅限 confirm_in_app：调用 POST .../verifications/{request_id}/poll/
            以获取即时反馈的频率。Didit 还会在后台轮询待处理的登录，因此即使您不进行轮询，Webhook 也会报告结果。
      required:
        - type
    DigitalIdWalletApiWalletIdentity:
      type: object
      properties:
        full_name:
          type: string
          nullable: true
        first_name:
          type: string
          nullable: true
        last_name:
          type: string
          nullable: true
        date_of_birth:
          type: string
          format: date
          nullable: true
        nationality:
          type: string
          nullable: true
          description: ISO3 国籍，仅在钱包明确声明时提供（绝不进行推断）。
        issuing_state:
          type: string
          description: 签发该身份的方案所属的 ISO3 国家/地区。
      required:
        - date_of_birth
        - first_name
        - full_name
        - issuing_state
        - last_name
        - nationality
    DigitalIdWalletApiWalletNextActionTypeEnum:
      enum:
        - redirect
        - confirm_in_app
        - request_digital_credential
      type: string
      description: |-
        * `redirect` - 重定向
        * `confirm_in_app` - 应用内确认
        * `request_digital_credential` - 请求数字凭证
    DigitalIdWalletApiWalletDigitalCredentialsRequest:
      type: object
      properties:
        protocol:
          type: string
          description: openid4vp-v1-signed。
        request:
          type: object
          additionalProperties: {}
          description: >-
            原样传递：在浏览器中为 navigator.credentials.get({digital: request})，或在 Android
            上作为 GetDigitalCredentialOption 的 requestJson 传入
            JSON.stringify(request)。由 Didit 为您的应用签名。
      required:
        - protocol
        - request
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        您的应用 API 密钥，可在 Business Console 的“开发者 -> API
        密钥”中获取。主密钥拥有完整访问权限。指定名称的密钥可设置作用域：针对每个资源设为无权限、只读或读写，限定于特定工作流或已通过的会话、限定于
        IP 地址列表，以及设置到期日期。401 表示密钥错误、已撤销或已过期；403 表示未发送密钥、密钥无权访问该资源或操作，或请求来自其 IP
        列表之外的地址；在会话路由上返回 404 表示该会话不在该密钥允许的工作流或状态范围内。没有媒体访问权限的密钥获取到的图片、视频和 PDF
        URL 将为 null；没有会话写入权限的密钥获取到的会话链接和 token 将为 null。请参阅
        https://docs.didit.me/console/api-keys。
    BearerAuth:
      type: http
      scheme: bearer
      description: 该应用的客户端凭证访问 token。

````

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