However, if offer codes are used to provide a discount then why when I purchased without the code did I get a free 6 month subscription instead of paying the normal price.
Maybe that account had already redeemed an offer code before purchasing? Or there’s a 6mo trial configured on the product? Not sure exactly what happened in that instance but just because you’ve generated Offer Codes for a product does not mean that anyone who purchases the product automatically redeems an Offer Code.
I don’t see how the app can display the offer code redemption sheet when the app doesn’t know what subscriptions have an offer code. Do we have to rebuild the app every time the subscriptions turn or or off offer codes? Or go to a server to check?
The redemption sheet is a system UI with just a text field to enter the Offer Code I believe. Customers don’t need to select which product they want to redeem a code for. If you wanted to have some server-side config to decide whether or not you should display a “Redeem Offer Code” button in your UI that could be an option, but customers will only ever be able to redeem an offer if they have received a code somehow first.
If you plan on giving out lots of codes, probably easiest to just always display an option for them to enter it via the redemption sheet. Alternatively, you could choose to only send codes via the URL and and not worry about anything in your UI.
It sounds like you may be wanting to build a flow where customers first select an item, then they have an option of entering a discount code (like shopping online). The Offer Codes from Apple work a little different where you need to enter the code first, and then you’re presented with the particular product discount it’s good for. The linking of code → product is done in App Store Connect.