Skip to content

Fetch current user coupons

We handle the complete emission and redemption coupon cycle in our platform, and we deliver a coupon content only when a coupon is emitted (you will not be notified of recipes when a profile has already received the coupon, even if the coupon is still valid).

You can ask the library to fetch the list of all the user current coupons with the method:

NearIT.getCoupons({
  success: function(result) {
    // SUCCESS: You got user coupons
    var coupons = result.coupons;
    for (var i = 0; i < coupons.length; i++) {
      console.log(coupons[i]);
    }
  },
  error: function(error) {
    // ERROR: failed fetching user coupons
    console.log(error);
  }
});

N.B.: The method will also return already redeemed coupons so you get to decide to filter them if necessary.