We study duality in simple two-dimensional orbifold models with metric and axionic backgrounds at arbitrary orders in string perturbation theory. It is shown that duality involves certain linear relations among twist correlators at dual backgrounds which are independent of the perturbative order. Relying on methods of harmonic analysis, a nonperturbative representation (in the sense of string field theory) of a class of S-matrix elements is obtained in terms of a universal background-independent spectral distribution and nonholomorphic modular vector functions of the background parameters. At the same time, we find new realizations of the Verlinde algebra and of hypergroups characterizing the S-matrix nonperturbatively. Various examples and calculations are worked out.