The valuation pairing on an upper cluster algebra