Documentation
¶
Index ¶
Constants ¶
const (
// DefaultPageSize is number of elements per page.
DefaultPageSize = 100
)
Variables ¶
var ErrReadTargetUnknown = errors.New("unsupported read target")
Functions ¶
This section is empty.
Types ¶
type FinancialAccount ¶
type FinancialAccount struct {
Id string `json:"finAccId"`
ConnectedAccountId string `json:"conAccId"`
}
FinancialAccount represents an association between Connected Account and Financial account. When ConnectedAccountId is empty then this financial account belongs to the main platform account. Additionally, this struct is used to construct aggregate page token and that is the reason the `json` tags are used. This is a context for the next page token.
type ReadParamsOpts ¶
type ReadParamsOpts struct {
// ReadForConnectedAccounts enables reading data for specified connected accounts.
// This takes precedence over ReadForAllConnectedAccounts.
ReadForConnectedAccounts []string
// ReadForAllConnectedAccounts enables reading data from all connected accounts
// instead of only the main account. When true, the connector parallelizes reads
// across all connected accounts and adds the connected account ID to each result row.
ReadForAllConnectedAccounts bool
}
ReadParamsOpts defines optional parameters for the Read operation.
type ReadScope ¶
type ReadScope int
ReadScope defines the target scope for a read operation.
It is the high-level branching point for the read execution flow. Non-Treasury scopes execute standard API reads against the platform account or connected accounts. Treasury scopes execute reads against Treasury financial accounts.
type Strategy ¶
type Strategy struct {
// contains filtered or unexported fields
}
func NewStrategy ¶
func (*Strategy) Read ¶
func (s *Strategy) Read(ctx context.Context, params common.ReadParams) (*common.ReadResult, error)
Read retrieves a list of records for the specified object name.
Supported features:
- NextPage: Pagination is supported. For Connected Accounts and Treasury financial accounts, next-page tokens use aggregate contextual format.
- Fields: JSONPath-based field selection and on-demand expansion are supported. See https://docs.stripe.com/api/expanding_objects.
- Incremental Reading: Not supported; the "Since" parameter is ignored.
Domain:
- Objects owned by the main platform account and Connected Accounts are supported.
- Treasury API objects are read through their associated financial accounts.
Treasury reads:
- Treasury objects require a financial_account ID in the request.
- The connector first calls: https://docs.stripe.com/api/treasury/financial_accounts/list
- It then calls the object endpoint for each financial account, for example: https://docs.stripe.com/api/treasury/transactions/list https://docs.stripe.com/api/treasury/inbound_transfers/list https://docs.stripe.com/api/treasury/outbound_transfers/list https://docs.stripe.com/api/treasury/outbound_payments/list https://docs.stripe.com/api/treasury/credit_reversals/list https://docs.stripe.com/api/treasury/debit_reversals/list
- For Connected Accounts, the same flow is used with the Stripe-Account header set to the connected account ID.
Rate limits and concurrency:
- Stripe rate limits apply per API key and per connected account: https://docs.stripe.com/rate-limits
- Financial accounts are discovered sequentially.
- Treasury reads are executed in parallel up to maxReadConcurrency.
- Lower maxReadConcurrency if rate-limit errors occur.
Parallelization:
- Connected accounts and financial accounts are discovered sequentially.
- Requests are then parallelized to improve throughput.
Relevant Stripe documentation:
- Expanding objects fields: https://docs.stripe.com/api/expanding_objects
- Connected accounts: https://docs.stripe.com/api/connected-accounts
- Financial Accounts List: https://docs.stripe.com/api/treasury/financial_accounts/list
- Treasury overview: https://docs.stripe.com/treasury