square_api_client/models/refund_payment_request.rs
1//! Model struct for RefundPaymentRequest type
2
3use serde::Serialize;
4
5use super::Money;
6
7/// This is a model struct for RefundPaymentRequest type
8#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize)]
9pub struct RefundPaymentRequest {
10 /// A unique string that identifies this `RefundPayment` request. The key can be any valid
11 /// string but must be unique for every `RefundPayment` request.
12 ///
13 /// Keys are limited to a max of 45 characters - however, the number of allowed characters might
14 /// be less than 45, if multi-byte characters are used.
15 ///
16 /// For more information, see
17 /// [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
18 pub idempotency_key: String,
19 /// The amount of money to refund.
20 ///
21 /// This amount cannot be more than the `total_money` value of the payment minus the total
22 /// amount of all previously completed refunds for this payment.
23 ///
24 /// This amount must be specified in the smallest denomination of the applicable currency (for
25 /// example, US dollar amounts are specified in cents). For more information, see [Working with
26 /// Monetary
27 /// Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
28 ///
29 /// The currency code must match the currency associated with the business that is charging the card.
30 pub amount_money: Money,
31 /// The amount of money the developer contributes to help cover the refunded amount. This amount
32 /// is specified in the smallest denomination of the applicable currency (for example, US dollar
33 /// amounts are specified in cents).
34 ///
35 /// The value cannot be more than the `amount_money`.
36 ///
37 /// You can specify this parameter in a refund request only if the same parameter was also
38 /// included when taking the payment. This is part of the application fee scenario the API
39 /// supports. For more information, see [Take Payments and Collect
40 /// Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
41 ///
42 /// To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. For
43 /// more information, see
44 /// [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
45 pub app_fee_money: Option<Money>,
46 /// The unique ID of the payment being refunded. Must be provided and non-empty.
47 pub payment_id: String,
48 /// A description of the reason for the refund.
49 ///
50 /// Max Length 192
51 pub reason: Option<String>,
52 /// Used for optimistic concurrency. This opaque token identifies the current `Payment` version
53 /// that the caller expects. If the server has a different version of the Payment, the update
54 /// fails and a response with a VERSION_MISMATCH error is returned. If the versions match, or
55 /// the field is not provided, the refund proceeds as normal.
56 pub payment_version_token: Option<String>,
57 /// An optional [TeamMember] ID to associate with this refund.
58 pub team_member_id: Option<String>,
59}