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

[Error: skus is required for Android purchase] #2124

Closed
mikemangas opened this issue Nov 23, 2022 · 1 comment
Closed

[Error: skus is required for Android purchase] #2124

mikemangas opened this issue Nov 23, 2022 · 1 comment

Comments

@mikemangas
Copy link

mikemangas commented Nov 23, 2022

Description

So whenever I cam calling the "getProducts"-Method , i receive the error:

' [Error: skus is required for Android purchase]'

const {
    connected,
    products,
    currentPurchase,
    getProducts,
    requestPurchase,
    finishTransaction,
  } = useIAP();
  
  // so first I am calling within a useContext - this part works fine (i am receiving data etc. for that item)
  await getProducts({skus: items});

// and afterwards, when i chose to buy
await requestPurchase({sku: product.productId}); // whenever i call this, i receive the error

Expected Behavior
No error. Show the google-pay window.

Environment:

  • react-native-iap: newest version
  • react-native: newest version
  • Platforms (Android Emulator + Xiaomi Poco Pro 2 Device):
@mikemangas
Copy link
Author

Problem solved:
I had to pass the parameter skus instead of sku. And it has to be an array!
example:
await requestPurchase({skus: [product.productId]});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant