Struct CreatePaymentRequest

Source
pub struct CreatePaymentRequest {
Show 21 fields pub source_id: String, pub idempotency_key: String, pub amount_money: Money, pub tip_money: Option<Money>, pub app_fee_money: Option<Money>, pub delay_duration: Option<String>, pub autocomplete: Option<bool>, pub order_id: Option<String>, pub customer_id: Option<String>, pub location_id: Option<String>, pub team_member_id: Option<String>, pub reference_id: Option<String>, pub verification_token: Option<String>, pub accept_partial_authorization: Option<bool>, pub buyer_email_address: Option<String>, pub billing_address: Option<Address>, pub shipping_address: Option<Address>, pub note: Option<String>, pub statement_description_identifier: Option<String>, pub cash_details: Option<CashPaymentDetails>, pub external_details: Option<ExternalPaymentDetails>,
}
Expand description

This is a model class for CreatePaymentRequest type.

Fields§

§source_id: String

The ID for the source of funds for this payment. This can be a payment token (card nonce) generated by the Square payment form or a card on file made with the Customers API. If recording a payment that the seller received outside of Square, specify either “CASH” or “EXTERNAL”. For more information, see Take Payments.

§idempotency_key: String

A unique string that identifies this CreatePayment request. Keys can be any valid string but must be unique for every CreatePayment request.

Note: The number of allowed characters might be less than the stated maximum, if multi-byte characters are used.

For more information, see Idempotency.

§amount_money: Money

The amount of money to accept for this payment, not including tip_money.

The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see Working with Monetary Amounts.

The currency code must match the currency associated with the business that is accepting the payment.

§tip_money: Option<Money>

The amount designated as a tip, in addition to amount_money.

The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see Working with Monetary Amounts.

The currency code must match the currency associated with the business that is accepting the payment.

§app_fee_money: Option<Money>

The amount of money that the developer is taking as a fee for facilitating the payment on behalf of the seller.

The amount cannot be more than 90% of the total amount of the payment.

The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see Working with Monetary Amounts.

The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller.

For more information about the application fee scenario, see Take Payments and Collect Fees.

To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see Permissions.

§delay_duration: Option<String>

The duration of time after the payment’s creation when Square automatically cancels the payment. This automatic cancellation applies only to payments that do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the delay_duration time period.

This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value of 1 minute.

Note: This feature is only supported for card payments. This parameter can only be set for a delayed capture payment (autocomplete=false).

Default:

  • Card-present payments: “PT36H” (36 hours) from the creation time.
  • Card-not-present payments: “P7D” (7 days) from the creation time.

Example for 2 days, 12 hours, 30 minutes, and 15 seconds: P2DT12H30M15S

§autocomplete: Option<bool>

If set to true, this payment will be completed when possible. If set to false, this payment is held in an approved state until either explicitly completed (captured) or canceled (voided). For more information, see Delayed capture.

Default: true

§order_id: Option<String>

Associates a previously created order with this payment.

§customer_id: Option<String>

The [Customer] ID of the customer associated with the payment.

This is required if the source_id refers to a card on file created using the Customers API.

§location_id: Option<String>

The location ID to associate with the payment. If not specified, the default location is used.

§team_member_id: Option<String>

An optional [TeamMember] ID to associate with this payment.

§reference_id: Option<String>

A user-defined ID to associate with the payment.

You can use this field to associate the payment to an entity in an external system (for example, you might specify an order ID that is generated by a third-party shopping cart).

§verification_token: Option<String>

An identifying token generated by payments.verifyBuyer(). Verification tokens encapsulate customer device information and 3-D Secure challenge results to indicate that Square has verified the buyer identity.

For more information, see SCA Overview.

§accept_partial_authorization: Option<bool>

If set to true and charging a Square Gift Card, a payment might be returned with amount_money equal to less than what was requested. For example, a request for $20 when charging a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card payment. This field cannot be true when autocomplete = true.

For more information, see Partial amount with Square Gift Cards.

Default: false

§buyer_email_address: Option<String>

The buyer’s email address.

§billing_address: Option<Address>

The buyer’s billing address.

§shipping_address: Option<Address>

The buyer’s shipping address.

§note: Option<String>

An optional note to be entered by the developer when creating a payment.

§statement_description_identifier: Option<String>

Optional additional payment information to include on the customer’s card statement as part of the statement description. This can be, for example, an invoice number, ticket number, or short description that uniquely identifies the purchase.

Note that the statement_description_identifier might get truncated on the statement description to fit the required information including the Square identifier (SQ *) and name of the seller taking the payment.

§cash_details: Option<CashPaymentDetails>

Additional details required when recording a cash payment (source_id is CASH).

§external_details: Option<ExternalPaymentDetails>

Additional details required when recording an external payment (source_id is EXTERNAL).

Trait Implementations§

Source§

impl Clone for CreatePaymentRequest

Source§

fn clone(&self) -> CreatePaymentRequest

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 CreatePaymentRequest

Source§

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

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

impl Default for CreatePaymentRequest

Source§

fn default() -> CreatePaymentRequest

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

impl PartialEq for CreatePaymentRequest

Source§

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

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 CreatePaymentRequest

Source§

impl StructuralPartialEq for CreatePaymentRequest

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<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> ErasedDestructor for T
where T: 'static,