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

TODO:

* [ ] fix tests