I have made a pwa and twa app and released it on play store successfully. On play console I have created a subscription, in order the users to pay for monthly(etc) subscription, but in my app I get item is not defined error when I try to "fetch" it with the digitalgoods API.
This is my code
let [srv, setSrv] = useState([]);
let [supported, setSupported] = useState(false);
let [digitalGoodsError, setDigitalGoodsError] = useState(false);
useEffect(function () {
async function getSubs() {
if (window.getDigitalGoodsService === undefined) {
// Digital Goods API is not supported in this context.
return;
}
try {
setSupported(true);
const digitalGoodsService = await window.getDigitalGoodsService(
"https://play.google.com/billing"
);
const details = await digitalGoodsService.getDetails(["weekly"]);
let data = [];
for (item of details) {
data.push(item.price);
}
setSrv(data);
} catch (error) {
// Our preferred service provider is not available.
// Use a normal web-based payment flow.
console.error("Failed to get service:", error.message);
setDigitalGoodsError("Failed to get service: " + error.message);
return;
}
}
getSubs();
}, []);
And those are the subscriptions, which are active

Why do I get the item is not defined error?
I have made a pwa and twa app and released it on play store successfully. On play console I have created a subscription, in order the users to pay for monthly(etc) subscription, but in my app I get item is not defined error when I try to "fetch" it with the digitalgoods API.
This is my code
And those are the subscriptions, which are active

Why do I get the item is not defined error?