1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
|
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._request_options import RequestOptions
from stripe._singleton_api_resource import SingletonAPIResource
from stripe._stripe_object import StripeObject
from typing import ClassVar, List, Optional
from typing_extensions import Literal, NotRequired, Unpack
class Balance(SingletonAPIResource["Balance"]):
"""
This is an object representing your Stripe balance. You can retrieve it to see
the balance currently on your Stripe account.
You can also retrieve the balance history, which contains a list of
[transactions](https://stripe.com/docs/reporting/balance-transaction-types) that contributed to the balance
(charges, payouts, and so forth).
The available and pending amounts for each currency are broken down further by
payment source types.
Related guide: [Understanding Connect account balances](https://stripe.com/docs/connect/account-balances)
"""
OBJECT_NAME: ClassVar[Literal["balance"]] = "balance"
class Available(StripeObject):
class SourceTypes(StripeObject):
bank_account: Optional[int]
"""
Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
"""
card: Optional[int]
"""
Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
"""
fpx: Optional[int]
"""
Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
"""
amount: int
"""
Balance amount.
"""
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
source_types: Optional[SourceTypes]
_inner_class_types = {"source_types": SourceTypes}
class ConnectReserved(StripeObject):
class SourceTypes(StripeObject):
bank_account: Optional[int]
"""
Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
"""
card: Optional[int]
"""
Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
"""
fpx: Optional[int]
"""
Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
"""
amount: int
"""
Balance amount.
"""
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
source_types: Optional[SourceTypes]
_inner_class_types = {"source_types": SourceTypes}
class InstantAvailable(StripeObject):
class NetAvailable(StripeObject):
class SourceTypes(StripeObject):
bank_account: Optional[int]
"""
Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
"""
card: Optional[int]
"""
Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
"""
fpx: Optional[int]
"""
Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
"""
amount: int
"""
Net balance amount, subtracting fees from platform-set pricing.
"""
destination: str
"""
ID of the external account for this net balance (not expandable).
"""
source_types: Optional[SourceTypes]
_inner_class_types = {"source_types": SourceTypes}
class SourceTypes(StripeObject):
bank_account: Optional[int]
"""
Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
"""
card: Optional[int]
"""
Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
"""
fpx: Optional[int]
"""
Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
"""
amount: int
"""
Balance amount.
"""
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
net_available: Optional[List[NetAvailable]]
"""
Breakdown of balance by destination.
"""
source_types: Optional[SourceTypes]
_inner_class_types = {
"net_available": NetAvailable,
"source_types": SourceTypes,
}
class Issuing(StripeObject):
class Available(StripeObject):
class SourceTypes(StripeObject):
bank_account: Optional[int]
"""
Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
"""
card: Optional[int]
"""
Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
"""
fpx: Optional[int]
"""
Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
"""
amount: int
"""
Balance amount.
"""
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
source_types: Optional[SourceTypes]
_inner_class_types = {"source_types": SourceTypes}
available: List[Available]
"""
Funds that are available for use.
"""
_inner_class_types = {"available": Available}
class Pending(StripeObject):
class SourceTypes(StripeObject):
bank_account: Optional[int]
"""
Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
"""
card: Optional[int]
"""
Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
"""
fpx: Optional[int]
"""
Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
"""
amount: int
"""
Balance amount.
"""
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
source_types: Optional[SourceTypes]
_inner_class_types = {"source_types": SourceTypes}
class RetrieveParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
available: List[Available]
"""
Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts). You can find the available balance for each currency and payment type in the `source_types` property.
"""
connect_reserved: Optional[List[ConnectReserved]]
"""
Funds held due to negative balances on connected accounts where [account.controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the `source_types` property.
"""
instant_available: Optional[List[InstantAvailable]]
"""
Funds that you can pay out using Instant Payouts.
"""
issuing: Optional[Issuing]
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["balance"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
pending: List[Pending]
"""
Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the `source_types` property.
"""
@classmethod
def retrieve(cls, **params: Unpack["Balance.RetrieveParams"]) -> "Balance":
"""
Retrieves the current account balance, based on the authentication that was used to make the request.
For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances).
"""
instance = cls(None, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, **params: Unpack["Balance.RetrieveParams"]
) -> "Balance":
"""
Retrieves the current account balance, based on the authentication that was used to make the request.
For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances).
"""
instance = cls(None, **params)
await instance.refresh_async()
return instance
@classmethod
def class_url(cls):
return "/v1/balance"
_inner_class_types = {
"available": Available,
"connect_reserved": ConnectReserved,
"instant_available": InstantAvailable,
"issuing": Issuing,
"pending": Pending,
}
|