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

consumeAllItems doesn't work with android.test.purchased #497

Closed
fokoz opened this issue May 21, 2019 · 6 comments · Fixed by #510
Closed

consumeAllItems doesn't work with android.test.purchased #497

fokoz opened this issue May 21, 2019 · 6 comments · Fixed by #510
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed

Comments

@fokoz
Copy link

fokoz commented May 21, 2019

Version of react-native-iap

2.5.4

Version of react-native

0.55.4

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

Android

Expected behavior

consumeAllItems should be consume all items, also android.test.purchased test product id

Actual behavior

consumeAllItems doesn't consume 'android.test.purchased'
So I have to use RNIap.consumePurchase("inapp:com.learnary:android.test.purchased") to consume the test product.

Tested environment (Emulator? Real Device?)

Real Device

Steps to reproduce the behavior

const result = await RNIap.initConnection()
console.log('initiated connection?', result)
await RNIap.consumeAllItems();
const purchase = await RNIap.buyProduct('android.test.purchased');

Then error occurs "Already own this"

@hyochan hyochan added 🤖 android Related to android 🙏 help wanted Extra attention is needed labels May 23, 2019
@hyochan
Copy link
Owner

hyochan commented May 23, 2019

Try consumePurchase

@fokoz
Copy link
Author

fokoz commented May 23, 2019

@hyochan Yes. consumPurchase is working and I already stated it in Actual behavior.
However, I'm afraid that someone will be wasting time to figure it out because consumeAllItems should work, so it looks like a bug.

@hyochan
Copy link
Owner

hyochan commented May 24, 2019

@fokoz Thanks for coming back. Currently, I think I need more detail to get into this behavior.
What do you suspect this might be caused from the link.

@ko-devHong
Copy link

@fokoz 다시와 주셔서 감사합니다. 현재, 나는이 행동에 들어가기 위해서 더 자세하게 생각해야한다고 생각합니다.
당신이 의심 않는 것은으로부터 발생할 수 있습니다 링크 .

i'm same problem.

async componentDidMount() {
  try {
      const result = await RNIap.initConnection();
      await RNIap.consumeAllItems();
      console.log("result", result);
} catch (error) {
      alert(error);
    }
...
//결제테스트
  getItems = async itemSkus => {
    try {
      const products = await RNIap.getProducts(itemSkus);
      // const products = await RNIap.getSubscriptions(itemSkus);
      console.log("Products", products);
      this.setState({ productlist: products });
    } catch (err) {
      console.warn(err.code, err.message);
    }
  };

  buyItem = async sku => {
    console.info("buyItem: " + sku);
    try {
      const purchase = await RNIap.consumePurchase(sku);
      this.setState({ receipt: purchase.transactionReceipt }, () =>
      );
    } catch (err) {
      if (err.code === "E_USER_CANCELLED") {
        console.log("##################################");
        console.log(err.message);
        console.log(err.code);
        // code = { resultCode: "S900" };
        // this.webview.postMessage(JSON.stringify(code));
        console.log("-----------------------------------------------");
      }
      const subscription = RNIap.addAdditionalSuccessPurchaseListenerIOS(
        async purchase => {
          this.setState({ receipt: purchase.transactionReceipt }, () =>
            console.log("ios sucess")
          );
          subscription.remove();
        }
      );
    }
  };

}

this is did not work.
await RNIap.consumePurchase(sku);

@hyochan
Copy link
Owner

hyochan commented Jun 6, 2019

There seems to be an issue with getPurchases method in android. See here if it helps.

@hyochan
Copy link
Owner

hyochan commented Jun 9, 2019

I believe #510 will fix this.

@hyochan hyochan mentioned this issue Jun 9, 2019
17 tasks
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