Hello, Gretings for the day.
We can use Moodle, user will first visit the website to find the courses and do the registration, after completing the payment they can access the courses into the moodle LMS. They an also take test and generate thecertificates.
Moodle is on opensource platform and I will explain you how to add courses, create quizzes, see the student reports and manage enrollments.
Connect with me so we can discuss further, thanks