---
title: "cancel_pending_payment"
canonical_url: "https://tweetstream.io/zh-cn/docs/api/agent-action-cancel-pending-payment"
last_updated: 2026-11-05
---

# cancel_pending_payment

准备取消某个产品线未完成的稳定币付款、Scale 已排期的额度变更，或 Ultra Speed 未完成的结账。在 confirm_action 用发到对方邮箱的验证码执行之前，不会有任何变化。confirm 级：调用只会暂存并返回这项变更。request_confirmation_code 向对方邮箱发送验证码，对方读出验证码后，confirm_action 才会执行变更。同名 MCP 工具需要 tweetstream:billing 权限范围。

Canonical URL: https://tweetstream.io/zh-cn/docs/api/agent-action-cancel-pending-payment

## `POST /api/agent/actions/cancel_pending_payment`

`https://tweetstream.io/api/agent/actions/cancel_pending_payment`

## 授权

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `Authorization` | `string`, 必填 | 使用 TweetStream API 密钥进行 Bearer 认证：`Bearer <key>`。 |

## 请求体

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `family` | `enum<string>`, 必填 |  |
| `target` | `enum<string>`, 必填 | open_payment: the family's open stablecoin payment request. scale_limit_change: Scale's scheduled limit change. open_checkout: Ultra Speed's open checkout. |

### 请求体示例

```json
{
  "family": "BASE",
  "target": "open_payment"
}
```

## 响应字段

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `next` | `object`, 必填 |  |
| `next.action` | `enum<string>`, 必填 |  |
| `next.message` | `string`, 必填 |  |
| `next.name` | `string`, 必填 |  |
| `next.who` | `enum<string>`, 必填 |  |
| `pendingAction` | `object`, 必填 |  |
| `pendingAction.action` | `string`, 必填 |  |
| `pendingAction.expiresAt` | `string`, 必填 | a string to be decoded into a Date |
| `pendingAction.id` | `string`, 必填 |  |
| `pendingAction.quote` | `object`, 必填 |  |
| `pendingAction.quote.amountDueCents` | `integer`, 必填 | an integer |
| `pendingAction.quote.effectiveAt` | `string`, 必填 | a string to be decoded into a Date |
| `pendingAction.quote.renewal` | `object`, 必填 |  |
| `pendingAction.quote.renewal.amountCents` | `integer`, 必填 | an integer |
| `pendingAction.quote.renewal.at` | `string`, 必填 | a string to be decoded into a Date |
| `pendingAction.quote.renewal.termMonths` | `integer`, 必填 | an integer |
| `pendingAction.quote.saveOffer` | `object`, 必填 |  |
| `pendingAction.quote.saveOffer.description` | `string`, 必填 |  |
| `pendingAction.quote.saveOffer.offer` | `object`, 必填 |  |
| `pendingAction.summary` | `string`, 必填 |  |
| `status` | `enum<string>`, 必填 |  |

## 响应

| 状态 | 说明 | 请求头 |
| --- | --- | --- |
| `200` | 成功 |  |
| `400` | 输入不符合该操作的 schema（INVALID_REQUEST） |  |
| `401` | API key 缺失或无效 |  |
| `403` | 请求带有外部 Origin |  |
| `409` | 没有需要变更的内容，或不提供该变更（ACTION_REFUSED，附带 reason） |  |
| `429` | 已达到速率限制（RATE_LIMITED），请在 retryAfterSeconds 秒后重试 |  |
| `503` | 暂时不可用，请稍后重试 |  |

### 200

```json
{
  "next": {
    "action": "call_action",
    "message": "Show the person this change. If they want it, call request_confirmation_code to email them a code.",
    "name": "request_confirmation_code",
    "who": "agent"
  },
  "pendingAction": {
    "action": "cancel_pending_payment",
    "expiresAt": "2026-11-05T12:05:00.000Z",
    "id": "pa_7Rk2mQ9xL4",
    "quote": {
      "amountDueCents": 0,
      "effectiveAt": "2026-11-05T12:05:00.000Z",
      "renewal": null,
      "saveOffer": null
    },
    "summary": "Cancel the unpaid 199 USDC stablecoin payment for your TweetStream plan. Takes effect at once. Nothing is charged now."
  },
  "status": "confirmation_required"
}
```

### 400

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 401

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 403

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 409

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 429

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 503

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

## 代码示例

### cURL

```bash
curl --request POST \
  --url https://tweetstream.io/api/agent/actions/cancel_pending_payment \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "family": "BASE",
  "target": "open_payment"
}'
```

### JavaScript

```javascript
const response = await fetch("https://tweetstream.io/api/agent/actions/cancel_pending_payment", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "family": "BASE",
    "target": "open_payment"
  }),
});

console.log(response.status, await response.json());
```

### Python

```python
import os
import requests

response = requests.post(
    "https://tweetstream.io/api/agent/actions/cancel_pending_payment",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}"},
    json={
        "family": "BASE",
        "target": "open_payment",
    },
)

print(response.status_code, response.json())
```
