stripe/model/
balance_transaction.rs

1use serde::{Serialize, Deserialize};
2use super::Fee;
3/**Balance transactions represent funds moving through your Stripe account.
4Stripe creates them for every type of transaction that enters or leaves your Stripe account balance.
5
6Related guide: [Balance transaction types](https://stripe.com/docs/reports/balance-transaction-types)*/
7#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8pub struct BalanceTransaction {
9    ///Gross amount of this transaction (in cents (or local equivalent)). A positive value represents funds charged to another party, and a negative value represents funds sent to another party.
10    pub amount: i64,
11    ///The date that the transaction's net funds become available in the Stripe balance.
12    pub available_on: i64,
13    ///Time at which the object was created. Measured in seconds since the Unix epoch.
14    pub created: i64,
15    ///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).
16    pub currency: String,
17    ///An arbitrary string attached to the object. Often useful for displaying to users.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub description: Option<String>,
20    ///If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the `amount` in currency A, multipled by the `exchange_rate`, equals the `amount` in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntent's `amount` is `1000` and `currency` is `eur`. If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's `amount` is `1234`, its `currency` is `usd`, and the `exchange_rate` is `1.234`.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub exchange_rate: Option<f64>,
23    ///Fees (in cents (or local equivalent)) paid for this transaction. Represented as a positive integer when assessed.
24    pub fee: i64,
25    ///Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
26    pub fee_details: Vec<Fee>,
27    ///Unique identifier for the object.
28    pub id: String,
29    ///Net impact to a Stripe balance (in cents (or local equivalent)). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by `amount` - `fee`
30    pub net: i64,
31    ///String representing the object's type. Objects of the same type share the same value.
32    pub object: String,
33    ///Learn more about how [reporting categories](https://stripe.com/docs/reports/reporting-categories) can help you understand balance transactions from an accounting perspective.
34    pub reporting_category: String,
35    ///This transaction relates to the Stripe object.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub source: Option<serde_json::Value>,
38    ///The transaction's net funds status in the Stripe balance, which are either `available` or `pending`.
39    pub status: String,
40    ///Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types). To classify transactions for accounting purposes, consider `reporting_category` instead.
41    #[serde(rename = "type")]
42    pub type_: String,
43}
44impl std::fmt::Display for BalanceTransaction {
45    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
46        write!(f, "{}", serde_json::to_string(self).unwrap())
47    }
48}