amazon-in-app-purchase

How do I easily restore purchases using the Amazon API?


I'm trying to restore purchases just like iOS, and I can't figure out how to easily restore an IAP entitlement purchase with the Amazon API.

If I send another request with the SKU to the PurchasingManager, it returns a PurchaseResponse, but that PurchaseResponse doesn't return a valid Receipt if the SKU has already been purchased. It's null.

Seems like I would need that SKU to do any kind of processing.


Solution

  • Found how to do this.

    Turns out a different function call is needed instead of the initiatePurchaseRequest call.

    PurchasingManager.initiatePurchaseUpdatesRequest(Offset offset)
    

    This call gets all the purchases the user has made then returns them to the PurchasingObserver to be handled by:

    PurchasingObserver.onPurchaseUpdatesResponse(PurchaseUpdatesResponse purchaseUpdatesResponse)