square_api_client/models/
tender.rs

1//! Model struct for Tender type
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6    enums::TenderType, AdditionalRecipient, DateTime, Money, TenderCardDetails, TenderCashDetails,
7};
8
9/// Represents a tender (i.e., a method of payment) used in a Square transaction.
10#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
11pub struct Tender {
12    /// The tender's unique ID.
13    pub id: Option<String>,
14    /// The ID of the transaction's associated location.
15    pub location_id: Option<String>,
16    /// The ID of the tender's associated transaction.
17    pub transaction_id: Option<String>,
18    /// **Read only** The timestamp for when the tender was created.
19    pub created_at: Option<DateTime>,
20    /// An optional note associated with the tender at the time of payment.
21    pub note: Option<String>,
22    /// The total amount of the tender, including `tip_money`. If the tender has a `payment_id`, the
23    /// `total_money` of the corresponding [Payment] will be equal to the `amount_money` of the
24    /// tender.
25    pub amount_money: Option<Money>,
26    /// The tip's amount of the tender.
27    pub tip_money: Option<Money>,
28    /// The amount of any Square processing fees applied to the tender.
29    ///
30    /// This field is not immediately populated when a new transaction is created. It is usually
31    /// available after about ten seconds.
32    pub processing_fee_money: Option<Money>,
33    /// If the tender is associated with a customer or represents a customer's card on file, this is
34    /// the ID of the associated customer.
35    pub customer_id: Option<String>,
36    /// **Required** The type of tender, such as `CARD` or `CASH`.
37    pub r#type: TenderType,
38    /// The details of the card tender.
39    ///
40    /// This value is present only if the value of `type` is `CARD`.
41    pub card_details: Option<TenderCardDetails>,
42    /// The details of the cash tender.
43    ///
44    /// This value is present only if the value of `type` is `CASH`.
45    pub cash_details: Option<TenderCashDetails>,
46    /// Additional recipients (other than the merchant) receiving a portion of this tender. For
47    /// example, fees assessed on the purchase by a third party integration.
48    #[deprecated]
49    pub additional_recipients: Option<Vec<AdditionalRecipient>>,
50    /// The ID of the [Payment] that corresponds to this tender. This value is only
51    /// present for payments created with the v2 Payments API.
52    pub payment_id: Option<String>,
53}