-
Notifications
You must be signed in to change notification settings - Fork 797
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
Verify subscription for multiple/all products? #194
Comments
Would you like something like this instead? class func verifySubscriptions(
type: SubscriptionType,
productIds: Set<String>,
inReceipt receipt: ReceiptInfo,
validUntil date: Date = Date()
) -> VerifySubscriptionResult or this? class func verifyAllSubscriptions(
type: SubscriptionType,
inReceipt receipt: ReceiptInfo,
validUntil date: Date = Date()
) -> VerifySubscriptionResult At the moment this is not possible, but this work will be considered alongside #192, #190 which also require some change to the subscription verification code. For the time being, you could call let productIds = [] // all your product ids
let verifySubscriptionResults = productIds.map { SwiftyStoreKit.verifySubscription(..., productId: $0, ...) } Alternatively, you could parse the receipt manually. |
Yes. I need this one:
My current solution (I use autorenewable subscriptions only):
In short in my case The only problem I have (if it is a problem) is the following:
I don't call |
@gerchicov-bp you say this:
Why is this the case? As the developer you should have control to all registered IAPs in iTunes Connect right? Regarding this:
I believe that when the app is deleted and installed and the user is logged in with Apple ID, the receipt from the previous app installation is reloaded. Also, please take a look at release 0.9.0, as I have improved I'm not sure how to best implement a This seems a bit convoluted. If you have access to the subscription product ids this is much more easily done by reusing the existing |
@bizz84 It seems you should imlement If you haven't a possibility to add |
Ok, I'll have a think and see what I can do. |
I come to this issue too now , I have two subscriptions: I think the best way is to filter the receipt subscriptions by expirydate and get the newest one and compare it to the current date |
@sam961 |
@gerchicov-bp @sam961 in your specific case, would it make sense to have the monthly and yearly subscriptions in the same subscription group? From Apple Docs:
|
@sam961 @gerchicov-bp Apologies, haven't had more time to look into this. The quickest and most flexible solution for now is to parse the receipt manually. Since version 0.9.0, you can create a strong-typed Then, you can compare all your items with the receipt date and check if there is at least one non-expired one. |
I've included some sample code from how I ended up implementing this. I'm not 100% sure if this is correct, but it seems to work for my mixture of non-consumables and autorenewing subscriptions.
|
I'd also like to see an implementation of this in the library. Currently, I'm using this change: felix-dumit@3c75f8f It's useful to handle subscriptions in the same family since they're mutually exclusive and it's nice to handle them all together as subscribed or not. I guess it's related to #269 too. |
@felix-dumit I implemented a new See #333. Available on pod version 0.12.0. @gerchicov-bp this new method solves this:
It does not solve this:
Is there a valid use case for this or can we close this issue? |
@bizz84 Thanks for implementing it, looks good! |
Platform
In app purchase type
Environment
Version
0.8.6
Related issues
Report
Issue summary
From your readme you call:
What to do if we don't know this
productId
and have multiple subscriptions which may vary?What did you expect to happen
Get any valid subscription from the request result without of binding to concrete Id?
What happened instead
The app don't have to know
productId
but the result contains info about this subscription. Why must I knowproductId
to check if just ANY subscription from list is valid?The text was updated successfully, but these errors were encountered: