Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.
This repository was archived by the owner on Apr 26, 2026. It is now read-only.

[iOS/Android] - onPurchaseSuccess isnt always called #3143

Description

@renatomserra

Hi,

For both iOS and android im facing an issue where sometimes onPurchaseSuccess isnt triggered after a successful purchase of both IAP and Subscriptions.
Im relying on this for validation.
It seems that even after using getAvailablePurchases those purchases arent available in the list.
But users get message item already owned for IAP and for subscription they get an email that the dev (me) never acknowledged their purchase and that they will be refunded.
One user the ack happened 2-3 days later.
The number of users with this issue i estimate is 20%

This logic is ran on a root component, requestPurchase is done by individual Screens

Would love some help

const {
    connected,
    subscriptions,
    products,
    fetchProducts,
    initConnectionError,
  } = useIAP({
    onPurchaseSuccess: async purchase => {
      await validatePurchase(purchase); // this validates and finishes, i have tracking in the flow, doesnt get called sometimes
    },
    onPurchaseError: error => {
      handleError(error, true);
    },
  });


  useEffect(() => {
    if (!connected || hasProcessedPendingOnConnectRef.current) {
      return;
    }
    hasProcessedPendingOnConnectRef.current = true;

    const processPendingPurchases = async () => {
      try {
        const purchases = await getAvailablePurchases({
          alsoPublishToEventListenerIOS: false,
          onlyIncludeActiveItemsIOS: false,
        });
        if (!purchases?.length) {
          return;
        }
        for (const purchase of purchases) {
          if (
            Helpers.isSubscriptionPurchase(purchase) ||
            Helpers.isAvatarPurchase(purchase) ||
            Helpers.isVideoPurchase(purchase)
          ) {
            await validatePurchase(purchase);
          }
        }
      } catch (error) {
        handleError(error, true);
      }
    };

    const timeoutId = setTimeout(processPendingPurchases, 1500);

    return () => clearTimeout(timeoutId);
  }, [connected, validatePurchase]);
"react-native-iap": "14.7.7",
 "react-native": "0.79.7",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions