Instead of accessing an Offer directly through its id, you can also generate single use codes that are tied back to the offer.
When using offer codes, the offer is no longer able to be redeemed through its underlying id. That is, either an offer is global (and anyone with its id can claim it subject to timing and redemption limits), or an offer can be redeemed via single-use codes.
As soon as one code is generated for an offer, the require_code
flag on the offer will be set to true
and its id
disallowed for redemption.
Further, if you generate codes for an offer, the max_redemptions
attribute will be ignored. The offer's timing attributes (e.g., starts_at
and ends_at
) will still be considered, as will the code's enabled
attribute, but a valid code for an active offer will work in a redemption flow, no matter the value set for max_redemptions
.
Attributes:
Name | Type | Description |
---|---|---|
code | string | Randomly generated unique alphanumeric code. Will begin with the prefix RHQ. |
offer_id | string | The id of the associated offer. |
enabled | boolean | Offer codes cannot be deleted, only disabled. Disabled codes are not valid for use, but can be re-enabled. Offer codes are enabled upon creation. |
taken_by | string | The account identifier associated with the individual who used this offer code. If this offer code has not been used, this will be an empty string. |
taken_at | integer | Unix timestamp of when the offer code was used (in seconds since the Unix epoch). If the offer code has not been used, this will be 0 . |
created_at | integer | Unix timestamp of when the offer code was created (in seconds since the Unix epoch). |
updated_at | integer | Unix timestamp of when the offer code was last updated (in seconds since the Unix epoch). |