In cases of self consumption of the solar energy, the payback time is calculated based on how much electricity is not purchased from the grid.
For example, in Germany, with electricity prices of 0.25 Euro/KWh and insolation of 900 KWh/KW, one KWp will save 225 Euro per year, and with an installation cost of 1700 Euro/KWp the system cost will be returned in less than 7 years.
However, in many cases, the patterns of generation and consumption do not coincide, and some or all of the energy is fed back into the grid. The electricity is sold, and at other times when energy is taken from the grid, electricity is bought. The relative costs and prices obtained affect the economics.