stripe/model/
setup_attempt.rs

1use serde::{Serialize, Deserialize};
2use super::SetupAttemptPaymentMethodDetails;
3/**A SetupAttempt describes one attempted confirmation of a SetupIntent,
4whether that confirmation is successful or unsuccessful. You can use
5SetupAttempts to inspect details of a specific attempt at setting up a
6payment method using a SetupIntent.*/
7#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8pub struct SetupAttempt {
9    ///The value of [application](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application) on the SetupIntent at the time of this confirmation.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub application: Option<serde_json::Value>,
12    /**If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.
13
14It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.*/
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub attach_to_self: Option<bool>,
17    ///Time at which the object was created. Measured in seconds since the Unix epoch.
18    pub created: i64,
19    ///The value of [customer](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer) on the SetupIntent at the time of this confirmation.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub customer: Option<serde_json::Value>,
22    /**Indicates the directions of money movement for which this payment method is intended to be used.
23
24Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.*/
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub flow_directions: Option<Vec<String>>,
27    ///Unique identifier for the object.
28    pub id: String,
29    ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
30    pub livemode: bool,
31    ///String representing the object's type. Objects of the same type share the same value.
32    pub object: String,
33    ///The value of [on_behalf_of](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-on_behalf_of) on the SetupIntent at the time of this confirmation.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub on_behalf_of: Option<serde_json::Value>,
36    ///ID of the payment method used with this SetupAttempt.
37    pub payment_method: serde_json::Value,
38    ///
39    pub payment_method_details: SetupAttemptPaymentMethodDetails,
40    ///The error encountered during this attempt to confirm the SetupIntent, if any.
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub setup_error: Option<serde_json::Value>,
43    ///ID of the SetupIntent that this attempt belongs to.
44    pub setup_intent: serde_json::Value,
45    ///Status of this SetupAttempt, one of `requires_confirmation`, `requires_action`, `processing`, `succeeded`, `failed`, or `abandoned`.
46    pub status: String,
47    ///The value of [usage](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-usage) on the SetupIntent at the time of this confirmation, one of `off_session` or `on_session`.
48    pub usage: String,
49}
50impl std::fmt::Display for SetupAttempt {
51    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
52        write!(f, "{}", serde_json::to_string(self).unwrap())
53    }
54}