-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
getPurchaseHistory gets empty array in production #385
Comments
Getting same issues. |
We had a simular issue, and created the following bug report, which has been closed: |
@Cnordbo I don't think you are on the same issue because to re-purchase the item, you should make it as |
@hyochan i am on the same issue. As a sidenote, im on |
@Cnordbo Oh, I see. Yes, then you are on right track. Unfortunately, since I may not dig this problem for a while, I think you need someone else's help or dig yourself with this issue. |
Have you guys tried ‘getAvailablePurchases’? |
I almost forget I still keep this issue open. I can share how I 'solved' the problem. As I really didn't know how to fix this issue and only one of our user has this problem, I told the user to refund. The user refunded successfully and magically calling getPurchaseHistory from his phone was not returning empty array anymore but an array with one result(which showed that the order was refunded). Therefore this maybe a problem of apple iap server. |
@hyochan Your right, i am on another issue. But it could be the same... As im using getAvailablePurchases.. Heres my code for restoring: const restorePurchases = () => {
return new Promise((resolve, reject) => {
RNIap.getAvailablePurchases()
.then(purchases => {
let result = purchases.some(purchase => {
return purchase.productId === itemSkus.premium;
});
if (result) {
setPremium().then(resolve);
} else {
unsetPremium().then(() => {
reject({ message: `No previous purchases (${purchases.length})` });
});
}
})
.catch(err => {
return unsetPremium().then(() => reject(err));
});
});
}; As with any Open Source, im not expecting you (@hyochan) to handle everything yourself - so i am posting with general information that might aid anyone that takes a look at it. Im not quite sure on how to attack this, as its basically impossible to reproduce locally for me atm. as i always get a signing issue with the certificate when trying to run with release scheme locally. |
That would be nice, yes. Im too unfamiliar with the iOS purchase process myself to write such a request on the forum. Might be quicker if someone whos familiar with the code and process takes a look. |
"ghosts" account is deleted, so cant get any further with that info. |
This problem still happens occasionally, is there any updates? Thanks. |
It seems that I solved the problem by calling clearTransaction before every call of buySubscription, users who had the problem can now re-purchase again without costing any extra money because apple won't charge them again. |
Version of react-native-iap
2.4.0-beta6
Version of react-native
0.55.4
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
getPurchaseHistory result is not empty.
Actual behavior
The library generally works perfectly, but there is one case that confused me a lot. A user claimed that he subscribed a renewable product, for some reason the first purchase was not recorded so that we need the getPurchaseHistory to recover his purchase, but the problem is that the getPurchaseHistory function returned an empty array. When he tried to purchase again (by calling buySubscription), an alert with 'purchased message' pops up which showed that he has already purchased the product. I also confirmed his purchase by checking the purchase history from the itunes developer website.
Is there anyway to solve this problem? Thank you.
Tested environment (Emulator? Real Device?)
Production
Steps to reproduce the behavior
Unknown...
The text was updated successfully, but these errors were encountered: