@jamesbritt @yoniden here's a post from @jessica that shows one solution. I personally don't want to use AWS, but ymmv, as they say.
https://www.voidconspiracy.com/creating-a-self-hosted-music-storefront-using-aws-s3-and-sendowl/
I used paypal w/an automated protected d/l system back in the day, haven't really looked into modern equivalents.