Instructions on how to create a secure download button in a repeater that only appears active for members with a specific role

What are you trying to achieve:
I’m nowhere an expert on Velo and have recently come back to Wix. I’d be able to learn it better and accomplish this task but I require this as fast as possible after discovering a security issue with digital product sales.
I wanted to know how to create a secure download button (file download link access requires the users to be logged into the site and have a specific role) inside a Repeater (each section button connects to a different file from a database collection connected to the Wix Store products database) where the download button only shows as active and interactable when the user has a specific role attributed to them after purchasing the specific product.

What have you already tried:
I have tried to code the button and have partially succeeded, but the secure methods have bricked me and haven’t been able to find a solution that works for my case, plus several other issues related to the Repeater where all the buttons keep downloading the same file.

Additional information:
Thank you in advance to anyone able to help me with this, and if possible I’d like to ask for code explanations so I can grasp the logic behind it and have an understanding on how it works so I can base on it later on when I have more knowledge on Velo and Wix’s tools.