square_api_client/models/
invoice_payment_request.rs

1//! Model struct for InvoicePaymentRequest type.
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6    enums::{InvoiceAutomaticPaymentSource, InvoiceRequestMethod, InvoiceRequestType},
7    InvoicePaymentReminder, Money,
8};
9
10/// Represents a payment request for an [Invoice].
11///
12/// Invoices can specify a maximum of 13 payment requests, with up to 12 `INSTALLMENT` request
13/// types. For more information, see [Configuring payment
14/// requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).
15///
16/// Adding `INSTALLMENT` payment requests to an invoice requires an [Invoices Plus
17/// subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
18#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
19pub struct InvoicePaymentRequest {
20    /// The payment method for an automatic payment.
21    ///
22    /// The default value is `NONE`.
23    pub automatic_payment_source: Option<InvoiceAutomaticPaymentSource>,
24    /// The ID of the credit or debit card on file to charge for the payment request. To get the
25    /// cards on file for a customer, call
26    /// [ListCards](https://developer.squareup.com/reference/square/cards-api/list-cards) and
27    /// include the `customer_id` of the invoice recipient.
28    ///
29    /// Min Length: 1, Max Length: 255
30    pub card_id: Option<String>,
31    /// **Read only** The amount of the payment request, computed using the order amount and
32    /// information from the various payment request fields (`request_type`,
33    /// `fixed_amount_requested_money`, and `percentage_requested`).
34    pub computed_amount_money: Option<Money>,
35    ///The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format.
36    /// This field is required to create a payment request. If an `automatic_payment_source` is
37    /// defined for the request, Square charges the payment source on this date.
38    ///
39    /// After this date, the invoice becomes overdue. For example, a payment `due_date` of
40    /// 2021-03-09 with a `timezone` of America/Los_Angeles becomes overdue at midnight on March 9
41    /// in America/Los_Angeles (which equals a UTC timestamp of 2021-03-10T08:00:00Z).
42    pub due_date: Option<String>,
43    /// If the payment request specifies `DEPOSIT` or `INSTALLMENT` as the `request_type`, this
44    /// indicates the request amount. You cannot specify this when `request_type` is `BALANCE` or
45    /// when the payment request includes the `percentage_requested` field.
46    pub fixed_amount_requested_money: Option<Money>,
47    /// Specifies the amount for the payment request in percentage:
48    ///
49    /// - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total
50    /// amount.
51    /// - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's
52    /// total less the deposit, if requested. The sum of the `percentage_requested` in all
53    /// installment payment requests must be equal to 100.
54    ///
55    /// You cannot specify this when the payment `request_type` is `BALANCE` or when the payment
56    /// request specifies the `fixed_amount_requested_money` field.
57    pub percentage_requested: Option<String>,
58    /// A list of one or more reminders to send for the payment request.
59    pub reminders: Option<Vec<InvoicePaymentReminder>>,
60    /// Identifies the payment request type. This type defines how the payment request amount is
61    /// determined. This field is required to create a payment request.
62    pub request_type: Option<InvoiceRequestType>,
63    /// **Read only** If the most recent payment was a cash payment in a currency that rounds cash
64    /// payments (such as, `CAD` or `AUD`) and the payment is rounded from `computed_amount_money`
65    /// in the payment request, then this field specifies the rounding adjustment applied. This
66    /// amount might be negative.
67    pub rounding_adjustment_included_money: Option<Money>,
68    /// If set to true, the Square-hosted invoice page (the `public_url` field of the invoice)
69    /// provides a place for the customer to pay a tip.
70    ///
71    /// This field is allowed only on the final payment request and the payment `request_type` must
72    /// be `BALANCE` or `INSTALLMENT`.
73    pub tipping_enabled: Option<bool>,
74    /// **Read only** The amount of money already paid for the specific payment request. This amount
75    /// might include a rounding adjustment if the most recent invoice payment was in cash in a
76    /// currency that rounds cash payments (such as, `CAD` or `AUD`).
77    pub total_completed_amount_money: Option<Money>,
78    /// The Square-generated ID of the payment request in an [Invoice].
79    ///
80    /// Min Length: 1, Max Length: 255
81    pub uid: Option<String>,
82    /// Indicates how Square processes the payment request. DEPRECATED at version 2021-01-21.
83    /// Replaced by the `Invoice.delivery_method` and
84    /// `InvoicePaymentRequest.automatic_payment_source` fields.
85    ///
86    /// One of the following is required when creating an invoice:
87    ///
88    /// (Recommended) The `delivery_method` field of the invoice. To configure an automatic payment,
89    /// the `automatic_payment_source` field of the payment request is also required.
90    /// This `request_method` field. Note that `invoice` objects returned in responses do not
91    /// include `request_method`.
92    #[deprecated]
93    pub request_method: Option<InvoiceRequestMethod>,
94}