Appearance
开票与工单
开票通过「开票申请」类工单提交:选好要开票的订单,填上发票信息,客服开好后把发票发到你填的邮箱。其他问题(技术、账户等)也用工单联系客服。
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/v1/tickets | 我的工单(分页) |
| POST | /api/v1/tickets | 提交工单或开票申请 |
| GET | /api/v1/tickets/:id | 工单详情 |
| GET | /api/v1/tickets/:id/replies | 工单的回复 |
| POST | /api/v1/tickets/:id/replies | 回复工单 |
| POST | /api/v1/tickets/:id/withdraw | 撤回工单 |
| GET | /api/v1/invoice-profiles | 常用开票资料 |
| POST | /api/v1/invoice-profiles | 新增开票资料 |
| PUT | /api/v1/invoice-profiles/:id | 修改开票资料 |
| DELETE | /api/v1/invoice-profiles/:id | 删除开票资料 |
示例里的 $BASE 是 https://www.fastaitoken.com/api/v1。
开票流程
- 用 查询可开票条目 拿到要开票的订单 ID。
- 用 提交工单 提交开票申请(
category为finance)。 - 客服处理后工单状态变为
invoiced,发票发到invoice_email;处理过程中的沟通在 工单回复 里。
查询可开票条目
可开票的条目从订单接口取:
bash
curl -s "$BASE/payment/orders/my?statuses=PAID,COMPLETED&include_redeem=true&page=1&page_size=100" \
-H "x-api-key: $ACCOUNT_KEY"返回的条目里,下面这些才能开票:
- 状态为
PAID或COMPLETED; invoice_status为unissued(已开票或开票中的不能再开);payment_type不是balance(用余额买的套餐不能开,那笔钱充进余额时已经可以开票);- 套餐订单(
order_type为subscription)只有人民币付款的能开。
带 include_redeem=true 时,用兑换码充进余额的金额也会作为条目返回:它们的 id 是负数,payment_type 为 redeem_code,可以和订单一起开票,提交时原样填这个负数 ID。
开票金额按条目的 amount 减去 bonus_amount(到账金额,不含充值赠送)计算,不是实付金额。
提交工单
POST /api/v1/tickets
成功时 HTTP 状态码为 201,返回新建的 工单对象。
通用工单
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
category | string | 是 | general 通用,technical 技术问题,account 账户问题 |
title | string | 是 | 标题,最多 200 字节 |
content | string | 是 | 内容,最多 20000 字节 |
bash
curl -s -X POST "$BASE/tickets" \
-H "x-api-key: $ACCOUNT_KEY" -H "Content-Type: application/json" \
-d '{"category": "technical", "title": "claude-sonnet-5-5 偶发 529", "content": "request_id: req_01JD3Q4Z8M2K,北京时间 15:02 起出现……"}'开票申请
category 为 finance:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
category | string | 是 | 固定为 finance |
order_ids | int[] | 是 | 要开票的条目 ID,最多 100 个;兑换码条目是负数 ID |
invoice_type | string | 是 | general 普通发票,special 增值税专用发票 |
invoice_title | string | 是 | 发票抬头,最多 200 字节 |
invoice_email | string | 是 | 接收发票的邮箱 |
tax_no | string | 专票必填 | 纳税人识别号,最多 50 字节 |
bank_name / bank_account | string | 专票必填 | 开户银行(最多 200 字节)/ 银行账号(最多 64 字节) |
invoice_address / invoice_phone | string | 专票必填 | 注册地址(最多 500 字节)/ 电话(最多 30 字节) |
invoice_tax_rate_percent | number | 专票必填 | 专票税点,1 或 3 |
title | string | 否 | 不填时自动生成,例如「开票申请(普票,2 笔,¥120.00)」 |
content | string | 否 | 给开票人员的备注(发票备注栏、开票项目、是否需要清单等),最多 20000 字节 |
- 所选条目合计(按到账金额,不含赠送)至少 100。
- 专票手续费:提交时按「开票合计 × 税点」从余额扣除,四舍五入到分。例如合计 1000、税点 3,扣 30 美元余额。余额不足时不能提交。撤回或被驳回后如需退回手续费,请在工单里说明。
- 发票信息每次都要放在请求体里;常用开票资料 只是保存起来方便取用,提交时不能只传资料 ID。
bash
curl -s -X POST "$BASE/tickets" \
-H "x-api-key: $ACCOUNT_KEY" -H "Content-Type: application/json" \
-d '{
"category": "finance",
"order_ids": [1849302775123456, 1849302775654321, -5521],
"invoice_type": "general",
"invoice_title": "示例科技有限公司",
"invoice_email": "[email protected]",
"tax_no": "91310000MA1XXXXXXX",
"content": "开票项目:信息技术服务费"
}'| HTTP | reason | 说明 |
|---|---|---|
| 400 | MISSING_INVOICE_TYPE / MISSING_INVOICE_TITLE / MISSING_INVOICE_EMAIL | 缺少必填的发票信息 |
| 400 | INVOICE_ORDERS_REQUIRED | 没有选可开票的条目 |
| 400 | INVALID_INVOICE_ORDERS | 有条目不存在、不属于你或不可开票 |
| 400 | INVOICE_ORDER_PROCESSING | 有条目已开票或正在开票 |
| 400 | INVOICE_TOTAL_BELOW_MINIMUM | 合计不足 100 |
| 400 | TOO_MANY_ORDERS | 超过 100 个条目 |
| 400 | INVALID_SPECIAL_INVOICE_TAX_RATE | 专票税点不是 1 或 3 |
| 400 | MISSING_INVOICE_TAX_NO 等 | 专票缺少税号、开户行、账号、地址或电话 |
| 400 | SPECIAL_INVOICE_FEE_INSUFFICIENT_BALANCE | 余额不够扣专票手续费 |
| 400 | INVALID_INVOICE_EMAIL | 邮箱格式不对 |
返利提现
category 为 withdrawal,把邀请返利提现到支付宝,见 邀请返利:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
category | string | 是 | 固定为 withdrawal |
title / content | string | 是 | 标题、说明 |
alipay_name | string | 是 | 支付宝实名,最多 100 字节 |
alipay_account | string | 是 | 支付宝账号,最多 200 字节 |
提现金额不用填:提交时冻结你当前全部可提现的返利额度。同一时间只能有一张处理中的提现工单(否则返回 400 WITHDRAWAL_ALREADY_PENDING);没有可提现额度时返回 400 WITHDRAWAL_QUOTA_EMPTY。撤回提现工单后冻结的额度自动退回。
频率限制
同一来源 IP 每小时最多提交 10 张工单、撤回 20 次,每分钟最多回复 30 条。超出时返回 429,响应体为 {"error": "rate limit exceeded", ...},按 Retry-After 等待后再试。
工单对象
| 字段 | 说明 |
|---|---|
id | 工单 ID |
title / content / category | 标题 / 内容 / 类别 |
status | open 处理中,resolved 已解决,invoiced 已开票,rejected 已驳回,withdrawn 已撤回 |
created_at / updated_at / last_reply_at / resolved_at | 时间 |
invoice_type、invoice_title、tax_no、bank_name、bank_account、invoice_address、invoice_phone、invoice_email | 开票申请填写的发票信息 |
order_ids | 开票条目 ID |
invoice_orders | 开票条目明细(详情接口返回):id、out_trade_no、amount、pay_amount、currency、payment_type、status、paid_at |
invoice_tax_rate_percent / invoice_fee_amount | 专票税点 / 已扣的专票手续费 |
invoice_sent_at | 发票发出时间 |
reject_reason | 驳回或撤回的原因 |
withdraw_amount / alipay_name / alipay_account | 返利提现工单的金额与收款信息 |
我的工单
GET /api/v1/tickets
| 参数 | 说明 |
|---|---|
page / page_size | 分页 |
keyword | 按标题搜索 |
sort_order | desc(默认,新的在前)或 asc |
返回分页结构,items 是 工单对象 数组。
工单详情
GET /api/v1/tickets/:id
返回一个 工单对象,开票申请会带上 invoice_orders 明细。工单不存在或不属于你时返回 404 TICKET_NOT_FOUND。
工单回复
GET /api/v1/tickets/:id/replies 返回回复列表(按时间先后):
json
{
"code": 0,
"message": "success",
"data": [
{ "id": 77, "ticket_id": 1203, "user_id": 10086, "content": "专票已开出,请查收邮件。", "is_admin": true, "created_at": "2026-11-18T16:30:00+08:00" }
]
}is_admin 为 true 表示是客服的回复。
POST /api/v1/tickets/:id/replies 回复工单,请求体 {"content": "..."}(必填,最多 20000 字节),成功时 HTTP 状态码为 201,返回新回复。只有处理中(open)的工单能回复,其他状态返回 400 TICKET_CLOSED。
撤回工单
POST /api/v1/tickets/:id/withdraw
bash
curl -s -X POST "$BASE/tickets/1203/withdraw" \
-H "x-api-key: $ACCOUNT_KEY" -H "Content-Type: application/json" \
-d '{"reason": "订单选错了,重新提交"}'reason 必填,最多 500 字节。只有处理中(open)的工单能撤回,否则返回 400 INVALID_STATUS。成功返回 {"message": "ok"},撤回后开票条目可以重新提交。
常用开票资料
保存常用的发票抬头和税务信息,每个账户最多 20 条。
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/v1/invoice-profiles | 列出全部资料(数组) |
| POST | /api/v1/invoice-profiles | 新增,成功时 HTTP 状态码为 201,返回新资料 |
| PUT | /api/v1/invoice-profiles/:id | 修改,整条替换,没传的字段会被清空 |
| DELETE | /api/v1/invoice-profiles/:id | 删除,返回 {"message": "ok"} |
请求体:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 是 | 资料名称,最多 100 字节,同一账户内不能重名 |
invoice_type | string | 否 | general 或 special |
invoice_title | string | 否 | 发票抬头,最多 200 字节 |
tax_no | string | 否 | 税号,最多 50 字节 |
bank_name / bank_account | string | 否 | 开户银行(最多 200 字节)/ 银行账号(最多 64 字节) |
invoice_address / invoice_phone | string | 否 | 地址(最多 500 字节)/ 电话(最多 30 字节) |
invoice_email | string | 否 | 接收发票的邮箱 |
返回的资料对象包含以上字段,以及 id、user_id、created_at、updated_at;空字段不返回。新增和修改每小时最多 60 次(按来源 IP 计)。
| HTTP | reason | 说明 |
|---|---|---|
| 400 | INVOICE_PROFILE_NAME_EXISTS | 名称重复 |
| 400 | TOO_MANY_INVOICE_PROFILES | 已有 20 条 |
| 400 | INVALID_INVOICE_EMAIL | 邮箱格式不对 |
| 404 | INVOICE_PROFILE_NOT_FOUND | 资料不存在 |