残高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 | 文字列 | 必須 | パス変数の識別子 |