Fix app purchase and in-app pay (bug 1010533)

TODO:

* [X] fix tests