In this paper, we propose a novel online centralized algorithm for energy cooperation among energy harvesting capable base stations (BSs) in multi-tier cellular networks. BSs are connected to the non-renewable source used by a BS when it cannot harvest sufficient energy to serve its connected users. BSs with the extra harvested energy operate cooperatively and share their surplus energy with BSs that have not harvested sufficient energy. To stimulate BSs with energy deficit to use the shared energy of other BSs, an energy pricing framework is established which results in reducing of the non-renewable energy consumption. We formulate the problem of maximizing the fairness of the renewable energy distribution. The closed-form of energy share given to each BS with energy deficit is found, by which the renewable energy distribution fairness is maximized. Energy is shared by the smart grid. The problem of minimizing the smart grid usage cost for distributing energy is formulated and an online algorithm is proposed to approximate its solution. Simulation results show that the approximate algorithm reduces the non-renewable energy consumption significantly and reduces the cost of smart grid usage near to the optimal solution.