pub struct CreatePromotionCode<'a> {
pub active: Option<bool>,
pub code: Option<&'a str>,
pub coupon: &'a str,
pub customer: Option<&'a str>,
pub expand: Option<&'a [&'a str]>,
pub expires_at: Option<i64>,
pub max_redemptions: Option<i64>,
pub metadata: Option<&'a HashMap<String, String>>,
pub restrictions: Option<CreatePromotionCodeRestrictions<'a>>,
}
products
only.Fields§
§active: Option<bool>
Whether the promotion code is currently active.
code: Option<&'a str>
The customer-facing code.
Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically.
coupon: &'a str
The coupon for this promotion code.
customer: Option<&'a str>
The customer that this promotion code can be used by.
If not set, the promotion code can be used by all customers.
expand: Option<&'a [&'a str]>
Specifies which fields in the response should be expanded.
expires_at: Option<i64>
The timestamp at which this promotion code will expire.
If the coupon has specified a redeems_by
, then this value cannot be after the coupon’s redeems_by
.
max_redemptions: Option<i64>
A positive integer specifying the number of times the promotion code can be redeemed.
If the coupon has specified a max_redemptions
, then this value cannot be greater than the coupon’s max_redemptions
.
metadata: Option<&'a HashMap<String, String>>
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.
Individual keys can be unset by posting an empty value to them.
All keys can be unset by posting an empty value to metadata
.
restrictions: Option<CreatePromotionCodeRestrictions<'a>>
Settings that restrict the redemption of the promotion code.
Implementations§
Source§impl<'a> CreatePromotionCode<'a>
impl<'a> CreatePromotionCode<'a>
Sourcepub fn send(&self, client: &Client) -> Response<PromotionCode>
pub fn send(&self, client: &Client) -> Response<PromotionCode>
A promotion code points to a coupon.
You can optionally restrict the code to a specific customer, redemption limit, and expiration date.
Trait Implementations§
Source§impl<'a> Clone for CreatePromotionCode<'a>
impl<'a> Clone for CreatePromotionCode<'a>
Source§fn clone(&self) -> CreatePromotionCode<'a>
fn clone(&self) -> CreatePromotionCode<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more