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

# 撤销指令

> Revokes a purchase instruction by setting its Clink status to `CANCELLED`. No request is sent to the card network: an instruction that already exists on the network (for example Visa VIC or Mastercard Agent Pay) stays usable there until it expires or its limit is exhausted. Requires `portal:write`. Pass the instruction ID (`inst_...`), not a payment credential ID.

撤销一条购买指令，使其不能再用于领取凭证或发起支付。参数是**指令 ID**（`inst_...`），不是支付凭证 ID；为某条指令签发的凭证内部包含该指令 ID。

## revoke 改了什么

revoke 只改 Clink 侧状态：

* `ACTIVE`、`CREATED`、`PENDING` 的指令变为 `CANCELLED`，并记录 `revoked_at`。
* 指令不能再被尚未使用的激活链接激活，Clink 也不再接受针对它的新扣款。
* **不会向卡组织发送撤销请求。** 已经存在于 Visa、Mastercard 等卡组织侧的指令（例如 Visa VIC、Mastercard Agent Pay）在卡组织侧仍然有效，直到过期或额度用尽。不要把 revoke 当作释放卡组织侧额度的手段；要停止卡组织侧使用，请让指令自然过期，或在卡组织侧另行撤销。

## 幂等与终态

| 当前状态 | 结果 | 响应 |
| - | - | - |
| `ACTIVE`、`CREATED`、`PENDING` | 变为 `CANCELLED` | `200`，`status` = `CANCELLED` |
| `CANCELLED` | 不变；`revoked_at` 保留原撤销时间 | `200`，`status` = `CANCELLED` |
| `COMPLETED`、`EXPIRED`、`DECLINED` | 不变 | `200`，`status` = 当前终态 |
| `INPROGRESS` | 拒绝：有支付在途 | `409`，`code` `71211028`（`portal_invalid_state`） |

返回 `200` 不代表一定是刚撤销成功：请读取响应里的 `status`。重复调用是安全的，不会重复产生取消事件。

## 错误

* `401` — portal token 缺失、过期或无效。
* `403` — token 缺少 `portal:write`。
* `404` — 指令不存在或不属于该 token 的客户。
* `409` — `portal_invalid_state`：该指令有支付在途，或调用期间状态持续变化；稍后重试。


## OpenAPI

````yaml POST /agent/platform/authorizations/{instructionId}/revoke
openapi: 3.1.0
info:
  title: Clink Agent Portal API
  description: >-
    Agent Portal APIs let an Agent platform read and manage one user's Clink
    account with a portal user token: payment methods, orders, refunds, purchase
    instructions, payment credentials, payment results, and settings.
  version: 1.0.0
servers:
  - url: https://uat-api.clinkbill.com
    description: Sandbox
security:
  - PortalToken: []
paths:
  /agent/platform/authorizations/{instructionId}/revoke:
    post:
      summary: Revoke instruction
      description: >-
        Revokes a purchase instruction by setting its Clink status to
        `CANCELLED`. No request is sent to the card network: an instruction that
        already exists on the network (for example Visa VIC or Mastercard Agent
        Pay) stays usable there until it expires or its limit is exhausted.
        Requires `portal:write`. Pass the instruction ID (`inst_...`), not a
        payment credential ID.
      operationId: revokeAuthorization
      parameters:
        - name: instructionId
          in: path
          required: true
          description: >-
            Instruction ID. A payment credential issued for the instruction
            contains this ID.
          schema:
            type: string
            example: inst_...
      responses:
        '200':
          description: >-
            The instruction is revoked, or was already final. Read `status` for
            the current state.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    format: int32
                    description: '`200` on success.'
                    example: 200
                  msg:
                    type: string
                    description: Result message.
                    example: Success
                  data:
                    $ref: '#/components/schemas/RevokeAuthorizationResponse'
              example:
                code: 200
                msg: Success
                data:
                  instruction_id: inst_...
                  status: CANCELLED
                  revoked_at: '2026-11-23T06:00:00Z'
        '401':
          description: Missing, expired, or invalid portal token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Wrong token audience, missing `portal:write` scope, or a platform
            client token used instead of a portal token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            The instruction does not exist or does not belong to the token's
            customer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            The instruction cannot be revoked right now: a payment is in
            progress, or its status kept changing during the call (`code`
            `71211028`, `portal_invalid_state`). Retry later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    RevokeAuthorizationResponse:
      type: object
      properties:
        instruction_id:
          type: string
          description: Instruction ID.
          example: inst_...
        status:
          type: string
          description: >-
            Instruction status after the call. `CANCELLED` means the instruction
            is revoked; any other value means it had already reached that
            terminal status and was left unchanged.
          example: CANCELLED
        revoked_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the instruction was revoked, as an ISO-8601 UTC instant. `null`
            when the instruction is final but was never cancelled (for example
            `COMPLETED`, `EXPIRED`, `DECLINED`); an already-`CANCELLED`
            instruction returns its original revoke time.
          example: '2026-11-23T06:00:00Z'
    ErrorResponse:
      type: object
      description: Business errors use the standard envelope without `data`.
      properties:
        code:
          type: integer
          description: >-
            Numeric business error code. Judge an error by the HTTP status
            together with `code`, not by a string error code.
        msg:
          type: string
          description: Human-readable description.
  securitySchemes:
    PortalToken:
      type: http
      scheme: bearer
      description: >-
        Portal user token from `POST /agent/cwallet/platform/portal/tokens`.
        Reads require `portal:read`; writes require `portal:write`.

````

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