Skip to main content

stripe_pay_core/money/
enum.rs

1/// A unit of currency, using Stripe's own naming for each variant.
2///
3/// The variant list is intentionally small: this crate covers the
4/// currencies the SDK's examples and tests exercise. Adding a currency
5/// means adding a variant here and a row in every `match` below, so the
6/// compiler surfaces each site that needs the new zero- or two-decimal
7/// decision rather than silently defaulting.
8#[derive(
9    Clone,
10    Copy,
11    Debug,
12    Default,
13    Eq,
14    Hash,
15    Ord,
16    PartialEq,
17    PartialOrd,
18    serde::Deserialize,
19    serde::Serialize,
20)]
21#[serde(rename_all = "snake_case")]
22pub enum Currency {
23    /// United States dollar, two decimal places.
24    #[default]
25    Usd,
26    /// Euro, two decimal places.
27    Eur,
28    /// British pound, two decimal places.
29    Gbp,
30    /// Japanese yen, zero decimal places.
31    Jpy,
32    /// Swiss franc, two decimal places.
33    Chf,
34}