interface DiscountCodeDraft {
    cartDiscounts: CartDiscountResourceIdentifier[];
    cartPredicate?: string;
    code: string;
    custom?: CustomFieldsDraft;
    description?: LocalizedString;
    groups?: string[];
    isActive?: boolean;
    key?: string;
    maxApplications?: number;
    maxApplicationsPerCustomer?: number;
    name?: LocalizedString;
    validFrom?: string;
    validUntil?: string;
}

Properties

Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.

cartPredicate?: string

DiscountCode can only be applied to Carts that match this predicate.

code: string

User-defined unique identifier for the DiscountCode that can be added to the Cart to apply the related CartDiscounts. It cannot be modified after the DiscountCode is created.

Custom Fields for the DiscountCode.

description?: LocalizedString

Description of the DiscountCode.

groups?: string[]

Groups to which the DiscountCode will belong to.

isActive?: boolean

Only active DiscountCodes can be applied to the Cart.

key?: string

User-defined unique identifier for the DiscountCode.

This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Discount Codes with the [Import API](/../import-export/) and the [Merchant Center](/../merchant-center/import-data).
maxApplications?: number

Number of times the DiscountCode can be applied.

If not set, the DiscountCode can be applied any number of times.
maxApplicationsPerCustomer?: number

Number of times the DiscountCode can be applied per Customer.

If not set, the DiscountCode can be applied any number of times.

Name of the DiscountCode.

validFrom?: string

Date and time (UTC) from which the DiscountCode is effective. Must be earlier than validUntil.

validUntil?: string

Date and time (UTC) until which the DiscountCode is effective. Must be later than validFrom.