About SKProduct.discounts (new in iOS 12.2)

Hey there,


I just noticed that the iOS 12.2 SDK added a property to SKProduct called "discounts", which is an array of SKProductDiscount.


According to the documentation :


"The discounts array contains all the offers that you set up in App Store Connect that can be made available to your user for this product."


So I got two questions :


1) Can we assume that the SKProductDiscount that are contained in this array will only be SKProductDiscounts for which the user is eligible ?

Specifically, I found Introductory pricing to be a pain to implement, since we have to perform in-app receipt validation and parse it to determine whether the user is eligible to this offer. Knowing for sure that the user is eligible (or not) at the time we retrieve the SKProduct information would solve everything.


2) For testing purposes, I just created a new in-app purchase subscriptions family, containing a single auto-renewable subscription. I set up an introductory price on this product.

When querying the App Store with the information about this product, I notice that the "discounts" array is empty, but the "introductoryPrice" property is set and contains the right introducy price I just set up. Does it mean that the user isn't eligible to the introductory price for this subscription ? How can it be, since I just created a new subscriptions family ?


Maybe I'm deeply mistaken ; I assumed that this "discounts" array would contain the Introductory Pricing discounts (since, after all, they ARE SKProductDiscounts) as well as the new offers Apple just rolled out for returning subscribers, but maybe "discounts" is only meant to contain the latter.


I would really appreciate some help on this matter. Thanks in advance and have a great day !

Replies

I just learned of the Discounts feature last week. My colleague has done quite a bit of testing but we still don't have all the ansswers. If you aren't aware of the new documentation, here's some URL's. I'll see what I answers I can get for you.


Release Notes

Implementing Subscription Offers in Your App (StoreKit)
Set up subscription offers for auto-renewable subscriptions (App Store Connect)

rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Hi, I'm try to implement this new feature of the storekit framework,

I followed the guide on: https://developer.apple.com/documentation/storekit/in-app_purchase/implementing_subscription_offers_in_your_app. I create the SKPaymentDiscount, after this I send the payment request in "sandbox" mode, but I receive during the purchase process an error: "Unable to Purchase". I can't understand what the problem may be, I hope someone can help me. I attach a screen => https://www.tuunes.org/screen.png

Howdy, we're also trying to implement this feature, but it's currently not working with a 'SKErrorUnknown/Cannot connect to iTunes Store' error. Regular purchases still work, so I suppose the issue is somewhere with the discounts. I tried doing everything like the documentation said, I think I encrypted the data correctly and everything, but the error is pretty vague. I'm just wondering if there's a way to validate if everything was done properly, or even if these discount purchases work in a sandbox setting?


Many thanks!

Regarding question 1

"Can we assume that the SKProductDiscount that are contained in this array will only be SKProductDiscounts for which the user is eligible ?"


I tested this in Sandbox and the answer is no, you will see discount the user is not eligible for (iOS 12.2)

Hello, I have encountered the same problem.How did you solve it?