I simply wants to fetch subscriptions i created in App Store Connect and Google Play Console.
I use react-native-iap v14.4. The code below works correctly on Android and return what it should :
[{"currency": "EUR", "debugDescription": null, "description": "", "displayName": "default", "displayPrice": "€8.49", "id": "default", "nameAndroid": "default", "oneTimePurchaseOfferDetailsAndroid": null, "platform": "android", "price": 8.49, "subscriptionOfferDetailsAndroid": [[Object], [Object]], "title": "default (StreakGG)", "type": "subs"}]
but in IOS i get : []
What i already checked :
- That the state of my subscriptions are "Ready to submit" (and apparently it should be enough)
- Everything in the Business section is accepted and active
- My subs are referenced in the "Distribution section" of the app.
- They have been created like 10 hours ago so it should be deployed now right ?
- I made the subs available in my country (in all countries basically)
I really don't get why it is not working.
Here is the very simple code.
import { StyleSheet, Text, View, } from 'react-native';
import { useContext, useEffect, useState } from 'react';
import { colors } from '../utils/theme';
import { useIAP, ErrorCode } from 'react-native-iap';
import { useNavigation } from '@react-navigation/core';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function SubscriptionScreen() {
const navigation = useNavigation()
const productIds = ['default']
const { connected, subscriptions, fetchProducts, requestPurchase } =
useIAP({
onPurchaseSuccess: (purchase) => {
console.log('Purchase successful:', purchase);
// Handle successful purchase
// validatePurchase(purchase);
},
onPurchaseError: (error) => {
console.error('Purchase failed:', error);
// Handle purchase error
},
});
useEffect(() => {
if (connected) {
fetchProducts({ skus: productIds, type: 'subs' });
}
}, [connected]);
return (<SafeAreaView>
{console.log(subscriptions)}
<View>
<Text>{JSON.stringify(subscriptions)}</Text>
<Text >Votre repas</Text>
</View>
</SafeAreaView>)
}```