Struct stripe::PromotionCode [−][src]
pub struct PromotionCode {
pub id: PromotionCodeId,
pub active: bool,
pub code: String,
pub coupon: Coupon,
pub created: Timestamp,
pub customer: Option<Box<Expandable<Customer>>>,
pub expires_at: Option<Box<Timestamp>>,
pub livemode: bool,
pub max_redemptions: Option<Box<i64>>,
pub metadata: Metadata,
pub restrictions: PromotionCodesResourceRestrictions,
pub times_redeemed: i64,
}
Expand description
The resource representing a Stripe “PromotionCode”.
For more details see https://stripe.com/docs/api/promotion_codes/object
Fields
id: PromotionCodeId
Unique identifier for the object.
active: bool
Whether the promotion code is currently active.
A promotion code is only active if the coupon is also valid.
code: String
The customer-facing code.
Regardless of case, this code must be unique across all active promotion codes for each customer.
coupon: Coupon
created: Timestamp
Time at which the object was created.
Measured in seconds since the Unix epoch.
customer: Option<Box<Expandable<Customer>>>
The customer that this promotion code can be used by.
expires_at: Option<Box<Timestamp>>
Date at which the promotion code can no longer be redeemed.
livemode: bool
Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
max_redemptions: Option<Box<i64>>
Maximum number of times this promotion code can be redeemed.
metadata: Metadata
Set of key-value pairs that you can attach to an object.
This can be useful for storing additional information about the object in a structured format.
restrictions: PromotionCodesResourceRestrictions
times_redeemed: i64
Number of times this promotion code has been used.
Implementations
Returns a list of your promotion codes.
pub fn retrieve(
client: &Client,
id: &PromotionCodeId,
expand: &[&str]
) -> Response<PromotionCode>
pub fn retrieve(
client: &Client,
id: &PromotionCodeId,
expand: &[&str]
) -> Response<PromotionCode>
Retrieves the promotion code with the given ID.
In order to retrieve a promotion code by the customer-facing code
use list with the desired code
.
pub fn update(
client: &Client,
id: &PromotionCodeId,
params: UpdatePromotionCode<'_>
) -> Response<PromotionCode>
pub fn update(
client: &Client,
id: &PromotionCodeId,
params: UpdatePromotionCode<'_>
) -> Response<PromotionCode>
Updates the specified promotion code by setting the values of the parameters passed.
Most fields are, by design, not editable.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for PromotionCode
impl Send for PromotionCode
impl Sync for PromotionCode
impl Unpin for PromotionCode
impl UnwindSafe for PromotionCode
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more