跳到主要内容

余额 API 功能

获取余额

获取 Stripe 账户的余额。

端点:https://api.stripe.com/v1/balance

操作:GET

示例

cURL 示例:

curl -X GET `https://api.stripe.com/v1/balance` \
-u <YOUR_SECRET_KEY>:

响应

响应将返回标准状态码。`

200: OK

{
"object": "balance",
"available": [
{
"amount": 0,
"currency": "usd",
"source_types": {
"card": 0
}
}
],
"livemode": false,
"pending": [
{
"amount": 0,
"currency": "usd",
"source_types": {
"card": 0
}
}
],
"refund_and_dispute_prefunding": {
"available": [
{
"amount": 0,
"currency": "usd"
}
],
"pending": [
{
"amount": 0,
"currency": "usd"
}
]
}
}

错误响应

400: Bad Request

{
"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

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

参数

查询参数
参数类型描述
expand[]字符串数组指定响应中应展开的字段。

检索余额交易

返回构成 Stripe 账户余额的交易(例如,扣款、转账、支付、退款等)。交易按排序顺序返回,最新交易排在最前面。

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

操作:GET

示例

cURL 示例:

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

响应

响应将返回标准状态码。

200: OK

{
"object": "balance_transaction",
"id": "tr_1234567890",
"amount": 1000,
"currency": "usd",
"description": "Payment for invoice",
"fee": 59,
"fee_details": [
{
"amount": 59,
"currency": "usd",
"description": "Stripe processing fees",
"type": "stripe_fee"
}
],
"net": 941,
"status": "available",
"type": "charge"
}

400: Bad Request

{
"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

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

参数

查询参数
参数类型描述
expand[]字符串数组指定响应中应展开的字段。
路径变量
名称类型必填描述
id字符串必填路径变量标识符