RNIap.requestPurchase is not responding in iOS
See original GitHub issueVersion of react-native-iap
4.4.8
Version of react-native
0.61.5
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
await RNIap.requestPurchase(sku, false)
console.log('REQUEST OVER')
REQUEST OVER to be printed.
Actual behavior
In device i use sandbox tester account, it is responding and working well. But with any other devices or simulator it is not responding or resolving. This is vital since during app review, Apple keep rejecting my application with reason of tapping in BUY is not responding.
There is no problem about RNIap.getProducts(itemSkus)
Tested environment (Emulator? Real Device?)
Real Device and Simulator
Steps to reproduce the behavior
async componentDidMount() {
RNIap.getProducts(itemSkus)
.then((products) => {
this.setState({ products: products })
})
.catch((error) => {
console.log(error.message)
})
}
requestPurchase = async (sku) => {
try {
await RNIap.requestPurchase(sku, false)
console.log('REQUESTED OVER')
} catch (err) {
console.warn(err.code, err.message)
}
}
render() {
const { products } = this.state
return (
<View>
{products.map((p, i) => { return (
<TouchableWithoutFeedback onPress={() => this.requestPurchase(p.productId)}>
<Text> BUY </Text>
</TouchableWithoutFeedback> ) })}
</View>)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Unable to call back for purchased products ?IAP for React ...
We are requesting to## Heading ## purchase a product and able to purchase the product but not receving any product purchase call back....
Read more >react-native-iap - npm
This react-native module will help you access the In-app purchases capabilities of your phone on the Android , iOS platforms and the Amazon ......
Read more >React Native : Subscriptions, In-App Purchases & Service ...
First thing you should do is to define your items for iOS and Android separately like defined below. import * as RNIap from...
Read more >React Native IAP - Javatpoint
React-native-app provides the basic features we need but is not a ... Then follow the instructions below, depending on the platform you're working...
Read more >How to use the react-native-iap.requestPurchase function in ...
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same problem and @Panda313 suggestion to add
await RNIap.initConnection()
incomponentDidMount
worked. Too bad this is not better documented…I may have fixed it by adding
At the begining of componentDidMount ;
Let me know if that help