# 加密货币充值

> LocalSERP Proxy API：加密货币充值、精确金额、付款已发送（TXID 可选）和状态。参数、响应示例、curl、Python 和 Node.js 代码。

- URL: https://localserpproxy.com/zh/docs/api/top-ups/
- 最后更新: 2026-10-15
- Publisher: LocalSERP Proxy (https://localserpproxy.com)

使用加密货币为余额充值：获取充值地址和准确金额，按该金额转账，报告付款已发送（交易 ID 可选），然后跟踪充值状态，直至余额到账。余额可用于支付我们的任何套餐。

**本页端点**

- `GET /v1/catalog/coins`：支持的加密货币和网络（及其固定充值地址）
- `POST /v1/topups`：发起余额加密货币充值（固定地址、精确金额）
- `POST /v1/topups/{topUpId}/txid`：报告付款已发送（TXID 可选）
- `GET /v1/topups/{topUpId}`：获取充值记录（轮询实时状态）
- `GET /v1/topups`：列出加密货币充值记录

基础 URL `https://localserpproxy.com/api/v1`。身份验证、错误和限制：请参阅 [API 概览](https://localserpproxy.com/zh/docs/api/)。

## 支持的加密货币和网络（含固定充值地址）

`GET /v1/catalog/coins`

公开接口：无需 API 密钥。

**响应** `200 OK`

```json
{
  "data": [
    {
      "code": "BTC",
      "name": "Bitcoin",
      "networks": [
        {
          "id": "bitcoin",
          "name": "Bitcoin",
          "confirmationsRequired": 2,
          "estimatedMinutes": null,
          "memoRequired": false,
          "address": "DEPOSIT_ADDRESS"
        }
      ]
    }
  ]
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/catalog/coins"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"

r = requests.get(f"{API}/catalog/coins", timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/catalog/coins`);
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## 开始加密货币余额充值（固定地址，精确金额）

`POST /v1/topups`

- `amountUsd` ≥ 25.00 USD 且 ≤ 最高限额（默认 10,000.00）：否则为 `422`，适用于 `amountUsd`。
- `coin` + `network` 必须是 `GET /v1/catalog/coins` 之一（否则为 `409 coin_unavailable`）。
- 返回网络的**固定** `address`，以及精确的 `amountCrypto` = `amountUsd` / `rate`，按币种精度向上取整（BTC/LTC/ETH/SOL 保留 8 位小数，USDT/USDC 保留 6 位），并在末位添加一个小型唯一偏移量，确保同一网络上没有两个未完成的充值请求使用相同金额。`rate` 将锁定至 `expiresAt`（30 分钟）；`txidDeadline` = `expiresAt` + 72 小时。
- 可选的 `purchase`（请求正文与 `POST /v1/orders` 相同）：立即验证并计价（`422`，字段名称以 `purchase.`、`409 plan_unavailable`… 为前缀）。`amountUsd` 必须足以支付 `purchase` 总额减去当前余额（`amountUsd` 上的 `422 too_small`）。充值到账后，系统将在同一笔交易中从余额下单；`purchase.status` 将变为 `completed`（含 `orderId`）或 `failed`（`failureReason`；资金仍保留在余额中）。

身份验证：在 `Authorization: Bearer API_KEY` 请求头中提供 API 密钥。

**参数**

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | 否 | 用于安全重试 POST 的唯一键（例如 UUID）。保留 24 小时。— 最长 128 个字符 |

**请求正文**

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `amountUsd` | string (USD, 2 decimals) | 是 | 充值金额（USD）：≥ 25.00，默认 ≤ 10,000.00。 |
| `coin` | string | 是 | — |
| `network` | string | 是 | — |
| `purchase` | object | 否 | 充值到账后，计划从余额购买的方案（请求正文与 `POST /v1/orders` 相同）。 |

*示例: 余额*

```json
{
  "amountUsd": "50.00",
  "coin": "USDT",
  "network": "tron"
}
```

*示例: 结账*

```json
{
  "amountUsd": "25.00",
  "coin": "BTC",
  "network": "bitcoin",
  "purchase": {
    "planId": "res-10",
    "quantity": 1
  }
}
```

**响应** `201 Created`

```json
{
  "id": "top_7d2kq9x1",
  "status": "verifying",
  "final": false,
  "amountUsd": "25.00",
  "coin": "USDT",
  "network": "tron",
  "address": "DEPOSIT_ADDRESS",
  "amountCrypto": "25.000137",
  "rate": "1.00",
  "paymentUri": "PAYMENT_URI",
  "expiresAt": "2026-10-05T14:33:11Z",
  "txidDeadline": "2026-10-08T14:33:11Z",
  "confirmationsRequired": 20,
  "confirmations": 7,
  "txid": "9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
  "txidSubmittedAt": "2026-10-05T14:09:42Z",
  "amountReceivedCrypto": "25.000137",
  "explorerUrl": "https://tronscan.org/#/transaction/9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
  "creditedUsd": null,
  "creditedAt": null,
  "rejection": null,
  "purchase": {
    "planId": "res-10",
    "planName": "Local team",
    "quantity": 1,
    "options": {},
    "promoCode": null,
    "total": "7.50",
    "status": "pending",
    "orderId": null,
    "failureReason": null
  },
  "createdAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s -X POST "https://localserpproxy.com/api/v1/topups" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"amountUsd":"50.00","coin":"USDT","network":"tron"}'
```

*Python*

```python
import os, uuid
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}

r = requests.post(f"{API}/topups", headers=HEADERS, json={"amountUsd": "50.00", "coin": "USDT", "network": "tron"}, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
import { randomUUID } from 'node:crypto';

const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/topups`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Idempotency-Key': randomUUID(), 'Content-Type': 'application/json' },
  body: JSON.stringify({ amountUsd: '50.00', coin: 'USDT', network: 'tron' }),
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## 报告已发送付款（TXID 可选）

`POST /v1/topups/{topUpId}/txid`

付款离开你的钱包或交易所后，报告付款已发送：这是 API 版本的“我已发送付款”按钮。交易 ID（TXID）为可选项：发送空请求正文（`{}`），或在有 TXID 时添加 `txid`。系统会根据充值网络和地址上的精确金额（`amountCrypto`）匹配付款，因此请务必发送该精确金额。

充值状态为 `awaiting_payment`、`expired` 或 `rejected`，且尚未超过 `txidDeadline`（`expiresAt` + 72 小时）时，均可提交报告：逾期报告不会导致付款丢失。若提供 `txid`，系统会检查其是否符合网络格式（`txid` 上的 `422`），且不得已被其他充值请求使用（`409 txid_already_used`）。已关闭的充值请求会返回 `409 topup_closed`。随后，充值请求将变为 `verifying`，等待在区块链上核验付款；网络确认交易后，状态将变为 `credited`，或变为 `rejected`（含 `rejection`）。

身份验证：在 `Authorization: Bearer API_KEY` 请求头中提供 API 密钥。

**参数**

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `topUpId` | path | string | 是 | — |

**请求正文**

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `txid` | string | 否 | 可选。交易哈希：64 位十六进制（bitcoin、litecoin、tron），0x + 64 位十六进制（ethereum），base58 签名（solana）。留空或不提供：系统将按精确金额匹配付款。— 最长 128 个字符 |

*示例: 已发送付款*

```json
{}
```

*示例: 填写 TXID（可选）*

```json
{
  "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
}
```

**响应** `200 OK`

```json
{
  "id": "top_7d2kq9x1",
  "status": "verifying",
  "final": false,
  "amountUsd": "25.00",
  "coin": "USDT",
  "network": "tron",
  "address": "DEPOSIT_ADDRESS",
  "amountCrypto": "25.000137",
  "rate": "1.00",
  "paymentUri": "PAYMENT_URI",
  "expiresAt": "2026-10-05T14:33:11Z",
  "txidDeadline": "2026-10-08T14:33:11Z",
  "confirmationsRequired": 20,
  "confirmations": 7,
  "txid": "9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
  "txidSubmittedAt": "2026-10-05T14:09:42Z",
  "amountReceivedCrypto": "25.000137",
  "explorerUrl": "https://tronscan.org/#/transaction/9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
  "creditedUsd": null,
  "creditedAt": null,
  "rejection": null,
  "purchase": {
    "planId": "res-10",
    "planName": "Local team",
    "quantity": 1,
    "options": {},
    "promoCode": null,
    "total": "7.50",
    "status": "pending",
    "orderId": null,
    "failureReason": null
  },
  "createdAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s -X POST "https://localserpproxy.com/api/v1/topups/top_7d2kq9x1/txid" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.post(f"{API}/topups/top_7d2kq9x1/txid", headers=HEADERS, json={}, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/topups/top_7d2kq9x1/txid`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## 充值（查询实时状态）

`GET /v1/topups/{topUpId}`

查询此接口以跟踪充值状态：当 `status = verifying` 时每 10 s 查询一次，等待付款期间每 30 s 查询一次，并在 `final = true` 时停止。若在 `expiresAt` 之前未报告已发送付款，充值将变为 `expired`；在 `txidDeadline` 之前仍可报告。

身份验证：在 `Authorization: Bearer API_KEY` 请求头中提供 API 密钥。

**参数**

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `topUpId` | path | string | 是 | — |

**响应** `200 OK`

```json
{
  "id": "top_7d2kq9x1",
  "status": "verifying",
  "final": false,
  "amountUsd": "25.00",
  "coin": "USDT",
  "network": "tron",
  "address": "DEPOSIT_ADDRESS",
  "amountCrypto": "25.000137",
  "rate": "1.00",
  "paymentUri": "PAYMENT_URI",
  "expiresAt": "2026-10-05T14:33:11Z",
  "txidDeadline": "2026-10-08T14:33:11Z",
  "confirmationsRequired": 20,
  "confirmations": 7,
  "txid": "9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
  "txidSubmittedAt": "2026-10-05T14:09:42Z",
  "amountReceivedCrypto": "25.000137",
  "explorerUrl": "https://tronscan.org/#/transaction/9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
  "creditedUsd": null,
  "creditedAt": null,
  "rejection": null,
  "purchase": {
    "planId": "res-10",
    "planName": "Local team",
    "quantity": 1,
    "options": {},
    "promoCode": null,
    "total": "7.50",
    "status": "pending",
    "orderId": null,
    "failureReason": null
  },
  "createdAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/topups/top_7d2kq9x1" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/topups/top_7d2kq9x1", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/topups/top_7d2kq9x1`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## 列出加密货币充值记录

`GET /v1/topups`

身份验证：在 `Authorization: Bearer API_KEY` 请求头中提供 API 密钥。

**参数**

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `page` | query | integer | 否 | ≥ 1，默认值 `1` |
| `perPage` | query | integer | 否 | 1–100，默认值 `20` |
| `status` | query | `awaiting_payment` · `verifying` · `credited` · `rejected` · `expired` | 否 | `final` = 已入账，或在 `txidDeadline` 后过期 / 被拒绝。 |

**响应** `200 OK`

```json
{
  "data": [
    {
      "id": "top_7d2kq9x1",
      "status": "verifying",
      "final": false,
      "amountUsd": "25.00",
      "coin": "USDT",
      "network": "tron",
      "address": "DEPOSIT_ADDRESS",
      "amountCrypto": "25.000137",
      "rate": "1.00",
      "paymentUri": "PAYMENT_URI",
      "expiresAt": "2026-10-05T14:33:11Z",
      "txidDeadline": "2026-10-08T14:33:11Z",
      "confirmationsRequired": 20,
      "confirmations": 7,
      "txid": "9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
      "txidSubmittedAt": "2026-10-05T14:09:42Z",
      "amountReceivedCrypto": "25.000137",
      "explorerUrl": "https://tronscan.org/#/transaction/9d2e5c0b1f7a4e3d8c6b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4a3f41c7",
      "creditedUsd": null,
      "creditedAt": null,
      "rejection": null,
      "purchase": {
        "planId": "res-10",
        "planName": "Local team",
        "quantity": 1,
        "options": {},
        "promoCode": null,
        "total": "7.50",
        "status": "pending",
        "orderId": null,
        "failureReason": null
      },
      "createdAt": "2026-10-05T14:03:11Z"
    }
  ],
  "pagination": {
    "page": 1,
    "perPage": 20,
    "total": 1,
    "totalPages": 1
  }
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/topups" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/topups", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/topups`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

---

LocalSERP Proxy: LocalSERP Proxy 是一项美国住宅代理服务，用于逐个城市检查本地搜索结果、广告和价格，支持加密货币支付，无需上传身份证件。
