跳到主要内容

获取余额

返回账户余额,分为可用资金和待处理资金。

GET https://api.stripe.com/v1/balance

示例​

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

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

参数​

查询参数​

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

响应​

响应使用标准状态码:200 表示成功,401 表示 API 密钥无效。完整列表见 Stripe 的错误代码。

200: OK

Response
{
"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"
}
]
}
}

响应属性​

属性类型说明
object字符串始终为 balance。
available对象数组账户现在可以转账或提现的资金,按货币列出。每项包含 amount、currency 和 source_types。
pending对象数组尚未结算的资金,按货币列出。每项包含 amount、currency 和 source_types。
refund_and_dispute_prefunding对象用于覆盖未来退款、争议或负余额而留存的资金。包含 available 和 pending 两个数组。
livemode布尔值true 表示正式模式,false 表示测试模式。

错误响应​

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