Skip to main content

stripe_pay_client/element/
struct.rs

1use super::*;
2
3/// The configuration a checkout page hands to the payment element.
4///
5/// The struct is transport-free on purpose: the browser binds it to
6/// Stripe.js at mount time, so every field can be exercised without a
7/// DOM and stays unit-testable on the host target.
8///
9/// Accessors are generated by `#[derive(Data)]`. The client secret is
10/// pinned at construction: it authenticates a mount against Stripe, so
11/// allowing it to be swapped after the fact would let a caller who
12/// already holds the config redirect the element at another intent.
13#[derive(Clone, Data, Debug, Eq, PartialEq)]
14pub struct ElementConfig {
15    /// The client secret Stripe issued for the intent.
16    #[set(skip)]
17    pub(super) client_secret: String,
18    /// Which element variant to render.
19    #[get(type(copy))]
20    pub(super) kind: ElementKind,
21    /// The locale for the element's built-in labels.
22    #[set(type(AsRef<str>))]
23    pub(super) locale: String,
24}