Struct Order

Source
pub struct Order {
Show 30 fields pub id: Option<String>, pub location_id: Option<String>, pub reference_id: Option<String>, pub source: Option<OrderSource>, pub customer_id: Option<String>, pub line_items: Option<Vec<OrderLineItem>>, pub taxes: Option<Vec<OrderLineItemTax>>, pub discounts: Option<Vec<OrderLineItemDiscount>>, pub service_charges: Option<Vec<OrderServiceCharge>>, pub fulfillments: Option<Vec<OrderFulfillment>>, pub returns: Option<Vec<OrderReturn>>, pub return_amounts: Option<OrderMoneyAmounts>, pub net_amounts: Option<OrderMoneyAmounts>, pub rounding_adjustment: Option<OrderRoundingAdjustment>, pub tenders: Option<Vec<Tender>>, pub refunds: Option<Vec<Refund>>, pub metadata: Option<HashMap<String, String>>, pub created_at: Option<DateTime>, pub updated_at: Option<DateTime>, pub closed_at: Option<DateTime>, pub state: Option<OrderState>, pub version: Option<i32>, pub total_money: Option<Money>, pub total_tax_money: Option<Money>, pub total_discount_money: Option<Money>, pub total_tip_money: Option<Money>, pub total_service_charge_money: Option<Money>, pub ticket_name: Option<String>, pub pricing_options: Option<OrderPricingOptions>, pub rewards: Option<Vec<OrderReward>>,
}
Expand description

Contains all information related to a single order to process with Square, including line items that specify the products to purchase.

Order objects also include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated itemization data.

Fields§

§id: Option<String>

Read only The order’s unique ID.

§location_id: Option<String>

The ID of the seller location that this order is associated with.

§reference_id: Option<String>

A client-specified ID to associate an entity in another system with this order.

§source: Option<OrderSource>

The origination details of the order.

§customer_id: Option<String>

The ID of the [Customer] associated with the order.

IMPORTANT: You should specify a customer_id if you want the corresponding payment transactions to be explicitly linked to the customer in the Seller Dashboard. If this field is omitted, the customer_id assigned to any underlying Payment objects is ignored and might result in the creation of new instant profiles.

§line_items: Option<Vec<OrderLineItem>>

The line items included in the order.

§taxes: Option<Vec<OrderLineItemTax>>

The list of all taxes associated with the order.

Taxes can be scoped to either ORDER or LINE_ITEM. For taxes with LINE_ITEM scope, an OrderLineItemAppliedTax must be added to each line item that the tax applies to. For taxes with ORDER scope, the server generates an OrderLineItemAppliedTax for every line item.

On reads, each tax in the list includes the total amount of that tax applied to the order.

IMPORTANT: If LINE_ITEM scope is set on any taxes in this field, using the deprecated line_items.taxes field results in an error. Use line_items.applied_taxes instead.

§discounts: Option<Vec<OrderLineItemDiscount>>

The list of all discounts associated with the order.

Discounts can be scoped to either ORDER or LINE_ITEM. For discounts scoped to LINE_ITEM, an OrderLineItemAppliedDiscount must be added to each line item that the discount applies to. For discounts with ORDER scope, the server generates an OrderLineItemAppliedDiscount for every line item.

IMPORTANT: If LINE_ITEM scope is set on any discounts in this field, using the deprecated line_items.discounts field results in an error. Use line_items.applied_discounts instead.

§service_charges: Option<Vec<OrderServiceCharge>>

A list of service charges applied to the order.

§fulfillments: Option<Vec<OrderFulfillment>>

Details about order fulfillment.

Orders can only be created with at most one fulfillment. However, orders returned by the API might contain multiple fulfillments.

§returns: Option<Vec<OrderReturn>>

Read only A collection of items from sale orders being returned in this one. Normally part of an itemized return or exchange. There is exactly one Return object per sale Order being referenced.

§return_amounts: Option<OrderMoneyAmounts>

Read only A collection of various money amounts.

§net_amounts: Option<OrderMoneyAmounts>

Read only A collection of various money amounts.

§rounding_adjustment: Option<OrderRoundingAdjustment>

Read only A rounding adjustment of the money being returned. Commonly used to apply cash rounding when the minimum unit of the account is smaller than the lowest physical denomination of the currency.

§tenders: Option<Vec<Tender>>

Read only The tenders that were used to pay for the order.

§refunds: Option<Vec<Refund>>

Read only The refunds that are part of this order.

§metadata: Option<HashMap<String, String>>

Application-defined data attached to this order. Metadata fields are intended to store descriptive references or associations with an entity in another system or store brief information about the object. Square does not process this field; it only stores and returns it in relevant API calls. Do not use metadata to store any sensitive information (such as personally identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set [a-zA-Z0-9_-]. Entries can also include metadata generated by Square. These keys are prefixed with a namespace, separated from the key with a ‘:’ character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same application.

For more information, see Metadata.

§created_at: Option<DateTime>

Read only The timestamp for when the order was created.

§updated_at: Option<DateTime>

Read only The timestamp for when the order was last updated.

§closed_at: Option<DateTime>

Read only The timestamp for when the order reached a terminal state.

§state: Option<OrderState>

The current state of the order.

§version: Option<i32>

The version number, which is incremented each time an update is committed to the order. Orders not created through the API do not include a version number and therefore cannot be updated.

Read more about working with versions.

§total_money: Option<Money>

Read only The total amount of money to collect for the order.

§total_tax_money: Option<Money>

Read only The total amount of tax money to collect for the order.

§total_discount_money: Option<Money>

Read only The total amount of discount money to collect for the order.

§total_tip_money: Option<Money>

Read only The total amount of tip money to collect for the order.

§total_service_charge_money: Option<Money>

Read only The total amount of money collected in service charges for the order.

Note: total_service_charge_money is the sum of applied_money fields for each individual service charge. Therefore, total_service_charge_money only includes inclusive tax amounts, not additive tax amounts.

§ticket_name: Option<String>

A short-term identifier for the order (such as a customer first name, table number, or auto-generated order number that resets daily). For orders created in Square Point of Sale, the ticket_name is printed on in-person tickets and stubs. It converts to the kitchen_printing.name field in the bill cart feature details.

§pricing_options: Option<OrderPricingOptions>

Pricing options for an order. The options affect how the order’s price is calculated. They can be used, for example, to apply automatic price adjustments that are based on preconfigured pricing rules.

§rewards: Option<Vec<OrderReward>>

Read only A set-like list of Rewards that have been added to the Order.

Trait Implementations§

Source§

impl Clone for Order

Source§

fn clone(&self) -> Order

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Order

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Order

Source§

fn default() -> Order

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Order

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Order

Source§

fn eq(&self, other: &Order) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Order

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Order

Source§

impl StructuralPartialEq for Order

Auto Trait Implementations§

§

impl Freeze for Order

§

impl RefUnwindSafe for Order

§

impl Send for Order

§

impl Sync for Order

§

impl Unpin for Order

§

impl UnwindSafe for Order

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,