Struct DiscountCreate

Source
pub struct DiscountCreate {
Show 18 fields pub id: DiscountID, pub status: DiscountStatus, pub description: String, pub enabled_for_checkout: bool, pub code: Option<String>, pub type: DiscountType, pub amount: String, pub currency_code: CurrencyCode, pub recur: bool, pub maximum_recurring_intervals: Option<i64>, pub usage_limit: Option<i64>, pub restrict_to: Option<Vec<String>>, pub expires_at: Option<DateTime<FixedOffset>>, pub custom_data: Option<HashMap<String, String>>, pub times_used: i64, pub created_at: String, pub updated_at: String, pub import_meta: ImportMeta,
}
Expand description

Represents a discount entity when creating discounts.

Fields§

§id: DiscountID

Unique Paddle ID for this discount, prefixed with dsc_.

§status: DiscountStatus

Whether this entity can be used in Paddle.

§description: String

Short description for this discount for your reference. Not shown to customers.

§enabled_for_checkout: bool

Whether this discount can be redeemed by customers at checkout (true) or not (false).

§code: Option<String>

Unique code that customers can use to redeem this discount at checkout. Use letters and numbers only, up to 16 characters. Not case-sensitive.

If omitted and enabled_for_checkout is true, Paddle generates a random 10-character code.

§type: DiscountType

Type of discount. Determines how this discount impacts the checkout or transaction total.

§amount: String

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.

§currency_code: CurrencyCode

Supported three-letter ISO 4217 currency code. Required where discount type is flat or flat_per_seat.

§recur: bool

Whether this discount applies for multiple subscription billing periods (true) or not (false). If omitted, defaults to false.

§maximum_recurring_intervals: Option<i64>

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.

§usage_limit: Option<i64>

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.

Paddle counts a usage as a redemption on a checkout, transaction, or the initial application against a subscription. Transactions created for subscription renewals, midcycle changes, and one-time charges aren’t considered a redemption.

§restrict_to: Option<Vec<String>>

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.

§expires_at: Option<DateTime<FixedOffset>>

RFC 3339 datetime string of 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.

§custom_data: Option<HashMap<String, String>>

Your own structured key-value data.

§times_used: i64

How many times this discount has been redeemed. Automatically incremented by Paddle.

Paddle counts a usage as a redemption on a checkout, transaction, or subscription. Transactions created for subscription renewals, midcycle changes, and one-time charges aren’t considered a redemption.

§created_at: String

RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.

§updated_at: String

RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.

§import_meta: ImportMeta

Import information for this entity. null if this entity is not imported.

Trait Implementations§

Source§

impl Clone for DiscountCreate

Source§

fn clone(&self) -> DiscountCreate

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiscountCreate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DiscountCreate

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for DiscountCreate

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T