Promotion Code
A Promotion Code represents a customer-redeemable code for a coupon. It can be used to create multiple codes for a single coupon.
The Promotion Code object
Attributes
- idstring
Unique identifier for the object.
- codestring
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
- coupondictionary
Hash describing the coupon for this promotion code.
- metadatanullable dictionary
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.
More attributes
- objectstring
- activeboolean
- createdtimestamp
- customernullable stringExpandable
- expires_
atnullable timestamp - livemodeboolean
- max_
redemptionsnullable integer - restrictionsdictionary
- times_
redeemedinteger
Create a promotion code
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.
Parameters
- couponstringRequired
The coupon for this promotion code.
- codestring
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.
- metadatadictionary
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
.
More parameters
- activeboolean
- customerstring
- expires_
attimestamp - max_
redemptionsinteger - restrictionsdictionary
Returns
Returns the promotion code object.
Update a promotion code
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.
Parameters
- metadatadictionary
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
.
More parameters
- activeboolean
- restrictionsdictionary
Returns
The updated promotion code object is returned upon success. Otherwise, this call raises an error.