benjaminmayo / merchantkit

A modern In-App Purchases management framework for iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for didRevokeEntitlementsForProductIdentifiers

ryanmeisters opened this issue ยท comments

Thanks for an awesome library @benjaminmayo ๐Ÿ™Œ

iOS 14 adds a new didRevokeEntitlementsForProductIdentifiers delegate method to SKPaymentTransactionObserver (docs here)

From the docs:

The system calls this delegate method whenever App Store revokes in-app purchases for the user. For example, itโ€™s called when a user leaves a family sharing group that was sharing in-app purchases. By leaving the family group, the user is no longer entitled to the shared in-app purchases.

The productIdentifiers parameter contains the revoked product IDs. Your app should check the receipt on the device, which the system automatically updates prior to calling this method, and provide the correct level of access for the in-app purchases โ€” which may now be no access. If you use server-side receipt validation with the App Store, call your server to reprocess the receipt and update your purchase records.

Thanks for bringing this to my attention. I haven't looked at the iOS 14 StoreKit stuff yet. The good news is this API should be easily supportable inside of MerchantKit in a future update.

@benjaminmayo could I create a PR to add this capability?

Looks like this one is related to #70

Sure, I'm happy to look at anything put forward. The implementation of this should prolly consist of a call to checkReceipt from the didRevoke... delegate callback.

I created a draft PR: #71

Could you help to check whether it is on the right direction?

Update: I'm very new to IAP. Just found that this library (https://github.com/tikhop/TPInAppReceipt) can parse the receipt. Will investigate it.