Admin API / Types
CreateDiscountCodeInput
InputThe discount code to create.
input CreateDiscountCodeInputInput fields
| Field | Type | Description |
|---|---|---|
code | String | The 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. |
deactivated | Boolean! | 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. |
eligibility | DiscountEligibility! | The buyers who can use the code. Default: ALL_BUYERS. |
expiresAt | DateTime | When the code stops working. A time that is not in the future fails with VALIDATION_ERROR. Omitted or null: the code does not expire. |
idempotencyKey | String! | 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. |
minimumSubtotal | MoneyInput | The 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. |
oncePerBuyer | Boolean! | True when each buyer can use the code one time only. Default: true. |
reward | DiscountRewardInput! | The discount that a buyer gets. It cannot change after the code is created. |
sellerId | ID | The 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. |
usageLimit | PositiveInt | The number of uses allowed, at most 2,147,483,647. Omitted or null: no limit. |