as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

useIapPurchaseUpdates

useIapPurchaseUpdates(purchaseUpdatesRequest): object

useIapPurchaseUpdates hook should be called in your main screen component. This hook automatically invokes getPurchaseUpdates API and populates states during main screen launch and App state transitions from BG -> FG. "iapPurchaseUpdates" state returned by this hook has unfulfilled and canceled consumable purchases. Amazon recommends that you persist the returned PurchaseUpdates data and query the system only for updates by calling the hook with reset flag being false.

This hook ensures to keep getting you latest purchase updates.

Sample Usage:
   export const AppMainPage = () => {
      // Calling useIapPurchaseUpdates in main screen
      const {iapPurchaseUpdatesLoading, iapPurchaseUpdatesError, iapPurchaseUpdates} =
                                                               useIapPurchaseUpdates({ reset: false });
      ...
      ...
      // Once PurchaseUpdates is loaded, call handler
      if (!iapPurchaseUpdatesLoading) {
         if (iapPurchaseUpdatesError) {
            // Handle Error based on iapPurchaseUpdates.responseCode
            ...
         } else {
            // Persist the iapPurchaseUpdates.receiptList and fulfill the purchases.
            ...
         }
      }
      ...
   }

Parameters

purchaseUpdatesRequest

PurchaseUpdatesRequest

Purchase Updates request parameters

Returns

object

States and value of Purchase updates

iapPurchaseUpdates

iapPurchaseUpdates: any

iapPurchaseUpdatesError

iapPurchaseUpdatesError: any

iapPurchaseUpdatesLoading

iapPurchaseUpdatesLoading: any


Last updated: Sep 30, 2025