Affiliate/offer mechanism with non-consumable in-app purchases

I have a MacOS application that has a non-consumable in-app purchase that unlocks an enhanced version of the app (in other words, it's a one-time upgrade purchased inside of the app). The transaction is handled using StoreKit 2 and the app is distributed on the MacOS App Store.

I would like to add an affiliate-like program where certain people can promote my application and receive a percentage of the earnings from users that buy the in-app purchase as a result of their promotion. In order to correctly distribute earnings, I need some way to track that a purchase from a user is linked to a certain affiliate.

Research led me to offer codes but I quickly realised that these are only valid for subscriptions (which my purchase is not), and, besides, it seems they are not supported on MacOS. Another constraint that I have is that my application should not make any external network requests (apart from those to Apple servers, like StoreKit), so I cannot use something like Firebase for a custom offer implementation.

I'm not sure what the best way to achieve this is. One way I thought of is to create one non-consumable in-app purchase/product for each affiliate and use a deep link to associate a user with that product. Then, I'll know which affiliate each user comes from based on the product that was used during the purchase. The only problem with this is that products need to be aded at compile-time so each new affiliate I add would require me to publish a new app version.

I'm wondering whether there's a better way to do this?

Affiliate/offer mechanism with non-consumable in-app purchases
 
 
Q