We report high-fidelity state readout of a trapped ion qubit using a trap-integrated photon detector. We determine the hyperfine qubit state of a single 9 Be + ion held in a surface-electrode rf ion trap by counting state-dependent ion fluorescence photons with a superconducting nanowire single-photon detector fabricated into the trap structure. The average readout fidelity is 0.9991(1), with a mean readout duration of 46 µs, and is limited by the polarization impurity of the readout laser beam and by off-resonant optical pumping. Because there are no intervening optical elements between the ion and the detector, we can use the ion fluorescence as a self-calibrated photon source to determine the detector quantum efficiency and its dependence on photon incidence angle and polarization.