pub struct DiscountUpdate<'a> { /* private fields */ }
Expand description
Request builder for updating discounts in Paddle API.
Implementations§
Source§impl<'a> DiscountUpdate<'a>
impl<'a> DiscountUpdate<'a>
pub fn new(client: &'a Paddle, discount_id: impl Into<DiscountID>) -> Self
Sourcepub fn status(&mut self, status: Status) -> &mut Self
pub fn status(&mut self, status: Status) -> &mut Self
Whether this entity can be used in Paddle.
Sourcepub fn description(&mut self, description: impl Into<String>) -> &mut Self
pub fn description(&mut self, description: impl Into<String>) -> &mut Self
Short description for this discount for your reference. Not shown to customers.
Sourcepub fn enabled_for_checkout(&mut self, enabled: bool) -> &mut Self
pub fn enabled_for_checkout(&mut self, enabled: bool) -> &mut Self
Whether this discount can be redeemed by customers at checkout (true) or not (false).
Sourcepub fn code(&mut self, code: impl Into<String>) -> &mut Self
pub fn code(&mut self, code: impl Into<String>) -> &mut Self
Unique code that customers can use to redeem this discount at checkout. Not case-sensitive.
Sourcepub fn discount_type(&mut self, discount_type: DiscountType) -> &mut Self
pub fn discount_type(&mut self, discount_type: DiscountType) -> &mut Self
Type of discount. Determines how this discount impacts the checkout or transaction total.
Sourcepub fn amount(&mut self, amount: impl Into<String>) -> &mut Self
pub fn amount(&mut self, amount: impl Into<String>) -> &mut Self
Amount to discount by. For percentage discounts, must be an amount between 0.01 and 100. For flat and flat_per_seat discounts, amount in the lowest denomination for a currency.
Sourcepub fn currency_code(&mut self, currency_code: CurrencyCode) -> &mut Self
pub fn currency_code(&mut self, currency_code: CurrencyCode) -> &mut Self
Supported three-letter ISO 4217 currency code. Required where discount type is DiscountType::Flat or DiscountType::FlatPerSeat.
Sourcepub fn recur(&mut self, recur: bool) -> &mut Self
pub fn recur(&mut self, recur: bool) -> &mut Self
Whether this discount applies for multiple subscription billing periods (true
) or not (false
). If omitted, defaults to false
.
Sourcepub fn maximum_recurring_intervals(
&mut self,
maximum_recurring_intervals: u64,
) -> &mut Self
pub fn maximum_recurring_intervals( &mut self, maximum_recurring_intervals: u64, ) -> &mut Self
Number of subscription billing periods that this discount recurs for. Requires recur
. null
if this discount recurs forever.
Subscription renewals, midcycle changes, and one-time charges billed to a subscription aren’t considered a redemption. times_used
is not incremented in these cases.
Sourcepub fn usage_limit(&mut self, usage_limit: u64) -> &mut Self
pub fn usage_limit(&mut self, usage_limit: u64) -> &mut Self
Maximum number of times this discount can be redeemed. This is an overall limit for this discount, rather than a per-customer limit. null
if this discount can be redeemed an unlimited amount of times.
Sourcepub fn restrict_to(
&mut self,
restrict_to: impl IntoIterator<Item = impl AsRef<str>>,
) -> &mut Self
pub fn restrict_to( &mut self, restrict_to: impl IntoIterator<Item = impl AsRef<str>>, ) -> &mut Self
Product or price IDs that this discount is for. When including a product ID, all prices for that product can be discounted. null
if this discount applies to all products and prices.
Sourcepub fn expires_at(&mut self, expires_at: DateTime<Utc>) -> &mut Self
pub fn expires_at(&mut self, expires_at: DateTime<Utc>) -> &mut Self
Datetime when this discount expires. Discount can no longer be redeemed after this date has elapsed. null
if this discount can be redeemed forever.
Expired discounts can’t be redeemed against transactions or checkouts, but can be applied when updating subscriptions.
Sourcepub fn custom_data(&mut self, custom_data: HashMap<String, String>) -> &mut Self
pub fn custom_data(&mut self, custom_data: HashMap<String, String>) -> &mut Self
Set custom data for this discount.