How do book distributors get paid?

They get paid based on how many products they sell and how many are on the shelf. Like a store if they dont sell much they dont get paid too much.