Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const subscribeToSKU = useCallback((productId: string) => {
try {
RNIAP.requestPurchase(productId)
} catch (err) {
console.warn(err.code, err.message)
}
}, [])
export const buyProduct = async (productId)=>{
console.log('aaa111', `Try to buy ${productId}`)
return await RNIap.requestPurchase(productId, false)
}
_buyItem = async sku => {
const { navigation } = this.props;
if (sku !== 'freePoints') {
await this.setState({ isProcessing: true });
try {
RNIap.requestPurchase(sku, false);
} catch (err) {
bugsnag.notify(err, report => {
report.metadata = {
sku,
};
});
}
} else {
navigation.navigate({
routeName: ROUTES.SCREENS.SPIN_GAME,
});
}
};