The documentation from react-native-iap say to use deepLinkToSubscriptions() to cancel/unsubscribe. The function redirect to store and I can cancel, however, I can’t get the return. I not see how make my code listen if unsubscribe was made or not.
I implementated purchaseUpdatedListener, but it runs only when a make a purchase, to unsubscribe not.
Cancel Screen:
useEffect(() => {
const subscription = purchaseUpdatedListener(async (purchase) => {
const receipt = purchase.transactionReceipt
console.log('receipt',receipt)
});
return () => {
subscription.remove()
};
}, []);
const unsubscribe = async () => {
setIsCanceling(true)
const connection = await initConnection()
if (connection){
if(Platform.OS === 'ios'){
Linking.openURL('https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions')
}else{
const result = await deepLinkToSubscriptionsAndroid({sku})
}
}
setIsCanceling(false)
}