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

[Android] Getting "purchase is not suitable to be purchased" #964

Closed
drbarto opened this issue Apr 3, 2020 · 7 comments
Closed

[Android] Getting "purchase is not suitable to be purchased" #964

drbarto opened this issue Apr 3, 2020 · 7 comments

Comments

@drbarto
Copy link

drbarto commented Apr 3, 2020

RN: 0.61.5
RNIap: 4.4.3
Platform: Android
Expected: calling finishTransaction succeeds
Actual: finishTransaction fails with "purchase is not suitable to be purchased"
Test env: real device

I'm integrating RNIap into a new app (so no real-world experiences yet) in order to purchase a non-consumable product. The iOS part works fine, but on Android I recently started to consistently get the error "purchase is not suitable to be purchased" when calling RNIap.finishTransaction.

Looking at the code, this indicates that my purchase is not considered to be purchased (!purchase.isAcknowledgedAndroid && purchase.purchaseStateAndroid === PurchaseStateAndroid.PURCHASED is false).

I'm pretty sure that my general setup (product id, native app configuration, etc.) is correct because a) the process works on iOS and b) it also used to work on Android until recently.

Some additional background: when starting the app in test mode I try to clean up any leftover data by following resolve unacknowledged purchase and consume owned items to avoid "already owned" error. Disabling those calls did not make a difference though.

Anyone has a hint what might be wrong in my setup?

@drbarto
Copy link
Author

drbarto commented Apr 3, 2020

I found a workaround: before calling finishTransaction, I re-fetch the purchase object with RNIap.getAvailablePurchases. This updates the relevant properties (isAcknowledgedAndroid, purchaseStateAndroid) so that finishTransaction succeeds again. Is this expected behaviour?

@drbarto
Copy link
Author

drbarto commented Apr 3, 2020

Ok, found the problem: I accidentally stripped the Android-specific properties from the purchase object, that's why re-fetching solved my problem. Now, after getting rid of this code, all works as expected 👍

@drbarto drbarto closed this as completed Apr 3, 2020
@haikov
Copy link

haikov commented Apr 22, 2020

@drbarto can you please share a bit more details regarding your fix? I started seeing same errors in the crash reporting tool, but they're not consistently happening and I'm unable to reproduce them locally 🤔

@drbarto
Copy link
Author

drbarto commented Apr 22, 2020

@haikov sorry, but my "fix" is for sure not applicable to you. I have a helper function which converts the purchase JSON data which I receive from RNIap to something our backend can digest, and in this function I accidentally forgot to copy some Android-specific data fields.

@sbrighiu
Copy link

'purchase is not suitable to be purchased' I see this too for old test payments. I cannot call finish transaction on them.

@AdamGerthel
Copy link

@haikov @sbrighiu Same for me. Found any solutions?

@sbrighiu
Copy link

sbrighiu commented Sep 2, 2020

#1092

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants