系统会从用户保存的 Stripe 付款方式中扣款,并立即将款项记入账户。此次购买受代理 API 计费配置中设置的单次购买和每月限额的限制。
要求POST https://payments.builtwith.com/v1/billing/api-purchase
请将代理 API 密钥作为附件发送。 Authorization: Bearer 标题或作为 ?KEY= 查询参数。请求体必须为 JSON 格式。
请求正文| 场地 | 类型 | 必需的 | 描述 |
|---|
credits | number | 是的 | 可购买的积分数量。最少 2,000 积分。不得超过 max_per_purchase 或剩余的月度津贴。 |
成功响应(HTTP 200)| 场地 | 类型 | 描述 |
|---|
success | boolean | true |
credits_purchased | number | 账户已添加积分。 |
cost_usd | number | 以美元计价的金额。 |
payment_id | string | Stripe PaymentIntent ID 用于对账。 |
credits_available | number | 购买后更新可用信用余额。 |
请求正文示例{ "credits": 2000 }成功回应示例{
"success": true,
"credits_purchased": 2000,
"cost_usd": 99.00,
"payment_id": "pi_3abc123xyz",
"credits_available": 10766
}错误响应| HTTP | 意义 |
|---|
| 400 | 验证失败 - 积分低于 2,000,超过单次购买限额,或超过每月限额。 |
| 401 | 代理 API 密钥缺失或无效。 |
| 402 | Stripe支付失败或账户中没有可用的支付方式。 |
| 403 | 账户计费已暂停。 |
| 405 | 方法不允许 - 端点需要 POST 请求。 |