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

No callback for transaction with state purchased. #452

Closed
Finneah opened this issue Apr 10, 2019 · 2 comments
Closed

No callback for transaction with state purchased. #452

Finneah opened this issue Apr 10, 2019 · 2 comments
Labels
📱 iOS Related to iOS ❓ question Further information is requested

Comments

@Finneah
Copy link

Finneah commented Apr 10, 2019

Version of react-native-iap

2.4.7

Version of react-native

0.57.8

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

iOS

Actual behavior

its my first IAP test and i need help.

When I purchase the product i still purchased (Sandbox) I get "You allready buyed this product. The product will be restored." But i get no callback or return. How can i handle this restoring process so i can save the purchased state and the User can use the Product?
Or does'nt it work this way?

My Code

   const purchase = await RNIap.buyProduct(identifier);
    this.setState({
      receipt: purchase.transactionReceipt
    });
this._saveProductIsBuyed()

Tested environment (Emulator? Real Device?)

Real device (iPad)

Thanks for help

@hyochan
Copy link
Member

hyochan commented Apr 10, 2019

@Finneah You are not understanding the iap feature correctly. Restore purchase is to get products you've already purchased in other device when you reinstalled the app. To re-buy the item you should create product as consumable.

@hyochan hyochan closed this as completed Apr 10, 2019
@hyochan hyochan added 📱 iOS Related to iOS ❓ question Further information is requested labels Apr 10, 2019
@Finneah
Copy link
Author

Finneah commented Apr 10, 2019

Hello @hyochan
thank you for answering so fast.
I don't think i missunderstood it. I think i did'nt explain it exactly:

Use-Case:
user can buy a product (one-time purchase for example 'Premium')

  1. user buys this product.
  2. user install the App on another device (same Apple ID)

Now, i have seen it on other Apps:
Product is not showed as buyed (because i don't want to ask for already buyed products at App-Start, as i said, i have seen it on other Apps)
3. user clicks on "buy product"
4. Alert "alredy buyed" is viewed and the Message that the purchase will be restored is showed.
But nothing happens.

For this i need a return that the Product is restored but i do not get anything and the next console.log is not showed.

const purchase = await RNIap.buyProduct(productIdentifier);
console.log('TEST', purchase); <= will not be shown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱 iOS Related to iOS ❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants