Cosmic rays may be linked to the formation of volatiles necessary for prebiotic chemistry. We explore the effect of cosmic rays in a hydrogen-dominated atmosphere, as a proof-of-concept that ion–neutral chemistry may be important for modelling hydrogen-dominated atmospheres. In order to accomplish this, we utilize Monte Carlo cosmic ray transport models with particle energies of 106 eV<E<1012 eV in order to investigate the cosmic-ray enhancement of free electrons in substellar atmospheres. Ion–neutral chemistry is then applied to a Drift–Phoenix model of a free-floating giant gas planet. Our results suggest that the activation of ion–neutral chemistry in the upper atmosphere significantly enhances formation rates for various species, and we find that C2H2, C2H4, NH3, C6H6 and possibly C10H are enhanced in the upper atmospheres because of cosmic rays. Our results suggest a potential connection between cosmic-ray chemistry and the hazes observed in the upper atmospheres of various extrasolar planets. Chemi-ionization reactions are briefly discussed, as they may enhance the degree of ionization in the cloud layer.