stripe/model/exchange_rate.rs
1use serde::{Serialize, Deserialize};
2/**`ExchangeRate` objects allow you to determine the rates that Stripe is currently
3using to convert from one currency to another. Since this number is variable
4throughout the day, there are various reasons why you might want to know the current
5rate (for example, to dynamically price an item for a user with a default
6payment in a foreign currency).
7
8Please refer to our [Exchange Rates API](https://stripe.com/docs/fx-rates) guide for more details.
9
10*[Note: this integration path is supported but no longer recommended]* Additionally,
11you can guarantee that a charge is made with an exchange rate that you expect is
12current. To do so, you must pass in the exchange_rate to charges endpoints. If the
13value is no longer up to date, the charge won't go through. Please refer to our
14[Using with charges](https://stripe.com/docs/exchange-rates) guide for more details.
15
16-----
17
18
19
20*This Exchange Rates API is a Beta Service and is subject to Stripe's terms of service. You may use the API solely for the purpose of transacting on Stripe. For example, the API may be queried in order to:*
21
22- *localize prices for processing payments on Stripe*
23- *reconcile Stripe transactions*
24- *determine how much money to send to a connected account*
25- *determine app fees to charge a connected account*
26
27*Using this Exchange Rates API beta for any purpose other than to transact on Stripe is strictly prohibited and constitutes a violation of Stripe's terms of service.**/
28#[derive(Debug, Clone, Serialize, Deserialize, Default)]
29pub struct ExchangeRate {
30 ///Unique identifier for the object. Represented as the three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) in lowercase.
31 pub id: String,
32 ///String representing the object's type. Objects of the same type share the same value.
33 pub object: String,
34 ///Hash where the keys are supported currencies and the values are the exchange rate at which the base id currency converts to the key currency.
35 pub rates: serde_json::Value,
36}
37impl std::fmt::Display for ExchangeRate {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
39 write!(f, "{}", serde_json::to_string(self).unwrap())
40 }
41}