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: {
    campaigid: 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

  • "CampaignNotRunning" will be returned if the campaign the coupon belongs to, is currently not active

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

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

  • "CouponRejectionReasonUnknown" will be returned if none of the reasons above fit the rejection. Usually, this implies that the coupon is valid and in an active campaign, but there were other conditions in the campaign rules that were not met.