Skip to content

Offers

You can create offer that you can apply to sales and customers. An offer can have either a fixed dollar amount or be a percentage discount.

Create an offer

Create an new offer

mutation CreateOffer(
  $stores: [ID]!
  $storeGroups: [ID]!
  $products: [ID]
  $name: String!
  $shortDescription: String!
  $longDescription: String!
  $placement: String!
  $startTime: DateTime!
  $endTime: DateTime!
  $redemptionCodeType: String!
  $enrollmentLimit: Int!
  $repeatable: Boolean!
  $dayStartTime: Time
  $dayEndTime: Time
  $daysOfWeek: [String]!
  $earnPoints: Boolean!
  $repeatDelayHours: Int
  $termsAndConditions: String
  $minimumSpend: String
  $code: String
  $pictures: [OfferImageInput]!
  $campaignId: ID!
  $weather: String!
  $offerType: String! # PERCENTAGE, FIXED_AMOUNT, BOGO
  $offerValue: Float!
  $numOfItems: Int
){
  createOffer(
    input: {
      stores: $stores
      storeGroups: $storeGroups
      products: $products
      name: $name
      shortDescription: $shortDescription
      longDescription: $longDescription
      placement: $placement
      startTime: $startTime
      endTime: $endTime
      redemptionCodeType: $redemptionCodeType
      enrollmentLimit: $enrollmentLimit
      repeatable: $repeatable
      dayStartTime: $dayStartTime
      dayEndTime: $dayEndTime
      daysOfWeek: $daysOfWeek
      earnPoints: $earnPoints
      repeatDelayHours: $repeatDelayHours
      termsAndConditions: $termsAndConditions
      minimumSpend: $minimumSpend
      code: $code
      pictures: $pictures
      campaign: $campaignId
      weather: $weather
      offerType: $offerType
      offerValue: $offerValue
      numOfItems: $numOfItems
    }
  ) {
    success
    errors
    offer {
      pk
      id
    }
  }
}
{
  "name": "20% off Birth day offer",
  "campaign": 3,
  "longDescription": "20% off Birth day offer",
  "shortDescription": "20% off Birth day offer",
  "pictures": [],
  "termsAndConditions": "",
  "segmentationRules": "[]",
  "offerType": "PERCENTAGE",
  "offerValue": 20,
  "numOfItems": 1,
  "products": [],
  "redemptionCodeType": "AUTOGENERATED",
  "code": "",
  "minimumSpend": "0.00",
  "earnPoints": true,
  "repeatDelayHours": 48,
  "repeatable": true,
  "stores": ["1", "9", "2", "10", "15", "13", "7", "12", "8", "11", "14"],
  "storeGroups": [],
  "enrollmentLimit": 100,
  "enrollmentUnlimited": true,
  "startTime": "2022-04-25T11:40",
  "endTime": "2023-12-31T23:40",
  "dayStartTime": "06:11",
  "dayEndTime": "23:41",
  "daysOfWeek": [
  "MONDAY",
  "TUESDAY",
  "WEDNESDAY",
  "THURSDAY",
  "FRIDAY",
  "SATURDAY",
  "SUNDAY"
  ],
  "placement": "TOP",
  "weather": "Sunny",
  "campaignId": 1
}
{
    "data": {
        "createOffer": {
            "success": true,
            "errors": null,
            "offer": {
                "id": "U3RvcmVOb2RlOjEzMQ=="
            }
        }
    }
}

Update an offer

mutation CreateOffer(
  $id: ID!
  $stores: [ID]
  $storeGroups: [ID]
  $products: [ID]
  $name: String
  $shortDescription: String
  $longDescription: String
  $placement: String
  $startTime: DateTime
  $endTime: DateTime
  $redemptionCodeType: String
  $enrollmentLimit: Int
  $repeatable: Boolean
  $dayStartTime: Time
  $dayEndTime: Time
  $daysOfWeek: [String]
  $earnPoints: Boolean
  $repeatDelayHours: Int
  $termsAndConditions: String
  $minimumSpend: String
  $code: String
  $pictures: [OfferImageInput]
  $campaignId: ID
  $weather: String
  $offerType: String # PERCENTAGE, FIXED_AMOUNT, BOGO
  $offerValue: Float
  $numOfItems: Int
){
  updateOffer(
    input: {
      id: $id
      stores: $stores
      storeGroups: $storeGroups
      products: $products
      name: $name
      shortDescription: $shortDescription
      longDescription: $longDescription
      placement: $placement
      startTime: $startTime
      endTime: $endTime
      redemptionCodeType: $redemptionCodeType
      enrollmentLimit: $enrollmentLimit
      repeatable: $repeatable
      dayStartTime: $dayStartTime
      dayEndTime: $dayEndTime
      daysOfWeek: $daysOfWeek
      earnPoints: $earnPoints
      repeatDelayHours: $repeatDelayHours
      termsAndConditions: $termsAndConditions
      minimumSpend: $minimumSpend
      code: $code
      pictures: $pictures
      campaign: $campaignId
      weather: $weather
      offerType: $offerType
      offerValue: $offerValue
      numOfItems: $numOfItems
    }
  ) {
    success
    errors
    offer {
      pk
      id
    }
  }
}
{
    "name": "Editd offer name"
}
{
    "data": {
        "updateOffer": {
            "success": true,
            "errors": null,
            "offer": {
                "id": "U3RvcmVOb2RlOjEzMQ=="
            }
        }
    }
}

Delete an offer

mutation (
  $id: ID!
){
  deleteOffer(
    input: {
      id: $id
    }
  ) {
    success
    errors
  }
}
{
    "id": 5
}
{
    "data": {
        "deleteOffer": {
            "success": true,
            "errors": null
        }
    }
}

List Offers

List all the offers available by store or merchant

query {
    offers{
        edges {
            node {
                pk
                id
            }
        }
    }
}

Get a single offer

query {
    offer(id: "U3RvcmVOb2RlOjE5"){
        pk
        id
        name
    }
}

Offer Object

Method Type Description
id ID! Unique ID of the offer
pk Int Primary Key of the offer
merchant UserNode Created by Merchant
campaign CampaignNode! Campaign ID
stores StoreNodeConnection! Apply to specific stores
storeGroups StoreGroupNodeConnection! Apply to store groups
products ProductNodeConnection! Apply to specific items
name String! Unique name of the promotion
shortDescription String! Mobile optimized short description of the discount
longDescription String! Long description of the discount
offerType OfferOfferType! FIXED_AMOUNT or Percentage discount
offerValue Float! The value or percentage of the discount.
numOfItems Int Min number of items. Non-Mandatory
placement OfferPlacement! Discount placement in mobile or web. Ex: Front Page or Top banner
startTime DateTime! Discount start datetime
endTime DateTime! Discount end datetime
redemptionCodeType OfferRedemptionCodeType! Autogenerated or fixed redemption code
enrollmentLimit Int! Max number of promotions
repeatable Boolean! How many times a customer can redeem this promotion
repeatDelayHours Int Any time delay to redeem the promotion
dayStartTime Time Set the start time this discount is valid(Ex: happy Hours)
dayEndTime Time Set the end time this discount is valid(Ex: happy Hours)
daysOfWeek [String] Set the day of week this offer is valid.(Ex: redeemable on saturday only)
weather String! Assign based on weather
earnPoints Boolean! Redeeming this offer will earn loyalty points or not
segmentationRules JSONString Customer who will be targeted based on segmentation
termsAndConditions String Terms and conditions
minimumSpendCurrency OfferMinimumSpendCurrency Currency
minimumSpend String Require a minimum subtotal to qualify for discount (Example: Spend $30 and get $10 off)
code String Provide the code is not Autogenerated
totalRating Float! Customer provided reviews
status OfferStatus! Is active or not
refreshHours Int! Default to '0'
redemptionIntents RedemptionIntentNodeConnection!
redemptions RedemptionNodeConnection How many time this offer is redeemed
pictures OfferPictureNodeConnection! Image of the offer
offerConsumers OfferConsumerNodeConnection! Targeted consumer ID
minimumSpendAmount Float Require a minimum subtotal to qualify for discount (Example: Spend $30 and get $10 off)
consumers OfferConsumerNodeConnection Return consumers who redeemed this offer
extraInfo JSONString
createdAt DateTime! Offer create timestamp
updatedAt DateTime! offer last update timestamp