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

RNIap.buyProduct not resolving and it's not storing the receipt state after completed transaction #506

Closed
DannyRox23 opened this issue May 31, 2019 · 7 comments · Fixed by #510
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed

Comments

@DannyRox23
Copy link

DannyRox23 commented May 31, 2019

Version of react-native-iap

Latest

Version of react-native

Latest

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

Android

Expected behavior

After purchase was successful, Alert "Congrats you have purchased" and fire function that hides the purchase button and unlocks consumable.

Actual behavior

After the purchase was successful, nothing happens but the purchase did work. I need to fire a function or logic after the purchase was successful because currently the user has to restart the app to "unlock" the products because I need to do the getAvailablePurchases bit all over again to verify purchased items.

Tested environment (Emulator? Real Device?)

Real Device and Bluestacks

Steps to reproduce the behavior

The Alert doesn't "alert" after the purchase window disappears or after any purchase is done for the matter. Why?

async PurchasePack(){
        try {
            const purchases = await RNIap.buyProduct( packID );

            Alert.alert('THANK YOU', 'Your purchase was successful!')

        } catch( err )  {
            // standardized err.code and err.message available
            console.warn( err.code, err.message );

            this.setState({ purchased: 'false' });
        }
    }
@DannyRox23 DannyRox23 changed the title How Fire a Function after the purchase was successful Android? RNIap.buyProduct not resolving Jun 3, 2019
@DannyRox23 DannyRox23 changed the title RNIap.buyProduct not resolving RNIap.buyProduct not resolving and it's not storing the receipt state after completed transaction Jun 3, 2019
@hyochan hyochan added 🙏 help wanted Extra attention is needed 🤖 android Related to android labels Jun 4, 2019
@hyochan
Copy link
Member

hyochan commented Jun 4, 2019

Try using InteractionManager.createInteractionHandle();. Android may have blocked your UI interaction.

@fokoz
Copy link

fokoz commented Jun 4, 2019

I have a problem which mays relate to this issue and it is so hard to test.

Occasionally(10-20%) my user purchased product successfully but the code never reach requesting to api on the next line, so the coin is lost.

@hyochan
Copy link
Member

hyochan commented Jun 6, 2019

@fokoz Have you also used Alert? This may block some thread in some devices if it has native ui coming up together. Please consider this one in mind.

@fokoz
Copy link

fokoz commented Jun 6, 2019

@hyochan I don't use alert and I don’t know which line doesn't resolve( buyProduct or consumePurchase) because when I test by myself everything goes fine but some user(10%) purchased the product and I receive order email from google but the next code is to send purchase token to api, I have no idea if it run or not.

I hope it is not about internet connection problem after purchasing or consuming

@hyochan
Copy link
Member

hyochan commented Jun 9, 2019

@fokoz I am planning to release new releases with some migrations in #510. I hope you to try `3.0.0-rc.0' when merged.

@hyochan hyochan mentioned this issue Jun 9, 2019
17 tasks
@fokoz
Copy link

fokoz commented Jun 10, 2019

@hyochan could you explain how can you fix this issue? What cause the problem? Why do just some user experience this but not all of them ?Thank you.

@hyochan
Copy link
Member

hyochan commented Jun 10, 2019

If you follow issue in #307, you will see the idea. Andorid iap works similar to ios so you may face the same problem. New purchase flow in #510 will describe how you can resolve this. Please try new purchase flow in 3.0.+.

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

Successfully merging a pull request may close this issue.

3 participants