The reducePoint function works just fine. The issue is when the user is downloading a file using a download manager like IDM (Internet Download Manager). The reducePoint function gets executed twice! (the download works fine without IDM. and function gets executed 1 time as it should)
and the user gets charged twice for the points.
Although I use signed URLs and each URL is expiring at a certain time and has a signature.
The download manager I think does like a trial download to determine size or something like that, then aborts it and then downloads it for real (to be able to show a progress bar or something like that).
You could perhaps note the download with a session variable (storing the uuid) and allow them to download as many times as they like in the one session. Set the session variable on 1st download and deduct the points. Other requests from the same client can detect the uuid is already set in session and not touch the points.