square_api_client/models/
transaction.rs

1//! Model struct for Transaction type
2
3use serde::Deserialize;
4
5use super::{enums::TransactionProduct, Address, DateTime, Refund, Tender};
6
7/// Represents a transaction processed with Square, either with the Connect API or with Square Point
8/// of Sale.
9///
10/// The tenders field of this object lists all methods of payment used to pay in the transaction.
11#[deprecated]
12#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
13pub struct Transaction {
14    /// The transaction's unique ID, issued by Square payments servers.
15    pub id: Option<String>,
16    /// The ID of the transaction's associated location.
17    pub location_id: Option<String>,
18    /// The timestamp for when the transaction was created.
19    pub created_at: Option<DateTime>,
20    /// The tenders used to pay in the transaction.
21    pub tenders: Option<Vec<Tender>>,
22    /// Refunds that have been applied to any tender in the transaction.
23    pub refunds: Option<Vec<Refund>>,
24    /// If the transaction was created with the `Charge` endpoint, this value
25    /// is the same as the value provided for the `reference_id` parameter in the request to that
26    /// endpoint. Otherwise, it is not set.
27    pub reference_id: Option<String>,
28    /// Indicates the Square product used to process a transaction.
29    pub product: Option<TransactionProduct>,
30    /// If the transaction was created in the Square Point of Sale app, this value is the ID
31    /// generated for the transaction by Square Point of Sale.
32    ///
33    /// This ID has no relationship to the transaction's canonical `id`, which is generated by
34    /// Square's backend servers. This value is generated for bookkeeping purposes, in case the
35    /// transaction cannot immediately be completed (for example, if the transaction is processed in
36    /// offline mode).
37    ///
38    /// It is not currently possible with the Connect API to perform a transaction lookup by this
39    /// value.
40    pub client_id: Option<String>,
41    /// The shipping address provided in the request, if any.
42    pub shipping_address: Option<Address>,
43    /// The order_id is an identifier for the order associated with this transaction, if any.
44    pub order_id: Option<String>,
45}