dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.81k stars 641 forks source link

Not getting callback after successfully subscribed to any plan in ios #1137

Closed leelaprasadsahu22 closed 3 years ago

leelaprasadsahu22 commented 4 years ago

Version of react-native-iap 4.5.0

Version of react-native 0.62.2

Platforms you faced the error (IOS or Android or both?) IOS

Expected behavior Should get callback after subscribe any plan

Actual behavior Not getting callback from IAP after successfully subscribed any plan

Tested environment (Emulator? Real Device?) device

Steps to reproduce the behavior Just follow the code Integrate the plugin as per document and subscribe any plan in ios device

jordangrant commented 3 years ago

Might take a while

cwmilazzo commented 3 years ago

I have the same issue. I've done both subscriptions and purchases of consumable products, and never get any callbacks. I'm on react-native-iap 5.0.0 (tried with 4.6.1 and same issue)

lordkiz commented 3 years ago

+1

Tayyab304 commented 3 years ago

Update listener is called on first time when call this method if you don't clear Transaction then 2nd time it's not being called. Clear Transaction in iOS case when first time update listener is called in purchaseUpdatedListener() like below

purchaseUpdateSubscription = purchaseUpdatedListener( async (purchase: InAppPurchase | SubscriptionPurchase) => {

      const receipt = purchase.transactionReceipt;

      if (receipt) {

        try {
          if (Platform.OS === 'ios') {
            finishTransactionIOS(purchase.transactionId ?? "");
          } else if (Platform.OS === 'android') {
           If consumable (can be purchased again)
          //   consumePurchaseAndroid(purchase.purchaseToken);
          //   // If not consumable
          //   acknowledgePurchaseAndroid(purchase.purchaseToken);
          }
          const ackResult = await finishTransaction(purchase);
        } catch (ackErr) {
          console.warn('ackErr', ackErr);
        }

      }

    },
  );
stale[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

stale[bot] commented 3 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.