Admin API / Types

CreateDiscountCodeInput

Input

The discount code to create.

input CreateDiscountCodeInput

Input fields

FieldTypeDescription
codeStringThe text that a buyer enters at checkout: 1 to 32 letters, digits and underscores, stored in upper case. Leading and trailing spaces are removed. Another value fails with VALIDATION_ERROR. Omitted or null: the server makes an unused 10-character code of letters and digits.
deactivatedBoolean!True creates the code turned off: its status is DEACTIVATED and checkout refuses it until reactivateDiscountCode turns it on. False creates an active code. Default: false.
eligibilityDiscountEligibility!The buyers who can use the code. Default: ALL_BUYERS.
expiresAtDateTimeWhen the code stops working. A time that is not in the future fails with VALIDATION_ERROR. Omitted or null: the code does not expire.
idempotencyKeyString!A client-generated key, 1 to 200 characters after trim. A repeat with the same key and input within 24 hours returns the first result and creates no second code. The same key with another input returns IdempotencyConflictError.
minimumSubtotalMoneyInputThe lowest order subtotal that the code applies to, in the store currency, with at most 2 decimal places and 15 digits. Omitted, null or 0: no minimum. Another currency gives CurrencyMismatchError.
oncePerBuyerBoolean!True when each buyer can use the code one time only. Default: true.
rewardDiscountRewardInput!The discount that a buyer gets. It cannot change after the code is created.
sellerIdIDThe seller who pays the discount and whose listings the code applies to: the caller, or a seller in Viewer.access.actingFor. Defaults to the caller. Another seller gives UnauthorizedError with requiredRole: null.
usageLimitPositiveIntThe number of uses allowed, at most 2,147,483,647. Omitted or null: no limit.