paypal_rust/resources/
purchase_unit.rs

1use crate::resources::amount_with_breakdown::AmountWithBreakdown;
2use crate::resources::item::Item;
3use crate::resources::payee::Payee;
4use crate::resources::payment_collection::PaymentCollection;
5use crate::resources::payment_instruction::PaymentInstruction;
6use crate::resources::shipping_detail::ShippingDetail;
7use serde::{Deserialize, Serialize};
8use serde_with::skip_serializing_none;
9
10#[skip_serializing_none]
11#[derive(Clone, Debug, Default, Deserialize, Serialize)]
12pub struct PurchaseUnit {
13    /// The API caller-provided external ID for the purchase unit. Required for multiple purchase units when you must update the order
14    /// through PATCH. If you omit this value and the order contains only one purchase unit, PayPal sets this value to default.
15    pub reference_id: Option<String>,
16
17    /// The total order amount with an optional breakdown that provides details, such as the total item amount, total tax amount, shipping,
18    /// handling, insurance, and discounts, if any. If you specify amount.breakdown, the amount equals item_total plus tax_total plus
19    /// shipping plus handling plus insurance minus shipping_discount minus discount. The amount must be a positive number.
20    /// For listed of supported currencies and decimal precision, see the PayPal REST APIs Currency Codes.
21    pub amount: Option<AmountWithBreakdown>,
22
23    /// The merchant who receives payment for this transaction.
24    pub payee: Option<Payee>,
25
26    /// Any additional payment instructions to be consider during payment processing. This processing instruction is applicable for
27    /// Capturing an order or Authorizing an Order.
28    pub payment_instruction: Option<PaymentInstruction>,
29
30    /// The purchase description.
31    pub description: Option<String>,
32
33    /// The API caller-provided external ID. Used to reconcile API caller-initiated transactions with PayPal transactions.
34    /// Appears in transaction and settlement reports.
35    pub custom_id: Option<String>,
36
37    /// The API caller-provided external invoice ID for this order.
38    pub invoice_id: Option<String>,
39
40    /// The PayPal-generated ID for the purchase unit. This ID appears in both the payer's transaction history and the emails that the payer
41    /// receives. In addition, this ID is available in transaction and settlement reports that merchants and API callers can use to reconcile
42    /// transactions. This ID is only available when an order is saved by calling v2/checkout/orders/id/save.
43    pub id: Option<String>,
44
45    /// The payment descriptor on account transactions on the customer's credit card statement, that PayPal sends to processors.
46    /// The maximum length of the soft descriptor information that you can pass in the API field is 22 characters, in the following
47    /// format:22 - len(PAYPAL * (8)) - len(Descriptor in Payment Receiving Preferences of Merchant account + 1)The PAYPAL prefix uses 8
48    /// characters.
49    ///
50    /// The soft descriptor supports the following ASCII characters:
51    /// - Alphanumeric characters
52    /// - Dashes
53    /// - Asterisks
54    /// - Periods (.)
55    /// - Spaces
56    ///
57    /// For Wallet payments marketplace integrations:
58    /// The merchant descriptor in the Payment Receiving Preferences must be the marketplace name.
59    /// You can't use the remaining space to show the customer service number.
60    /// The remaining spaces can be a combination of seller name and country.
61    ///
62    /// For unbranded payments (Direct Card) marketplace integrations, use a combination of the seller name and phone number.
63    pub soft_descriptor: Option<String>,
64
65    /// An array of items that the customer purchases from the merchant.
66    pub items: Option<Vec<Item>>,
67
68    /// The shipping address and method.
69    pub shipping: Option<ShippingDetail>,
70
71    /// The comprehensive history of payments for the purchase unit.
72    pub payments: Option<PaymentCollection>,
73}