ti.storekit
ti.storekit copied to clipboard
Solution: Fetching latest Subscription Data & Expiration (locally on device)
const latestReceipt = _.max(Storekit.receiptProperties.purchases, function(purchase) {
return purchase.transactionIdentifier;
});
Ti.API.info("Storekit Latest ReceiptProperties: " + JSON.stringify(latestReceipt));
const isOngoing = moment().isBefore(moment(latestReceipt.subscriptionExpirationDate));
Ti.API.info("Subscription: " + latestReceipt.productIdentifier + " is Ongoing?:" + isOngoing);
Ti.App.Properties.setBool('Purchased-' + latestReceipt.productIdentifier, isOngoing);
You may want to modify some of your code (especially if it's Subscriptions only (without 1 time IAP) but ongoing subscriptions; Notably the markProductAsPurchased
in the example.
How do you activate the subscription again after it has expired? After checking all the expired receipts if I call purchaseProduct I end up in the transactionState listener case TRANSACTION_STATE_PURCHASED with all the expired receipts. I cannot reprocess the payment to restart the new subscription.
For example I purchase monthly subscription and after two months I cancel. Once the period is over how do I restart a new subscription?
From What I remember, you click the purchase button again. And the subscription starts anew.
I'm guessing you're seeing something else
What I imagined, but I do not receive any receipt with a valid expiration date.