We need to solve this use case: - user makes an in-app purchase with Happy Birds app - user buys a newer Firefox OS phone (or loses their phone, re-flashes it, etc) - user re-installs Happy Birds app - all previously purchased in-app products are restored Currently all device receipts are tied to a device and not restored anywhere else. We can't do it from the Marketplace because the app origin is wrong (see bug 944523). However, we can figure out which user owns what after bug 986614.
It might be good if we wait until Firefox Accounts land before adding this feature. The app will need to somehow deal with user identity here.
This is probably a higher priority now as we're wanting to get to the point of wanting to have fxpay as the recommended way to implment in-app.
This bug will probably turn into several smaller bugs but I'm assigning it to myself to at least start thinking about it ;)
Here's a brain dump of how this might work: - app has a button somewhere saying 'restore purchases' - when tapped, app calls fxpay.restorePurchasedProducts().then(...) - this opens a popup (iframe? web activity?) to a special page on the marketplace - user logs in with their firefox account - marketplace queries the db for their purchases - marketplace generates new receipts and returns them via postMessage to the calling window - fxpay acknowledges receipts and calls addReceipt() as it would normally - app gets a callback with each restored product object
Postponing some work while I focus on Mozilla's new payments service
> marketplace generates new receipts and returns them via postMessage to the calling window correction: Marketplace should postMessage to the exact app domain matching the purchase records. This should prevent unauthorized apps from obtaining foreign purchase data.
Based on the recently announced future plans for the Marketplace to remove payments, closing these bugs.