Understanding the meta-response

Currently, the meta object provides you:

  • All custom attribute values for all triggered campaigns and the coupon

  • The reasons why a coupon was rejected

There are currently 3 possible sub-objects that can be present in the meta-data object:

1. If there have been effects triggered by the request you will receive a campaigns object

meta: {
campaigns: {
    "1": {
    attributes: {
        rrp: 34.95,
        Brand: "Nike",
        ProductOnSale: false
    }
    }
}
}

The campaigns-object will contain the campaign-id and all the custom campaign attributes.

2. If there was a coupon sent within the request you will receive a coupons object.

meta: {
  coupons: {
    "XXXXX": {
      attributes: {
        rrp: 34.95,
        Brand: "Nike",
        ProductOnSale: false
      }
    }
  }
} 

The coupons-object will contain the certain coupon value and all the custom campaign attributes.

If the transfered coupon has been rejected, you will receive a couponRejectionReason object

meta: {
  couponRejectionReason: {
    campaignId: 12, 
    couponId: 0, 
    reason: 'CouponNotFound' 
  }
} 

The couponRejectionReason-object will contain a string which can have the following text:

  • "CouponNotFound" will be returned if the transferred coupon is wrong

  • "CouponPartOfNotRunningCampaign" will be returned if the campaign the coupon belongs to, is currently not active. The campaignId field will have the id of that campaign

  • "CouponLimitReached" will be returned if the coupon redemption limits have been reached

  • "CouponRecipientDoesNotMatch" will be returned if the given coupon value does not match the recipient

  • "CouponRejectedByCondition" will be returned if the coupon is valid and in an active campaign, but there were other conditions in that campaign's rules that were not met