Dharini
Dharini

Reputation: 847

Restore button is required when auto-renewable subscription used In App Purchase?

I used auto-renewable subscription in my app. All things working perfectly but if user delete app from iPhone and again install then how to know that user is already subscribed or not?

we have to store user data or server or not?

I refer some questions like it , they says Apple reject that app which use restore button with auto-renewable In-App-Purchase.

Upvotes: 6

Views: 8555

Answers (2)

Gustavo Vollbrecht
Gustavo Vollbrecht

Reputation: 3256

They reject apps that does NOT have the restore button. Every app that provides non_consumable or auto_renewable_subscription purchases MUST have it. They also provide everything you need in order to actually restore user purchases at SKPaymentQueue without having to store it somewhere else.

SKPaymentQueue.default().restoreCompletedTransactions()

Which will trigger the method:

func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])

from

SKPaymentTransactionObserver

I recommend this guide, everything there works very well: https://hackernoon.com/swift-how-to-add-in-app-purchases-in-your-ios-app-c1dc2fc82319

Also don't forget to add your Items ID before asking for purchases history.

Upvotes: 10

Saikrishna Kumbhoji
Saikrishna Kumbhoji

Reputation: 47

you should keep a restore button.

The receipt will tell you that subscribed or not and u can validate this with your server. For info

https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html

There you have to check latest_receipt_info key, that will be array of json then u read last object and check expires_date key.

https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW2

Upvotes: 2

Related Questions