Access to the video on the condition

Tell me please how to Rails technology is implemented access to the
video on the condition?
For example a website where people can view the video, paying only
money for it.
That is, membership in such

There is a plugin for that or is it all written from scratch?

not from scratch , but you have to know what you are doing, read about it here