redeem backend logic