pub struct PaymentIntent { /* private fields */ }Expand description
A PaymentIntent as returned by Stripe’s REST API.
A PaymentIntent tracks one customer payment attempt from creation
through authentication to capture. The next_action field tells the
browser what it still owes the user, and latest_charge links to
the Charge Stripe created once the payment settled.
Read accessors are generated by #[derive(Getter)]. Only the fields
a caller acts on are marked; amount and currency are deliberately
unmarked because the pair is only meaningful together, so
get_amount pairs them into a Money by hand instead of exposing
two independently readable halves.
Implementations§
Source§impl PaymentIntent
impl PaymentIntent
Sourcepub fn new(
id: String,
amount: Money,
status: PaymentIntentStatus,
next_action: PaymentIntentNextAction,
) -> PaymentIntent
pub fn new( id: String, amount: Money, status: PaymentIntentStatus, next_action: PaymentIntentNextAction, ) -> PaymentIntent
Sourcepub fn get_amount(&self) -> Result<Money, StripeParseError>
pub fn get_amount(&self) -> Result<Money, StripeParseError>
Return the amount this intent will capture.
The minor-unit count is paired with the currency recorded in
the response, so the two never drift apart. The amount and
currency fields are not exposed separately for this reason.
§Returns
Result<Money, StripeParseError>- the amount, or an error when the response carried a currency this crate does not model.
Sourcepub fn is_succeeded(&self) -> bool
pub fn is_succeeded(&self) -> bool
Return whether the payment has been captured.
§Returns
bool-trueonce the intent reaches a terminal state that means money moved.
Sourcepub fn requires_action(&self) -> bool
pub fn requires_action(&self) -> bool
Return whether the browser must handle a bank challenge.
§Returns
bool-truewhen the client still owes the user a 3-D Secure or redirect step.
Source§impl PaymentIntent
impl PaymentIntent
pub fn get_id(&self) -> &String
pub fn get_status(&self) -> PaymentIntentStatus
pub fn get_next_action(&self) -> PaymentIntentNextAction
pub fn get_latest_charge(&self) -> Option<String>
pub fn try_get_latest_charge(&self) -> Option<String>
pub fn get_customer(&self) -> Option<String>
pub fn try_get_customer(&self) -> Option<String>
Trait Implementations§
Source§impl Clone for PaymentIntent
impl Clone for PaymentIntent
Source§fn clone(&self) -> PaymentIntent
fn clone(&self) -> PaymentIntent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more