dooboolab-community / react-native-iap

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

[STOREKIT2_MODE] getPurchaseHistory but the result is an empty array #2109

Closed 19424056 closed 1 year ago

19424056 commented 1 year ago

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description storekitMode: 'STOREKIT2_MODE'

Code i am using:

    const response = await getAvailablePurchases({
      alsoPublishToEventListener: false,
      automaticallyFinishRestoredTransactions: false,
      onlyIncludeActiveItems: false,
    });

   console.log(response) // []

getPurchaseHistory but current using function getAvailableItems, so when call getPurchaseHistory then return transactions available

https://developer.apple.com/documentation/storekit/transaction/3851204-currententitlements image

node_modules/react-native-iap/src/iap.ts image

node_modules/react-native-iap/ios/RNIapIosSk2.swift image

I think the problem is here, i tried it and it works well: https://developer.apple.com/documentation/storekit/transaction/3851203-all image

node_modules/react-native-iap/ios/RNIapIosSk2.swift add new function getHistoryItems image

node_modules/react-native-iap/src/iap.ts image

Expected Behavior The string is printed to the console

Screenshots N/A

Environment:

To Reproduce Steps to reproduce the behavior:

  1. Paste code within the requestPurchase function
  2. On device make getPurchaseHistory

[Optional] Additional Context

19424056 commented 1 year ago

@andresesfm Do you think that is the cause? Please help me

andresesfm commented 1 year ago

@19424056 Thank you for your feedback. I can see the need for all the transactions to be returned. Here is a proposed solution: https://github.com/dooboolab/react-native-iap/pull/2134

andresesfm commented 1 year ago

Released in 12.4.6. Let me know/reopen if any issues

19424056 commented 1 year ago

tks so much @andresesfm