Improve subscription UI with large tier buttons

- Replace dropdown tier selection with attractive visual buttons
- Add tier-button CSS with hover effects and selection states
- Remove 'or pay by card' divider from subscription form for cleaner UI
- Update JavaScript to handle tier button selection events
- Fix Stripe module import conflict by renaming stripe directory to stripe_config
- Add responsive grid layout for tier buttons on mobile devices
This commit is contained in:
2025-10-07 17:22:51 +01:00
parent bfdcee8602
commit 3ddbc40bb5
2655 changed files with 516264 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe.financial_connections._account import Account as Account
from stripe.financial_connections._account_owner import (
AccountOwner as AccountOwner,
)
from stripe.financial_connections._account_owner_service import (
AccountOwnerService as AccountOwnerService,
)
from stripe.financial_connections._account_ownership import (
AccountOwnership as AccountOwnership,
)
from stripe.financial_connections._account_service import (
AccountService as AccountService,
)
from stripe.financial_connections._session import Session as Session
from stripe.financial_connections._session_service import (
SessionService as SessionService,
)
from stripe.financial_connections._transaction import (
Transaction as Transaction,
)
from stripe.financial_connections._transaction_service import (
TransactionService as TransactionService,
)

View File

@@ -0,0 +1,956 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._request_options import RequestOptions
from stripe._stripe_object import StripeObject
from stripe._util import class_method_variant, sanitize_id
from typing import ClassVar, Dict, List, Optional, cast, overload
from typing_extensions import (
Literal,
NotRequired,
TypedDict,
Unpack,
TYPE_CHECKING,
)
if TYPE_CHECKING:
from stripe._account import Account as AccountResource
from stripe._customer import Customer
from stripe.financial_connections._account_owner import AccountOwner
from stripe.financial_connections._account_ownership import (
AccountOwnership,
)
class Account(ListableAPIResource["Account"]):
"""
A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.account"]] = (
"financial_connections.account"
)
class AccountHolder(StripeObject):
account: Optional[ExpandableField["AccountResource"]]
"""
The ID of the Stripe account this account belongs to. Should only be present if `account_holder.type` is `account`.
"""
customer: Optional[ExpandableField["Customer"]]
"""
ID of the Stripe customer this account belongs to. Present if and only if `account_holder.type` is `customer`.
"""
type: Literal["account", "customer"]
"""
Type of account holder that this account belongs to.
"""
class Balance(StripeObject):
class Cash(StripeObject):
available: Optional[Dict[str, int]]
"""
The funds available to the account holder. Typically this is the current balance after subtracting any outbound pending transactions and adding any inbound pending transactions.
Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder.
"""
class Credit(StripeObject):
used: Optional[Dict[str, int]]
"""
The credit that has been used by the account holder.
Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder.
"""
as_of: int
"""
The time that the external institution calculated this balance. Measured in seconds since the Unix epoch.
"""
cash: Optional[Cash]
credit: Optional[Credit]
current: Dict[str, int]
"""
The balances owed to (or by) the account holder, before subtracting any outbound pending transactions or adding any inbound pending transactions.
Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder.
"""
type: Literal["cash", "credit"]
"""
The `type` of the balance. An additional hash is included on the balance with a name matching this value.
"""
_inner_class_types = {"cash": Cash, "credit": Credit}
class BalanceRefresh(StripeObject):
last_attempted_at: int
"""
The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch.
"""
next_refresh_available_at: Optional[int]
"""
Time at which the next balance refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch.
"""
status: Literal["failed", "pending", "succeeded"]
"""
The status of the last refresh attempt.
"""
class OwnershipRefresh(StripeObject):
last_attempted_at: int
"""
The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch.
"""
next_refresh_available_at: Optional[int]
"""
Time at which the next ownership refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch.
"""
status: Literal["failed", "pending", "succeeded"]
"""
The status of the last refresh attempt.
"""
class TransactionRefresh(StripeObject):
id: str
"""
Unique identifier for the object.
"""
last_attempted_at: int
"""
The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch.
"""
next_refresh_available_at: Optional[int]
"""
Time at which the next transaction refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch.
"""
status: Literal["failed", "pending", "succeeded"]
"""
The status of the last refresh attempt.
"""
class DisconnectParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class ListOwnersParams(RequestOptions):
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
ownership: str
"""
The ID of the ownership object to fetch owners from.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
class ListParams(RequestOptions):
account_holder: NotRequired["Account.ListParamsAccountHolder"]
"""
If present, only return accounts that belong to the specified account holder. `account_holder[customer]` and `account_holder[account]` are mutually exclusive.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
session: NotRequired[str]
"""
If present, only return accounts that were collected as part of the given session.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
class ListParamsAccountHolder(TypedDict):
account: NotRequired[str]
"""
The ID of the Stripe account whose accounts will be retrieved.
"""
customer: NotRequired[str]
"""
The ID of the Stripe customer whose accounts will be retrieved.
"""
class RefreshAccountParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
features: List[Literal["balance", "ownership", "transactions"]]
"""
The list of account features that you would like to refresh.
"""
class RetrieveParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class SubscribeParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
features: List[Literal["transactions"]]
"""
The list of account features to which you would like to subscribe.
"""
class UnsubscribeParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
features: List[Literal["transactions"]]
"""
The list of account features from which you would like to unsubscribe.
"""
account_holder: Optional[AccountHolder]
"""
The account holder that this account belongs to.
"""
balance: Optional[Balance]
"""
The most recent information about the account's balance.
"""
balance_refresh: Optional[BalanceRefresh]
"""
The state of the most recent attempt to refresh the account balance.
"""
category: Literal["cash", "credit", "investment", "other"]
"""
The type of the account. Account category is further divided in `subcategory`.
"""
created: int
"""
Time at which the object was created. Measured in seconds since the Unix epoch.
"""
display_name: Optional[str]
"""
A human-readable name that has been assigned to this account, either by the account holder or by the institution.
"""
id: str
"""
Unique identifier for the object.
"""
institution_name: str
"""
The name of the institution that holds this account.
"""
last4: Optional[str]
"""
The last 4 digits of the account number. If present, this will be 4 numeric characters.
"""
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["financial_connections.account"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
ownership: Optional[ExpandableField["AccountOwnership"]]
"""
The most recent information about the account's owners.
"""
ownership_refresh: Optional[OwnershipRefresh]
"""
The state of the most recent attempt to refresh the account owners.
"""
permissions: Optional[
List[
Literal["balances", "ownership", "payment_method", "transactions"]
]
]
"""
The list of permissions granted by this account.
"""
status: Literal["active", "disconnected", "inactive"]
"""
The status of the link to the account.
"""
subcategory: Literal[
"checking",
"credit_card",
"line_of_credit",
"mortgage",
"other",
"savings",
]
"""
If `category` is `cash`, one of:
- `checking`
- `savings`
- `other`
If `category` is `credit`, one of:
- `mortgage`
- `line_of_credit`
- `credit_card`
- `other`
If `category` is `investment` or `other`, this will be `other`.
"""
subscriptions: Optional[List[Literal["transactions"]]]
"""
The list of data refresh subscriptions requested on this account.
"""
supported_payment_method_types: List[Literal["link", "us_bank_account"]]
"""
The [PaymentMethod type](https://stripe.com/docs/api/payment_methods/object#payment_method_object-type)(s) that can be created from this account.
"""
transaction_refresh: Optional[TransactionRefresh]
"""
The state of the most recent attempt to refresh the account transactions.
"""
@classmethod
def _cls_disconnect(
cls, account: str, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def disconnect(
account: str, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@overload
def disconnect(
self, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@class_method_variant("_cls_disconnect")
def disconnect( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_disconnect_async(
cls, account: str, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def disconnect_async(
account: str, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@overload
async def disconnect_async(
self, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@class_method_variant("_cls_disconnect_async")
async def disconnect_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.DisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def list(
cls, **params: Unpack["Account.ListParams"]
) -> ListObject["Account"]:
"""
Returns a list of Financial Connections Account objects.
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
async def list_async(
cls, **params: Unpack["Account.ListParams"]
) -> ListObject["Account"]:
"""
Returns a list of Financial Connections Account objects.
"""
result = await cls._static_request_async(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
def _cls_list_owners(
cls, account: str, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
cls._static_request(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def list_owners(
account: str, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@overload
def list_owners(
self, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@class_method_variant("_cls_list_owners")
def list_owners( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
self._request(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_list_owners_async(
cls, account: str, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
await cls._static_request_async(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def list_owners_async(
account: str, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@overload
async def list_owners_async(
self, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@class_method_variant("_cls_list_owners_async")
async def list_owners_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.ListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
await self._request_async(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def _cls_refresh_account(
cls, account: str, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def refresh_account(
account: str, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@overload
def refresh_account(
self, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_refresh_account")
def refresh_account( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_refresh_account_async(
cls, account: str, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def refresh_account_async(
account: str, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@overload
async def refresh_account_async(
self, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_refresh_account_async")
async def refresh_account_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.RefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def retrieve(
cls, id: str, **params: Unpack["Account.RetrieveParams"]
) -> "Account":
"""
Retrieves the details of an Financial Connections Account.
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["Account.RetrieveParams"]
) -> "Account":
"""
Retrieves the details of an Financial Connections Account.
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance
@classmethod
def _cls_subscribe(
cls, account: str, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def subscribe(
account: str, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
...
@overload
def subscribe(
self, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_subscribe")
def subscribe( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_subscribe_async(
cls, account: str, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def subscribe_async(
account: str, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
...
@overload
async def subscribe_async(
self, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_subscribe_async")
async def subscribe_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.SubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def _cls_unsubscribe(
cls, account: str, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def unsubscribe(
account: str, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@overload
def unsubscribe(
self, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_unsubscribe")
def unsubscribe( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_unsubscribe_async(
cls, account: str, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def unsubscribe_async(
account: str, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@overload
async def unsubscribe_async(
self, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_unsubscribe_async")
async def unsubscribe_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["Account.UnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
_inner_class_types = {
"account_holder": AccountHolder,
"balance": Balance,
"balance_refresh": BalanceRefresh,
"ownership_refresh": OwnershipRefresh,
"transaction_refresh": TransactionRefresh,
}

View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from typing import ClassVar, Optional
from typing_extensions import Literal
class AccountOwner(StripeObject):
"""
Describes an owner of an account.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.account_owner"]] = (
"financial_connections.account_owner"
)
email: Optional[str]
"""
The email address of the owner.
"""
id: str
"""
Unique identifier for the object.
"""
name: str
"""
The full name of the owner.
"""
object: Literal["financial_connections.account_owner"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
ownership: str
"""
The ownership object that this owner belongs to.
"""
phone: Optional[str]
"""
The raw phone number of the owner.
"""
raw_address: Optional[str]
"""
The raw physical address of the owner.
"""
refreshed_at: Optional[int]
"""
The timestamp of the refresh that updated this owner.
"""

View File

@@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from stripe.financial_connections._account_owner import AccountOwner
from typing import List, cast
from typing_extensions import NotRequired, TypedDict
class AccountOwnerService(StripeService):
class ListParams(TypedDict):
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
ownership: str
"""
The ID of the ownership object to fetch owners from.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
def list(
self,
account: str,
params: "AccountOwnerService.ListParams",
options: RequestOptions = {},
) -> ListObject[AccountOwner]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject[AccountOwner],
self._request(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
account: str,
params: "AccountOwnerService.ListParams",
options: RequestOptions = {},
) -> ListObject[AccountOwner]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject[AccountOwner],
await self._request_async(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._stripe_object import StripeObject
from typing import ClassVar
from typing_extensions import Literal, TYPE_CHECKING
if TYPE_CHECKING:
from stripe.financial_connections._account_owner import AccountOwner
class AccountOwnership(StripeObject):
"""
Describes a snapshot of the owners of an account at a particular point in time.
"""
OBJECT_NAME: ClassVar[
Literal["financial_connections.account_ownership"]
] = "financial_connections.account_ownership"
created: int
"""
Time at which the object was created. Measured in seconds since the Unix epoch.
"""
id: str
"""
Unique identifier for the object.
"""
object: Literal["financial_connections.account_ownership"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
owners: ListObject["AccountOwner"]
"""
A paginated list of owners for this account.
"""

View File

@@ -0,0 +1,366 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from stripe.financial_connections._account import Account
from stripe.financial_connections._account_owner_service import (
AccountOwnerService,
)
from typing import List, cast
from typing_extensions import Literal, NotRequired, TypedDict
class AccountService(StripeService):
def __init__(self, requestor):
super().__init__(requestor)
self.owners = AccountOwnerService(self._requestor)
class DisconnectParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class ListParams(TypedDict):
account_holder: NotRequired["AccountService.ListParamsAccountHolder"]
"""
If present, only return accounts that belong to the specified account holder. `account_holder[customer]` and `account_holder[account]` are mutually exclusive.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
session: NotRequired[str]
"""
If present, only return accounts that were collected as part of the given session.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
class ListParamsAccountHolder(TypedDict):
account: NotRequired[str]
"""
The ID of the Stripe account whose accounts will be retrieved.
"""
customer: NotRequired[str]
"""
The ID of the Stripe customer whose accounts will be retrieved.
"""
class RefreshParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
features: List[Literal["balance", "ownership", "transactions"]]
"""
The list of account features that you would like to refresh.
"""
class RetrieveParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class SubscribeParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
features: List[Literal["transactions"]]
"""
The list of account features to which you would like to subscribe.
"""
class UnsubscribeParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
features: List[Literal["transactions"]]
"""
The list of account features from which you would like to unsubscribe.
"""
def list(
self,
params: "AccountService.ListParams" = {},
options: RequestOptions = {},
) -> ListObject[Account]:
"""
Returns a list of Financial Connections Account objects.
"""
return cast(
ListObject[Account],
self._request(
"get",
"/v1/financial_connections/accounts",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: "AccountService.ListParams" = {},
options: RequestOptions = {},
) -> ListObject[Account]:
"""
Returns a list of Financial Connections Account objects.
"""
return cast(
ListObject[Account],
await self._request_async(
"get",
"/v1/financial_connections/accounts",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
account: str,
params: "AccountService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Account:
"""
Retrieves the details of an Financial Connections Account.
"""
return cast(
Account,
self._request(
"get",
"/v1/financial_connections/accounts/{account}".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
account: str,
params: "AccountService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Account:
"""
Retrieves the details of an Financial Connections Account.
"""
return cast(
Account,
await self._request_async(
"get",
"/v1/financial_connections/accounts/{account}".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def disconnect(
self,
account: str,
params: "AccountService.DisconnectParams" = {},
options: RequestOptions = {},
) -> Account:
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
Account,
self._request(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def disconnect_async(
self,
account: str,
params: "AccountService.DisconnectParams" = {},
options: RequestOptions = {},
) -> Account:
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
Account,
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def refresh(
self,
account: str,
params: "AccountService.RefreshParams",
options: RequestOptions = {},
) -> Account:
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
Account,
self._request(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def refresh_async(
self,
account: str,
params: "AccountService.RefreshParams",
options: RequestOptions = {},
) -> Account:
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
Account,
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def subscribe(
self,
account: str,
params: "AccountService.SubscribeParams",
options: RequestOptions = {},
) -> Account:
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
Account,
self._request(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def subscribe_async(
self,
account: str,
params: "AccountService.SubscribeParams",
options: RequestOptions = {},
) -> Account:
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
Account,
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def unsubscribe(
self,
account: str,
params: "AccountService.UnsubscribeParams",
options: RequestOptions = {},
) -> Account:
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
Account,
self._request(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def unsubscribe_async(
self,
account: str,
params: "AccountService.UnsubscribeParams",
options: RequestOptions = {},
) -> Account:
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
Account,
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,232 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._createable_api_resource import CreateableAPIResource
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe._stripe_object import StripeObject
from typing import ClassVar, List, Optional, cast
from typing_extensions import (
Literal,
NotRequired,
TypedDict,
Unpack,
TYPE_CHECKING,
)
if TYPE_CHECKING:
from stripe._account import Account as AccountResource
from stripe._customer import Customer
from stripe.financial_connections._account import (
Account as FinancialConnectionsAccountResource,
)
class Session(CreateableAPIResource["Session"]):
"""
A Financial Connections Session is the secure way to programmatically launch the client-side Stripe.js modal that lets your users link their accounts.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.session"]] = (
"financial_connections.session"
)
class AccountHolder(StripeObject):
account: Optional[ExpandableField["AccountResource"]]
"""
The ID of the Stripe account this account belongs to. Should only be present if `account_holder.type` is `account`.
"""
customer: Optional[ExpandableField["Customer"]]
"""
ID of the Stripe customer this account belongs to. Present if and only if `account_holder.type` is `customer`.
"""
type: Literal["account", "customer"]
"""
Type of account holder that this account belongs to.
"""
class Filters(StripeObject):
account_subcategories: Optional[
List[
Literal[
"checking",
"credit_card",
"line_of_credit",
"mortgage",
"savings",
]
]
]
"""
Restricts the Session to subcategories of accounts that can be linked. Valid subcategories are: `checking`, `savings`, `mortgage`, `line_of_credit`, `credit_card`.
"""
countries: Optional[List[str]]
"""
List of countries from which to filter accounts.
"""
class CreateParams(RequestOptions):
account_holder: "Session.CreateParamsAccountHolder"
"""
The account holder to link accounts for.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
filters: NotRequired["Session.CreateParamsFilters"]
"""
Filters to restrict the kinds of accounts to collect.
"""
permissions: List[
Literal["balances", "ownership", "payment_method", "transactions"]
]
"""
List of data features that you would like to request access to.
Possible values are `balances`, `transactions`, `ownership`, and `payment_method`.
"""
prefetch: NotRequired[
List[Literal["balances", "ownership", "transactions"]]
]
"""
List of data features that you would like to retrieve upon account creation.
"""
return_url: NotRequired[str]
"""
For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
"""
class CreateParamsAccountHolder(TypedDict):
account: NotRequired[str]
"""
The ID of the Stripe account whose accounts will be retrieved. Should only be present if `type` is `account`.
"""
customer: NotRequired[str]
"""
The ID of the Stripe customer whose accounts will be retrieved. Should only be present if `type` is `customer`.
"""
type: Literal["account", "customer"]
"""
Type of account holder to collect accounts for.
"""
class CreateParamsFilters(TypedDict):
account_subcategories: NotRequired[
List[
Literal[
"checking",
"credit_card",
"line_of_credit",
"mortgage",
"savings",
]
]
]
"""
Restricts the Session to subcategories of accounts that can be linked. Valid subcategories are: `checking`, `savings`, `mortgage`, `line_of_credit`, `credit_card`.
"""
countries: NotRequired[List[str]]
"""
List of countries from which to collect accounts.
"""
class RetrieveParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
account_holder: Optional[AccountHolder]
"""
The account holder for whom accounts are collected in this session.
"""
accounts: ListObject["FinancialConnectionsAccountResource"]
"""
The accounts that were collected as part of this Session.
"""
client_secret: str
"""
A value that will be passed to the client to launch the authentication flow.
"""
filters: Optional[Filters]
id: str
"""
Unique identifier for the object.
"""
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["financial_connections.session"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
permissions: List[
Literal["balances", "ownership", "payment_method", "transactions"]
]
"""
Permissions requested for accounts collected during this session.
"""
prefetch: Optional[List[Literal["balances", "ownership", "transactions"]]]
"""
Data features requested to be retrieved upon account creation.
"""
return_url: Optional[str]
"""
For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
"""
@classmethod
def create(cls, **params: Unpack["Session.CreateParams"]) -> "Session":
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
"Session",
cls._static_request(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
async def create_async(
cls, **params: Unpack["Session.CreateParams"]
) -> "Session":
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
"Session",
await cls._static_request_async(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
def retrieve(
cls, id: str, **params: Unpack["Session.RetrieveParams"]
) -> "Session":
"""
Retrieves the details of a Financial Connections Session
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["Session.RetrieveParams"]
) -> "Session":
"""
Retrieves the details of a Financial Connections Session
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance
_inner_class_types = {"account_holder": AccountHolder, "filters": Filters}

View File

@@ -0,0 +1,168 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from stripe.financial_connections._session import Session
from typing import List, cast
from typing_extensions import Literal, NotRequired, TypedDict
class SessionService(StripeService):
class CreateParams(TypedDict):
account_holder: "SessionService.CreateParamsAccountHolder"
"""
The account holder to link accounts for.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
filters: NotRequired["SessionService.CreateParamsFilters"]
"""
Filters to restrict the kinds of accounts to collect.
"""
permissions: List[
Literal["balances", "ownership", "payment_method", "transactions"]
]
"""
List of data features that you would like to request access to.
Possible values are `balances`, `transactions`, `ownership`, and `payment_method`.
"""
prefetch: NotRequired[
List[Literal["balances", "ownership", "transactions"]]
]
"""
List of data features that you would like to retrieve upon account creation.
"""
return_url: NotRequired[str]
"""
For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
"""
class CreateParamsAccountHolder(TypedDict):
account: NotRequired[str]
"""
The ID of the Stripe account whose accounts will be retrieved. Should only be present if `type` is `account`.
"""
customer: NotRequired[str]
"""
The ID of the Stripe customer whose accounts will be retrieved. Should only be present if `type` is `customer`.
"""
type: Literal["account", "customer"]
"""
Type of account holder to collect accounts for.
"""
class CreateParamsFilters(TypedDict):
account_subcategories: NotRequired[
List[
Literal[
"checking",
"credit_card",
"line_of_credit",
"mortgage",
"savings",
]
]
]
"""
Restricts the Session to subcategories of accounts that can be linked. Valid subcategories are: `checking`, `savings`, `mortgage`, `line_of_credit`, `credit_card`.
"""
countries: NotRequired[List[str]]
"""
List of countries from which to collect accounts.
"""
class RetrieveParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
def retrieve(
self,
session: str,
params: "SessionService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Session:
"""
Retrieves the details of a Financial Connections Session
"""
return cast(
Session,
self._request(
"get",
"/v1/financial_connections/sessions/{session}".format(
session=sanitize_id(session),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
session: str,
params: "SessionService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Session:
"""
Retrieves the details of a Financial Connections Session
"""
return cast(
Session,
await self._request_async(
"get",
"/v1/financial_connections/sessions/{session}".format(
session=sanitize_id(session),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def create(
self,
params: "SessionService.CreateParams",
options: RequestOptions = {},
) -> Session:
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
Session,
self._request(
"post",
"/v1/financial_connections/sessions",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "SessionService.CreateParams",
options: RequestOptions = {},
) -> Session:
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
Session,
await self._request_async(
"post",
"/v1/financial_connections/sessions",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,200 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._request_options import RequestOptions
from stripe._stripe_object import StripeObject
from typing import ClassVar, List, Optional
from typing_extensions import Literal, NotRequired, TypedDict, Unpack
class Transaction(ListableAPIResource["Transaction"]):
"""
A Transaction represents a real transaction that affects a Financial Connections Account balance.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.transaction"]] = (
"financial_connections.transaction"
)
class StatusTransitions(StripeObject):
posted_at: Optional[int]
"""
Time at which this transaction posted. Measured in seconds since the Unix epoch.
"""
void_at: Optional[int]
"""
Time at which this transaction was voided. Measured in seconds since the Unix epoch.
"""
class ListParams(RequestOptions):
account: str
"""
The ID of the Stripe account whose transactions will be retrieved.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
transacted_at: NotRequired["Transaction.ListParamsTransactedAt|int"]
"""
A filter on the list based on the object `transacted_at` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:
"""
transaction_refresh: NotRequired[
"Transaction.ListParamsTransactionRefresh"
]
"""
A filter on the list based on the object `transaction_refresh` field. The value can be a dictionary with the following options:
"""
class ListParamsTransactedAt(TypedDict):
gt: NotRequired[int]
"""
Minimum value to filter by (exclusive)
"""
gte: NotRequired[int]
"""
Minimum value to filter by (inclusive)
"""
lt: NotRequired[int]
"""
Maximum value to filter by (exclusive)
"""
lte: NotRequired[int]
"""
Maximum value to filter by (inclusive)
"""
class ListParamsTransactionRefresh(TypedDict):
after: str
"""
Return results where the transactions were created or updated by a refresh that took place after this refresh (non-inclusive).
"""
class RetrieveParams(RequestOptions):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
account: str
"""
The ID of the Financial Connections Account this transaction belongs to.
"""
amount: int
"""
The amount of this transaction, in cents (or local equivalent).
"""
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).
"""
description: str
"""
The description of this transaction.
"""
id: str
"""
Unique identifier for the object.
"""
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["financial_connections.transaction"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
status: Literal["pending", "posted", "void"]
"""
The status of the transaction.
"""
status_transitions: StatusTransitions
transacted_at: int
"""
Time at which the transaction was transacted. Measured in seconds since the Unix epoch.
"""
transaction_refresh: str
"""
The token of the transaction refresh that last updated or created this transaction.
"""
updated: int
"""
Time at which the object was last updated. Measured in seconds since the Unix epoch.
"""
@classmethod
def list(
cls, **params: Unpack["Transaction.ListParams"]
) -> ListObject["Transaction"]:
"""
Returns a list of Financial Connections Transaction objects.
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
async def list_async(
cls, **params: Unpack["Transaction.ListParams"]
) -> ListObject["Transaction"]:
"""
Returns a list of Financial Connections Transaction objects.
"""
result = await cls._static_request_async(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
def retrieve(
cls, id: str, **params: Unpack["Transaction.RetrieveParams"]
) -> "Transaction":
"""
Retrieves the details of a Financial Connections Transaction
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["Transaction.RetrieveParams"]
) -> "Transaction":
"""
Retrieves the details of a Financial Connections Transaction
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance
_inner_class_types = {"status_transitions": StatusTransitions}

View File

@@ -0,0 +1,161 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from stripe.financial_connections._transaction import Transaction
from typing import List, cast
from typing_extensions import NotRequired, TypedDict
class TransactionService(StripeService):
class ListParams(TypedDict):
account: str
"""
The ID of the Stripe account whose transactions will be retrieved.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
transacted_at: NotRequired[
"TransactionService.ListParamsTransactedAt|int"
]
"""
A filter on the list based on the object `transacted_at` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:
"""
transaction_refresh: NotRequired[
"TransactionService.ListParamsTransactionRefresh"
]
"""
A filter on the list based on the object `transaction_refresh` field. The value can be a dictionary with the following options:
"""
class ListParamsTransactedAt(TypedDict):
gt: NotRequired[int]
"""
Minimum value to filter by (exclusive)
"""
gte: NotRequired[int]
"""
Minimum value to filter by (inclusive)
"""
lt: NotRequired[int]
"""
Maximum value to filter by (exclusive)
"""
lte: NotRequired[int]
"""
Maximum value to filter by (inclusive)
"""
class ListParamsTransactionRefresh(TypedDict):
after: str
"""
Return results where the transactions were created or updated by a refresh that took place after this refresh (non-inclusive).
"""
class RetrieveParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
def list(
self,
params: "TransactionService.ListParams",
options: RequestOptions = {},
) -> ListObject[Transaction]:
"""
Returns a list of Financial Connections Transaction objects.
"""
return cast(
ListObject[Transaction],
self._request(
"get",
"/v1/financial_connections/transactions",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: "TransactionService.ListParams",
options: RequestOptions = {},
) -> ListObject[Transaction]:
"""
Returns a list of Financial Connections Transaction objects.
"""
return cast(
ListObject[Transaction],
await self._request_async(
"get",
"/v1/financial_connections/transactions",
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
transaction: str,
params: "TransactionService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Transaction:
"""
Retrieves the details of a Financial Connections Transaction
"""
return cast(
Transaction,
self._request(
"get",
"/v1/financial_connections/transactions/{transaction}".format(
transaction=sanitize_id(transaction),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
transaction: str,
params: "TransactionService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Transaction:
"""
Retrieves the details of a Financial Connections Transaction
"""
return cast(
Transaction,
await self._request_async(
"get",
"/v1/financial_connections/transactions/{transaction}".format(
transaction=sanitize_id(transaction),
),
api_mode="V1",
base_address="api",
params=params,
options=options,
),
)