iOS Question In App Purchases Promo Codes

walterf25

Expert
Licensed User
Longtime User
Hello everyone, Does anyone know how to validate or check when promo code has been used for a specific app, I have an app with Monthly and Yearly Subscriptions and i have generated a few promo codes for some people to try out the app and advertise it for me, the problem i'm having is that there's no way or at least that I can find to validate or check when a promo code has been redeemed for the app, in my app i have code that let's the user continue using the app and show content depending on which subscription they pay for.

But in the case of a promo code, when the users redeem the code, how can I check from within the app when a code has been redeemed?

Has anyone dealt with this type of situation before?

Thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
There should be a 'promotional_offer_id' field for such transactions. See the "verify the receipt" section: https://developer.apple.com/documen...ion_offers_in_your_app?language=objc#overview
I don't see that field in the receipt information.
I took a look at the link you provided, and I see that we need to request the offer's information, but I don't see that option in the library, based on the documentation this is how we're supposed to request that information
Objective-C:
@property(nonatomic, readonly) NSArray<SKProductDiscount *> *discounts;
Any idea if this can be done using inline Objective C ?

Thanks,
Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Start with:
B4X:
Dim no As NativeObject = Product1
Dim Discounts As List = no.GetField("discounts")
Log(Discounts)
What is the output?
This is the output in the Logs
B4X:
discounts: <B4IList: (
    "<SKProductDiscount: 0x283420b40>"
)>

Thanks,
Walter
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can access the internal fields with:
B4X:
For Each Discount As NativeObject In Discounts
 Dim identifier As String = Discount.GetField("identifier").AsString
 Dim price As Double = Discount.GetField("price")AsNumber

Next
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…