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

This in-app purchase has already been bought Alert though clearTransactionIOS method was used #934

Closed
meteorra opened this issue Feb 20, 2020 · 3 comments · Fixed by #938
Labels
🙏 help wanted Extra attention is needed 📱 iOS Related to iOS

Comments

@meteorra
Copy link

meteorra commented Feb 20, 2020

Version of react-native-iap

4.4.0

Version of react-native

0.61.5

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

IOS

Expected behavior

When buying several consumable products one by one, e.g. six new products, than 'This in-app purchase has already been bought' Alert appears & I'm not able to buy this product any more. I've tried to apply clearTransactionIOS on application launch but it doesn't help. Any ideas how to fix that? Where is the proper place to call clearTransactionIOS?

Actual behavior

"This in-app purchase has already been bought" doesn't appear & transaction is finished

Tested environment (Emulator? Real Device?)

Real Device

Steps to reproduce the behavior

  • launch an application
  • buy several consumable products. For several first products 'Success' alert appears, but for the lates 'This in-app purchase has already been bought' Alert appears. Though all the transactions are finished with finishTransaction() method. Also clearTransactionIOS() is called on app launch

Thanks for help in advance

@hyochan hyochan added 🙏 help wanted Extra attention is needed 📱 iOS Related to iOS labels Feb 22, 2020
@hyochan
Copy link
Owner

hyochan commented Feb 22, 2020

Is your product consumable? Please check if you've created your product correctly in itunesconnect.

Also, try calling clearProductIOS when you've re-fetch the products.

@meteorra
Copy link
Author

meteorra commented Feb 23, 2020

Yep, it's consumable. Picture is attached. I'm already doing clearProductIOS once I'm fetching products. Maybe I'm missing something else?
Fetching products looks like this:

function* purchasesSaga() {
try {
    yield call(initConnection)
    yield call(clearProductsIOS)
    const products: Product[] = yield call(getProducts, productSkus)// productSkus - array of consumable products
    const subscriptions: Subscription[] = yield call(getSubscriptions,subscriptionSkus)// subscriptionSkus - array of subscriptions
    yield put(getInAppPurchasesSuccess({ products, subscriptions }))
} catch (e){}
}

Screen Shot 2020-02-23 at 2 09 01 PM

@hyochan
Copy link
Owner

hyochan commented Feb 23, 2020

Please download 4.4.2 and see if it resolves the problem!

If 4.4.2 doesn't help, please try to add below in viewDidLoad and try again.

for transactionPending in SKPaymentQueue.default().transactions {
    SKPaymentQueue.default().finishTransaction(transactionPending)
}

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

Successfully merging a pull request may close this issue.

2 participants