View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vidéos

Ouvrir le menu Fermer le menu
  • Collections
  • Toutes les vidéos
  • À propos

Plus de vidéos

  • À propos
  • Code
  • Implement App Store Offers

    Learn how to engage customers with App Store Offers using App Store Connect, as well as the latest StoreKit features and APIs. Discover how you can set up win-back offers (a new way to re-engage previous subscribers) and generate offer codes for Mac apps. And find out how to test offers in sandbox and Xcode to make sure they work smoothly.

    Chapitres

    • 0:00 - Introduction
    • 1:32 - Updates to offers
    • 4:37 - Introducing win-back offers
    • 7:10 - Configure win-back offers
    • 16:50 - Support win-back offers
    • 28:44 - Streamlined purchasing

    Ressources

    • Testing win-back offers in the sandbox environment
    • Merchandising win-back offers in your app
    • Supporting win-back offers in your app
    • Testing win-back offers in Xcode
    • PurchaseIntent
    • Supporting offer codes in your app
    • offer
    • Forum: App Store Distribution & Marketing
    • Message
    • StoreKit views
    • Setting up StoreKit Testing in Xcode
    • Submit feedback
    • Generating a signature for promotional offers
      • Vidéo HD
      • Vidéo SD

    Vidéos connexes

    WWDC24

    • Explore App Store server APIs for In-App Purchase
    • What’s new in App Store Connect
    • What’s new in StoreKit and In-App Purchase

    WWDC23

    • Meet StoreKit for SwiftUI
    • What’s new in StoreKit 2 and StoreKit Testing in Xcode
  • Rechercher dans cette vidéo…
    • 4:25 - Present offer code redemption sheet on macOS - SwiftUI API

      // Present offer code redemption sheet on macOS - SwiftUI API
      
      import SwiftUI
      import StoreKit
      
      struct MyView: View {
      
          @State var showOfferCodeRedemption: Bool = false
      
          var body: some View {
              Button("Redeem Code") {
                  showOfferCodeRedemption = true
              }
              .offerCodeRedemption(isPresented: $showOfferCodeRedemption) { result in
                  // Handle result
              }
          }
      }
    • 20:15 - Choose preferred offer in a SubscriptionStoreView

      // Choose preferred offer in a SubscriptionStoreView
      
      import SwiftUI
      import StoreKit
      
      struct MyView: View {
          let groupID: String
          
          var body: some View {
              SubscriptionStoreView(groupID: groupID)
                  .preferredSubscriptionOffer { product, subscription, eligibleOffers in
                      let freeTrialOffer = eligibleOffers
                          .filter { $0.paymentMode == .freeTrial }
                          .max { lhs, rhs in
                              lhs.period.value < rhs.period.value
                          }
                      return freeTrialOffer ?? eligibleOffers.first
                  }
          }
      }
    • 23:05 - Check subscription entitlement and offer eligibility

      // Check subscription entitlement and offer eligibility
      
      import StoreKit
      
      func shouldShowMerchandising(
          for groupID: String,
          productIDs: [Product.ID]
      ) async throws -> MerchandisingVisibility {
          // Get subscription status
          let statuses = try await Product.SubscriptionInfo.status(for: groupID)
          
          // Check if the customer is already entitled to the subscription
          let entitlement = SubscriptionEntitlement(for: statuses)
          if entitlement.autoRenewalEnabled {
              return .hidden
          }
          
          // Check for offers to show in merchandising UI
          let products = try await Product.products(for: productIDs)
          
          let isEligibleForIntroOffer = await Product.SubscriptionInfo.isEligibleForIntroOffer(for: groupID)
          if isEligibleForIntroOffer {
              let subscriptions = products.map {
                  ($0, $0.subscription?.introductoryOffer)
              }
              return .visible(subscriptions)
          }
          
          // Check for eligible win-back offers
          let purchasedStatus = statuses.first {
              $0.transaction.unsafePayloadValue.ownershipType == .purchased
          }
          let renewalInfo = try purchasedStatus?.renewalInfo.payloadValue
          let bestWinBackOfferID = renewalInfo?.eligibleWinBackOfferIDs.first
          
          // Return the product with the offer if there is one
          if let bestWinBackOfferID {
              let subscriptions: [(Product, Product.SubscriptionOffer?)] = products.map {
                  let winBackOffer = $0.subscription?.winBackOffers.first {
                      $0.id == bestWinBackOfferID
                  }
                  return ($0, winBackOffer)
              }
              return .visible(subscriptions)
          }
          
          // Only return the product if there is no offer
          return .visible(products.map { ($0, nil) })
      }
      
      struct SubscriptionEntitlement {
          let isEntitled: Bool
          let autoRenewalEnabled: Bool
          
          init(for statuses: [Product.SubscriptionInfo.Status]) {
              let entitledStatuses = statuses.filter {
                  $0.state == .subscribed || $0.state == .inBillingRetryPeriod || $0.state == .inGracePeriod
              }
              isEntitled = !entitledStatuses.isEmpty
              autoRenewalEnabled = entitledStatuses.contains {
                  $0.renewalInfo.unsafePayloadValue.willAutoRenew
              }
          }
      }
      
      enum MerchandisingVisibility {
          case hidden
          case visible([(Product, Product.SubscriptionOffer?)])
      }
    • 25:26 - Add a win-back offer to a purchase

      // Add a win-back offer to a purchase
      
      import StoreKit
      
      func purchase(
          _ product: Product,
          with offer: Product.SubscriptionOffer?
      ) async throws {
          // Prepare the purchase options
          var purchaseOptions: Set<Product.PurchaseOption> = []
          
          // Add win-back offer to the purchase
          if let offer, offer.type == .winBack {
              purchaseOptions.insert(.winBackOffer(offer))
          }
          
          // Make the purchase
          try await product.purchase(options: purchaseOptions)
      }

Developer Footer

  • Vidéos
  • WWDC24
  • Implement App Store Offers
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines