Testing subscription downgrade in sandbox produces SSServerErrorDomain error

Originator:thongchaikol
Number:rdar://33124158 Date Originated:4 July 2017
Status: Resolved:
Product:iOS + SDK, StoreKit Product Version:iOS 10.3.2
Classification:Serious Bug Reproducible:Always
 
I got this when downgrading a subscription.
Looks like the error is coming directly from the transactions in func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {

Printing the error of the first updated transaction (po transactions[0].error!) gives me "Error Domain=SSServerErrorDomain Code=0 "You are all set" UserInfo={NSLocalizedDescription=You are all set}", and transaction state is `.failed`. Note the error domain is SSServerErrorDomain
NOT SKErrorDomain.

Some more insights:
- the higher level subscription state is not approved yet (state is missing metadata with yellow icon) (I can test purchasing in sandbox.)
- the lower level plan is approved
- If user tries to purchase the same downgraded plan again, he will get “You are already subscribed.”.
I don't think we can do anything here because it comes from StoreKit. May be it's an Apple sandbox bug.

Steps to Reproduce:
- Set up 2 subscriptions with different levels (will call plan A and B) in a subscription group in iTunes Connect
- Go to the app, purchase the plan with higher level (A), observe successful purchase
- Then immediately purchase lower level plan (B)

Expected Results:
paymentQueue:updatedTransactions: provides a transaction that is purchased successfully.

Observed Results:
paymentQueue:updatedTransactions: provides a transaction with error "Error Domain=SSServerErrorDomain Code=0 "You are all set" UserInfo={NSLocalizedDescription=You are all set}" and state `.failed`. If I try to buy the same plan (B) again, app store says "You are already subscribed to this".  But then later (after about 1 hour after refreshing the receipt), we observe the downgraded subscription got added to the receipt. Which is confusing because it seems to be successful but it transaction state is failed.

Version:
iOS 10.3.2 (14F89), iPhone 7 plus

Notes:
- Could this be a sandbox only issue?
- Apple should provide more documentation regarding the behaviour of downgrade scenario (e.g. telling that subscription will be added to the receipt at the NEXT renewal date, what transaction error/state we should handle)

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!