---
title: "offerCodeRedemption(options:isPresented:onCompletion:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/offercoderedemption(options:ispresented:oncompletion:)"
---

# offerCodeRedemption(options:isPresented:onCompletion:)

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

## Declaration

```swift
nonisolated func offerCodeRedemption(options: Set<RedeemOption>, isPresented: Binding<Bool>, onCompletion: @escaping @MainActor (Result<VerificationResult<Transaction>, any Error>) -> Void) -> some View

```

## Parameters

- `options`: A set of AppStore/RedeemOption values that configure the code redemption.
- `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 the system calls with the result of the redemption. On success, the closure receives a VerificationResult containing the doc://com.apple.SwiftUI/documentation/SwiftUI/Transaction that the redemption produces. On failure, it receives the error that caused the redemption to fail.

## Discussion

Discussion The offerCodeRedemption(options: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 method to enable customers to redeem the offer. To display the sheet using UIKit, see presentOfferCodeRedeemSheet(from:options:). 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 Supporting subscription offer codes in your app. The following code example shows a view that displays the offer code redemption sheet when the customer taps a button: 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(             options: [],             isPresented: $redeemSheetIsPresented         ) { result in             // Handle result         }     } } When the customer successfully redeems an offer code, the system delivers the resulting transaction through onCompletion, as a VerificationResult that wraps the Transaction.

## See Also

### Interacting with the App Store and Apple Music

- [appStoreOverlay(isPresented:configuration:)](swiftui/view/appstoreoverlay(ispresented:configuration:).md)
- [manageSubscriptionsSheet(isPresented:)](swiftui/view/managesubscriptionssheet(ispresented:).md)
- [refundRequestSheet(for:isPresented:onDismiss:)](swiftui/view/refundrequestsheet(for:ispresented:ondismiss:).md)
- [musicPicker(isPresented:title:selection:)](swiftui/view/musicpicker(ispresented:title:selection:).md)
- [musicSubscriptionOffer(isPresented:options:onLoadCompletion:)](swiftui/view/musicsubscriptionoffer(ispresented:options:onloadcompletion:).md)
- [currentEntitlementTask(for:priority:action:)](swiftui/view/currententitlementtask(for:priority:action:).md)
- [inAppPurchaseOptions(_:)](swiftui/view/inapppurchaseoptions(_:).md)
- [manageSubscriptionsSheet(isPresented:subscriptionGroupID:)](swiftui/view/managesubscriptionssheet(ispresented:subscriptiongroupid:).md)
- [onInAppPurchaseCompletion(perform:)](swiftui/view/oninapppurchasecompletion(perform:).md)
- [onInAppPurchaseStart(perform:)](swiftui/view/oninapppurchasestart(perform:).md)
- [productIconBorder()](swiftui/view/producticonborder().md)
- [productViewStyle(_:)](swiftui/view/productviewstyle(_:).md)
- [productDescription(_:)](swiftui/view/productdescription(_:).md)
- [storeButton(_:for:)](swiftui/view/storebutton(_:for:).md)
- [storeProductTask(for:priority:action:)](swiftui/view/storeproducttask(for:priority:action:).md)
