Hi,
The error you get should not be relevant for the issue you get, when you publish this error should not be exist anymore.
Be sure you Apple Id is added to Sandbox Testers page on Itunes Connect (Users and Roles).
You can test it by logout from your Itunes account on your device, so when you click the buy button, the device ask you to log in.
If this is the case, buy works, but you have to login with you Sandbox account to make the purchases in test mode.
Hope this is the case,