Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transactionId always "" from getPurchaseHistory #424

Closed
gerbus opened this issue Mar 15, 2019 · 7 comments
Closed

transactionId always "" from getPurchaseHistory #424

gerbus opened this issue Mar 15, 2019 · 7 comments
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed

Comments

@gerbus
Copy link
Contributor

gerbus commented Mar 15, 2019

Version of react-native-iap

^2.4.1

Version of react-native

https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz

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

Android

Expected behavior

transactionId is not empty.

Actual behavior

transactionId is an empty string in result:
[{
autoRenewingAndroid: false,
signatureAndroid: 'LELlDZtkLgaDNLowuK9yphjvB9z8Dtlw+zM0TgcTgcztnMmPTLsrkPGDO1X30r3xtIO6exjujuKmUSJiGBX3vTzPzXdrmn5q0gqkQg6TCL2ZSC94/aIJE2zvws2GPGI02ICUCAotty2dbGiduAoE3Kf+SImcZPjoWjdh3l/mgYCzu7K+MrZmHU7F27NWPVv+RMg5q6Hzv2s7GuxYeD41BiBYHfbnTidD1EM5fu6cSivGswdFaSU8qlVNXkUNH1cKFARDE15iUrgeQQVh8KEN/dvvrcNIWNb8ICwvv9Y+wYGiC/zA/WkYCHyk/Xao0c7MRA==',
purchaseToken: 'mgbaflglpllamdhkjacb.AO-J1OyLsiyKIcSz2cNQeVTlo8ghi1MKn6BmfhdAMT04ZaWE5zWtCrTlCifgGfBJKx1IaqHMOA2N_iC9PHfFPFhxa67vQP9LAnvYDzMfQXRMzv7YT5Q',
dataAndroid: '{"productId":"app_000","purchaseToken":"mgbaflglpllamdhkjacb.AO-J1OyLsiyKIcSz2cNQeVTlo8ghi1MKn6BmfhdAMT04ZaWE5zWtCrTlCifgGfBJKx1IaqHMOA2N_iC9PHfFPFhxa67vQP9LAnvYDzMfQXRMzv7YT5Q","purchaseTime":1550610049162,"developerPayload":null}',
transactionReceipt: '{"productId":"app_000","purchaseToken":"mgbaflglpllamdhkjacb.AO-J1OyLsiyKIcSz2cNQeVTlo8ghi1MKn6BmfhdAMT04ZaWE5zWtCrTlCifgGfBJKx1IaqHMOA2N_iC9PHfFPFhxa67vQP9LAnvYDzMfQXRMzv7YT5Q","purchaseTime":1550610049162,"developerPayload":null}',
transactionDate: '1550610049162',
transactionId: '',
productId: 'app_000'
}];

Tested environment (Emulator? Real Device?)

Android device

Steps to reproduce the behavior

  1. Set up a subscription in App Store Connect
  2. Purchase the subscription from app using RNIap.buySubscription()
  3. Run RNIap.getPurchaseHistory() and look at the transactionId property of the result
@hyochan hyochan added 🙏 help wanted Extra attention is needed 🤖 android Related to android labels Mar 15, 2019
@hyochan
Copy link
Member

hyochan commented Mar 15, 2019

getPurchaseHistory is used only in non-consumable product. You should use getAvailablePurchases instead and that's written in the readme.

@hyochan hyochan closed this as completed Mar 15, 2019
@gerbus
Copy link
Contributor Author

gerbus commented Mar 15, 2019

Thanks @hyochan. I was confused when initially reading the README about those.

@gerbus
Copy link
Contributor Author

gerbus commented Mar 15, 2019

@hyochan actually the result of getAvailablePurchases() is an empty array. As stated in the readme:

Once an item is consumed, it will no longer be available in getAvailablePurchases() and will only be available via getPurchaseHistory().

What I am trying to do is get the transactionId of the most recent purchase.

@gerbus
Copy link
Contributor Author

gerbus commented Mar 15, 2019

I've updated Actual Behavior in case it's not clear what I'm seeing.

@hyochan hyochan reopened this Mar 15, 2019
@hyochan
Copy link
Member

hyochan commented Mar 15, 2019

@gerbus Sorry friend. I was confused. You are right. However, this is duplicate in #385.

@hyochan hyochan closed this as completed Mar 15, 2019
@gerbus
Copy link
Contributor Author

gerbus commented Mar 15, 2019

Hmm. Looks like the issue in #385 is a fully empty array, no? Just wanting to make sure this is in fact a duplicate of that, because for me the array is full except for the transactionId property.

Appreciate the prompt responses @hyochan!

@hyochan
Copy link
Member

hyochan commented Mar 16, 2019

@gerbus Then this might not be an issue and I think this is expected since transactionId only appears when there is no finished transaction (which means the transaction is not done yet). Helpful Read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants