Search code examples
iosin-app-purchaseapp-storestorekit

StoreKit2 equivalent to SKPaymentQueue.presentCodeRedemptionSheet()


I'm using StoreKit2 in a new iOS app to handle in-app subscription purchases. I'd like to support redemption of Offer Codes in the app, but I'm not seeing how to do that with StoreKit2.

Is there a StoreKit2 equivalent to original StoreKit's SKPaymentQueue.presentCodeRedemptionSheet()?

I'm not seeing anything in the docs that appears to handle Offer Codes specifically. While there is this:

static func promotionalOffer(offerID: String, keyID: String, nonce: UUID, signature: Data, timestamp: Int) -> Product.PurchaseOption

my understanding is that Promotional offers are a separate thing to Offer codes.

Appreciate any pointers anyone has on how to allow in-app redemption of an Offer Code using StoreKit2. I'm assuming I should not include original StoreKit as well as StoreKit2 and call the older API, right?


Solution

  • UPDATED: there's a method now available in iOS 16 for this purpose (thanks to @Mamouneyya for spotting this):

    presentOfferCodeRedeemSheet(in:)

    ORIGINAL ANSWER:

    I asked this question during an Apple Developer event earlier this year (Optimize Subscriptions for Success: Acquisition on March 22 2022) and was told:

    • There is no StoreKit2 equivalent (at least there wasn't as of March 2022)
    • We should just use SKPaymentQueue.presentCodeRedemptionSheet() from the original StoreKit

    That answer seems to imply it's fine to link against both StoreKit and StoreKit2 in the same app. I haven't yet tried it myself.