跳到主要内容

获取余额交易

按 ID 获取余额交易。每条记录展示扣款、转账、提现或退款背后的资金流动。

GET https://api.stripe.com/v1/balance_transactions/{id}

示例​

运行以下 cURL 命令发送请求。

cURL
curl -X GET https://api.stripe.com/v1/balance_transactions/txn_1234567890 \
-u "<YOUR_SECRET_KEY>:"

参数​

查询参数​

参数类型必需说明
expand[]字符串数组可选标识需要补充数据并内联返回的嵌套响应对象。

路径变量​

名称类型必需说明
id字符串必需要获取的余额交易 ID。

响应​

响应使用标准状态码。200 表示成功,401 表示 API 密钥无效。格式错误的请求返回 400,例如 expand[] 数组的键不连续。完整列表见 Stripe 的错误代码。

200: OK

Response
{
"id": "txn_1234567890",
"object": "balance_transaction",
"amount": 1000,
"available_on": 1693028800,
"created": 1692942400,
"currency": "usd",
"description": "Payment for invoice",
"exchange_rate": null,
"fee": 59,
"fee_details": [
{
"amount": 59,
"application": null,
"currency": "usd",
"description": "Stripe processing fees",
"type": "stripe_fee"
}
],
"net": 941,
"reporting_category": "charge",
"source": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"status": "available",
"type": "charge"
}

响应属性​

属性类型说明
id字符串余额交易的唯一标识符,以 txn_ 为前缀。
object字符串始终为 balance_transaction。
amount整数资金流动的金额,以最小货币单位表示,未扣除费用。负值表示资金流出账户。
available_on时间戳资金可用于提现的 Unix 时间。
created时间戳Stripe 创建该余额交易的 Unix 时间。
currency字符串小写的三字母货币代码,例如 usd。
description字符串交易的自由文本说明,或 null。
exchange_rate小数Stripe 转换原始货币时使用的汇率。未发生转换时为 null。
fee整数Stripe 从该资金流动中扣除的费用总额,以最小货币单位表示。
fee_details对象数组fee 的明细,每种费用类型一项。每项包含 amount、application、currency、description 和 type。
net整数amount 减去 fee,以最小货币单位表示。
reporting_category字符串Stripe 为该资金流动指定的报告分类,例如 charge、refund 或 payout。
source字符串产生该资金流动的对象的 ID,例如扣款、退款或转账。可展开。
status字符串资金结算后为 available,Stripe 暂扣期间为 pending。
type字符串产生该资金流动的对象,例如 charge、refund 或 transfer。

错误响应​

400: Bad Request

Response
{
"error": {
"message": "If passing an array with explicit keys (e.g. foo[0]=a&foo[1]=b) instead of as an array (e.g. foo[]=a&foo[]=b), the keys must be numeric and sequential starting from 0. You passed the keys `1`, we expected to have a key with the value `0`.",
"param": "expand",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_kCeAL5FAly5bkh?t=1734734555",
"type": "invalid_request_error"
}
}

401: Unauthorized

Response
{
"error": {
"type": "invalid_request_error",
"message": "Invalid API Key provided: sk_test_********************1234"
}
}