Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution: Fetching latest Subscription Data & Expiration (locally on device) #40

Open
ULSashido opened this issue Apr 6, 2023 · 3 comments

Comments

@ULSashido
Copy link

ULSashido commented Apr 6, 2023

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.

@ottopic
Copy link

ottopic commented Jun 6, 2023

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?

@yozef
Copy link

yozef commented Jun 7, 2023

From What I remember, you click the purchase button again. And the subscription starts anew.

I'm guessing you're seeing something else

@ottopic
Copy link

ottopic commented Jun 7, 2023

What I imagined, but I do not receive any receipt with a valid expiration date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants