Skip to main content
Creates a new discount coupon.

Mutation

mutation CreateCoupon($input: CreateCouponInput!) {
  createOneCoupon(input: $input) {
    id
    code
    status
    type
    discountValue
    duration
    durationInMonths
    maxRedemptions
  }
}
{
  "input": {
    "code": "SAVE20",
    "type": "PERCENTAGE",
    "discountValue": 20,
    "duration": "FOREVER",
    "maxRedemptions": 100
  }
}
{
  "data": {
    "createOneCoupon": {
      "id": "coupon-123",
      "code": "SAVE20",
      "status": "ACTIVE",
      "type": "PERCENTAGE",
      "discountValue": 20,
      "duration": "FOREVER",
      "durationInMonths": null,
      "maxRedemptions": 100
    }
  }
}

Parameters

input
CreateCouponInput
required
Input for creating a coupon

Examples

Percentage Discount

{
  "input": {
    "code": "SAVE20",
    "type": "PERCENTAGE",
    "discountValue": 20,
    "duration": "FOREVER"
  }
}

Fixed Amount Discount

{
  "input": {
    "code": "SAVE10",
    "type": "FIXED_AMOUNT",
    "discountValue": 10,
    "currency": "USD",
    "duration": "ONE_TIME"
  }
}

Limited Duration

{
  "input": {
    "code": "TRIAL3",
    "type": "PERCENTAGE",
    "discountValue": 50,
    "duration": "REPEATING",
    "durationInMonths": 3
  }
}