StoreKit should provide Product Type information

Originator:blesserx
Number:rdar://45361413 Date Originated:18-Oct-2018 12:05 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:iOS 12
Classification:Feature (New) Reproducible:Always
 
Summary:
[In-App Purchase Programming Guide](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html) describes several product types but there is no obvious way in StoreKit for developers to identify the type other them writing business logic on their own.

For example, when app received a call in SKPaymentTransactionObserver function `func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])`, the app can only get productIdentifier to decide what to do next. For auto-renewable subscription products, app often can need just call finish transaction since backend server already dealt with the recurring events. 

That decision logic needs to be written somewhere in the app or developer's backend server matching productIdentifier -> product type. We believe this information should be provided by StoreKit.

Steps to Reproduce:
1. Implement In-App Purchase
2. Receive SKPaymentTransaction upon transaction status updated (especially upon app launch)

Expected Results:
See the product type (consumable, non-consumable, manual subscription, auto-renewal subscription) of this transaction

Actual Results:
Developer only get transaction.payment.productIdentifier and need to check the id mapped to which product type. The mapping is written in the app(which is kind of hard code) or backend server(which takes more time and is bad for user experience).

Version:
iOS 12

Notes:
I know there is .subscriptionPeriod in SKProduct since iOS 11.2 but it's not enough. The better way is to create and provide a new SKProductType and can be accessed in SKPayment and SKProduct.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!