They do it all at the store when purchasing, they will also insist on £10 (min) credit being put on. Make sure they set the Network to pay-and-go settings, they didn't with me and it took a while to realise it.
You will leave the store with a fully functioning phone.
ps pay and go phones can be bought direct at Apple stores, you don't need to go into an O2 store