1.20
tested on iOS only
get list of subscriptions
RNIap.getSubscriptions error : [TypeError: undefined is not an object (evaluating 'RNIapIos.getItems')]
both
````
const itemSkus = Platform.select({
ios: [
'com.shares.sharesapp', // I also tried ['BASIC', 'CLASSIC', 'MAX', 'PLUS'] ..
],
android: [
'com.shares.sharesapp',
],
});
async componentDidMount() {
try {
await RNIap.prepare();
}
catch (err1) {
console.log("RNIap.prepare error : ", err1);
}
finally {
console.log("finally");
try {
const products = await RNIap.getSubscriptions(itemSkus);
console.log('Subscriptions', products);
}
catch (err) {
console.log("RNIap.getSubscriptions error : ", err);
}
}
}
````
I not able to connect with sandbox account in simulator
and in real device, having these popup
Here is the list of subscriptions in App Store Connect
Can someone please help me to setup this in good shape ?
I also tryed with
const purchases = await RNIap.getAvailablePurchases();
console.info('Available purchases :: ', purchases);
result same :
RNIap.getSubscriptions error : [TypeError: undefined is not an object (evaluating 'RNIapIos.getAvailableItems')]
And to change ProductID as "com.shares.sharesapp.basic" in App Store Connect and
const itemSkus = Platform.select({
ios: [
'com.shares.sharesapp.basic'
],
No more success ...
I had to manually install as described...
````
Manual installation
iOS
In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-iap and add RNIap.xcodeproj
In XCode, in the project navigator, select your project. Add libRNIap.a to your project's Build Phases ➜ Link Binary With Libraries
Run your project (Cmd+R)
````
This time after it asked me to connect (disconnect on your real device first), I entered the Sandbox user, I was able to grab the subscription detail 👍
async componentDidMount() {
try {
await RNIap.prepare();
}
catch (err1) {
console.log("RNIap.prepare error : ", err1);
}
finally {
console.log("finally");
try {
console.log("itemSkus : ", itemSkus);
const products = await RNIap.getSubscriptions(itemSkus);
console.log('Subscriptions', products);
}
catch (err) {
console.log("RNIap.getSubscriptions error : ", err);
}
}
}
Results :
itemSkus : Array [
"com.shares.sharesapp.basic",
]
Subscriptions Array [
Object {
"currency": "EUR",
"description": "***",
"localizedPrice": "3,99 €",
"price": "3.99",
"productId": "com.shares.sharesapp.basic",
"title": "Abonnement BASIQUE",
"type": "Do not use this. It returned sub only before",
},
]
FYI, RNIap.getSubscriptions(itemSkus) works also in simulator.
Most helpful comment
I had to manually install as described...
````
Manual installation
iOS
````