The official document says that when this error happens it means
IAP may be disabled in security settings: iOS devices only
The system purchasing library may be outdated
My case did not fall into any of the above but simply because I have not logged into my Google account on the test device yet.
If you encounter the above error on Android, it may help to check if the Play Store has been set up properly before trying anything else.