Invoice

Struct Invoice 

Source
pub struct Invoice {
Show 25 fields pub id: Option<String>, pub version: Option<i32>, pub location_id: Option<String>, pub order_id: Option<String>, pub primary_recipient: Option<InvoiceRecipient>, pub payment_requests: Option<Vec<InvoicePaymentRequest>>, pub delivery_method: Option<InvoiceDeliveryMethod>, pub invoice_number: Option<String>, pub title: Option<String>, pub description: Option<String>, pub scheduled_at: Option<DateTime>, pub public_url: Option<String>, pub next_payment_amount_money: Option<Money>, pub status: Option<InvoiceStatus>, pub timezone: Option<Timezone>, pub created_at: Option<DateTime>, pub updated_at: Option<DateTime>, pub accepted_payment_methods: Option<InvoiceAcceptedPaymentMethods>, pub custom_fields: Option<Vec<InvoiceCustomField>>, pub subscription_id: Option<String>, pub sale_or_service_date: Option<String>, pub payment_conditions: Option<String>, pub store_payment_method_enabled: Option<bool>, pub attachments: Option<Vec<InvoiceAttachment>>, pub creator_team_member_id: Option<String>,
}
Expand description

Stores information about an invoice.

You use the Invoices API to create and manage invoices. For more information, see Invoices API Overview.

Fields§

§id: Option<String>

Read only The Square-assigned ID of the invoice.

§version: Option<i32>

The Square-assigned version number, which is incremented each time an update is committed to the invoice.

§location_id: Option<String>

The ID of the location that this invoice is associated with.

If specified in a CreateInvoice request, the value must match the location_id of the associated order.

Min Length: 1, Max Length: 255

§order_id: Option<String>

The ID of the [Order] for which the invoice is created. This field is required when creating an invoice, and the order must be in the OPEN state.

To view the line items and other information for the associated order, call the RetrieveOrder endpoint using the order ID.

Min Length: 1, Max Length: 255

§primary_recipient: Option<InvoiceRecipient>

The customer who receives the invoice. This customer data is displayed on the invoice and used by Square to deliver the invoice.

This field is required to publish an invoice, and it must specify the customer_id.

§payment_requests: Option<Vec<InvoicePaymentRequest>>

The payment schedule for the invoice, represented by one or more payment requests that define payment settings, such as amount due and due date. An invoice supports the following payment request combinations:

  • One balance
  • One deposit with one balance
  • 2–12 installments
  • One deposit with 2–12 installments

This field is required when creating an invoice. It must contain at least one payment request. All payment requests for the invoice must equal the total order amount. For more information, see Configuring payment requests.

Adding INSTALLMENT payment requests to an invoice requires an Invoices Plus subscription.

Min Length: 1, Max Length: 13

§delivery_method: Option<InvoiceDeliveryMethod>

The delivery method that Square uses to send the invoice, reminders, and receipts to the customer. After the invoice is published, Square processes the invoice based on the delivery method and payment request settings, either immediately or on the scheduled_at date, if specified. For example, Square might send the invoice or receipt for an automatic payment. For invoices with automatic payments, this field must be set to EMAIL.

One of the following is required when creating an invoice:

  • (Recommended) This delivery_method field. To configure an automatic payment, the automatic_payment_source field of the payment request is also required.
  • The deprecated request_method field of the payment request. Note that invoice objects returned in responses do not include request_method.
§invoice_number: Option<String>

A user-friendly invoice number that is displayed on the invoice. The value is unique within a location. If not provided when creating an invoice, Square assigns a value. It increments from 1 and is padded with zeros making it 7 characters long (for example, 0000001 and 0000002).

Min Length: 1, Max Length: 191

§title: Option<String>

The title of the invoice, which is displayed on the invoice.

Min Length: 1, Max Length: 255

§description: Option<String>

The description of the invoice, which is displayed on the invoice.

Min Length: 1, Max Length: 65536

§scheduled_at: Option<DateTime>

The timestamp when the invoice is scheduled for processing, in RFC 3339 format. After the invoice is published, Square processes the invoice on the specified date, according to the delivery method and payment request settings.

If the field is not set, Square processes the invoice immediately after it is published.

§public_url: Option<String>

Read only A temporary link to the Square-hosted payment page where the customer can pay the invoice. If the link expires, customers can provide the email address or phone number associated with the invoice and request a new link directly from the expired payment page.

This field is added after the invoice is published and reaches the scheduled date (if one is defined).

§next_payment_amount_money: Option<Money>

Read only The current amount due for the invoice. In addition to the amount due on the next payment request, this includes any overdue payment amounts.

§status: Option<InvoiceStatus>

Read only The status of the invoice.

§timezone: Option<Timezone>

Read only The time zone used to interpret calendar dates on the invoice, such as due_date. When an invoice is created, this field is set to the timezone specified for the seller location. The value cannot be changed.

§created_at: Option<DateTime>

Read only The timestamp when the invoice was created, in RFC 3339 format.

§updated_at: Option<DateTime>

Read only The timestamp when the invoice was last updated, in RFC 3339 format.

§accepted_payment_methods: Option<InvoiceAcceptedPaymentMethods>

The payment methods that customers can use to pay the invoice on the Square-hosted invoice page. This setting is independent of any automatic payment requests for the invoice.

This field is required when creating an invoice and must set at least one payment method to true.

§custom_fields: Option<Vec<InvoiceCustomField>>

Additional seller-defined fields that are displayed on the invoice. For more information, see Custom fields.

Adding custom fields to an invoice requires an Invoices Plus subscription.

Max: 2 custom fields

Max Length: 2

§subscription_id: Option<String>

Read only The ID of the subscription associated with the invoice. This field is present only on subscription billing invoices.

§sale_or_service_date: Option<String>

The date of the sale or the date that the service is rendered, in YYYY-MM-DD format. This field can be used to specify a past or future date which is displayed on the invoice.

§payment_conditions: Option<String>

France only. The payment terms and conditions that are displayed on the invoice. For more information, see Payment conditions.

For countries other than France, Square returns an INVALID_REQUEST_ERROR with a BAD_REQUEST code and “Payment conditions are not supported for this location’s country” detail if this field is included in CreateInvoice or UpdateInvoice requests.

Min Length: 1, Max Length: 2000

§store_payment_method_enabled: Option<bool>

Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a bank account on file. If true, Square displays a Save my card on file or Save my bank on file checkbox on the invoice payment page. Stored payment information can be used for future automatic payments. The default value is false.

§attachments: Option<Vec<InvoiceAttachment>>

Read only Metadata about the attachments on the invoice. Invoice attachments are managed using the CreateInvoiceAttachment and DeleteInvoiceAttachment endpoints. Max Length 10

§creator_team_member_id: Option<String>

Read only The ID of the team member who created the invoice. This field is present only on invoices created in the Square Dashboard or Square Invoices app by a logged-in team member.

Trait Implementations§

Source§

impl Clone for Invoice

Source§

fn clone(&self) -> Invoice

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Invoice

Source§

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

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

impl Default for Invoice

Source§

fn default() -> Invoice

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

impl<'de> Deserialize<'de> for Invoice

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 Invoice

Source§

fn eq(&self, other: &Invoice) -> 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 Invoice

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 Invoice

Source§

impl StructuralPartialEq for Invoice

Auto Trait Implementations§

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<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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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,