RPC:S-7:AEC-0 error buying apps with custom domain google account

I was trying to buy an app for my daughter's android device and when you got to the purchase page I was getting an error:

Error while retrieving information from the server RPC:S-7:AEC-0

Not a particularly useful error.

As this was a google account with a custom domain it turned out the issue was that google wallet wasn't enabled on the admin page for the custom domain.

Go to your admin page click "Users", click on the user you need to update and then click "show more".

Scroll to where it says "N More Google services enabled" and find google wallet and enable it.

With Google Wallet enabled payment accounts could be added and the app could finally be purchased.