Defines the set of constraints that govern how and when the coupon can be redeemed.
type
and value
to define the rule. Possible value: customer
: The constraint is applied based on customer
records.entity_type
and value
, determines how the constraint is enforced. Possible values are:max_redemptions
: Limits the number of times the coupon can be redeemed for a given entity_type
. The maximum count is defined in value
. For example, if entity_type
is customer
and value
is 10
, the coupon can be redeemed up to 10 times for each customer.new_customer
: Applies the coupon only to new customers. A customer is considered new if they do not have any prior non-void, non-zero-dollar invoices.existing_customer
: Applies the coupon only to existing customers, defined as those who have at least one non-void, non-zero-dollar invoice.unique_by
: When entity_type
is customer
, allows the coupon to be redeemed only once per unique value of a specified customer
field, defined in value
. For example, if value
is email
, the coupon can be redeemed only once for each unique customer.email
. If multiple customer records share the same email, the coupon is restricted to a single use across those records.Defines the value associated with the coupon constraint. The interpretation of this field depends on the value of constraints[type]
:
When type
is unique_by
, the value
specifies a unique customer
field such as email
or id
.
When type
is max_redemptions
, the value
is an integer representing the maximum number of times the coupon can be redeemed per entity. This number typically ranges from 1
to the defined coupon_max_redemptions
.
When type
is new_customer
or existing_customer
, the value
may reference criteria based on invoice history (e.g., whether a customer has at least one non-void, non-zero-dollar invoice).