<!--
{
  "availability" : [
    "iOS: 16.0.0 - 27.0.0",
    "iPadOS: 16.0.0 - 27.0.0",
    "macCatalyst: 16.0.0 - 27.0.0",
    "macOS: 15.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/offerCodeRedemption(isPresented:onCompletion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP010_StoreKit_aB0E19offerCodeRedemption11isPresented12onCompletionQrAA7BindingVySbG_ys6ResultOyyts5Error_pGScMYcctF"
  },
  "title" : "offerCodeRedemption(isPresented:onCompletion:)"
}
-->

# offerCodeRedemption(isPresented:onCompletion:)

```
nonisolated func offerCodeRedemption(isPresented: Binding<Bool>, onCompletion: @escaping @MainActor (Result<Void, any Error>) -> Void = { _ in }) -> some View
```

## Parameters

`isPresented`

A binding to a Boolean value that determines whether the system displays the sheet. You set the Boolean value to true to cause the system to display the sheet. The system sets it to false when it dismisses the sheet.

`onCompletion`

A closure that returns the result of the presentation. In Mac apps built with Mac Catalyst, the completion handler returns a failure with an error prior to macOS 15.

## Discussion

Presents a sheet that enables customers to redeem offer codes that you configure in App Store Connect.

The `offerCodeRedemption(isPresented:onCompletion:)` method displays a system sheet where customers can enter and redeem offer codes. If you generate offer codes in App Store Connect, call this function to enable customers to redeem the offer. To display the sheet using UIKit, see `presentOfferCodeRedeemSheet(in:)`.

> Important: Set up offer codes in App Store Connect before calling this API. Customers can only redeem these offers in your app through the redemption sheet; don’t use a custom UI. For more information, see <doc://com.apple.documentation/documentation/StoreKit/supporting-offer-codes-in-your-app>.

The following code example shows a view that displays the offer code redemption sheet upon a button press:

```
import SwiftUI
import StoreKit
    
    
struct ContentView: View {
    @State private var redeemSheetIsPresented = false
    
    
    var body: some View {
        Button("Present offer code redemption sheet.") {
            redeemSheetIsPresented = true
        }
        .offerCodeRedemption(isPresented: $redeemSheetIsPresented) { result in
            // Handle result
        }
    }
}
```

When customers redeem an offer code, StoreKit emits the resulting transaction in <doc://com.apple.documentation/documentation/StoreKit/Transaction/updates>. Set up a transaction listener as soon as your app launches to receive new transactions while the app is running.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)