Question

Use of originalApplicationVersion for grandfathering existing users

  • 6 May 2023
  • 5 replies
  • 58 views

Badge +4

 

Question on the use of originalApplicationVersion to determine if I should grandfather certain users into a free subscription.

The docs say:

The first date this entitlement was purchased. May be the same as the latest purchase date.

Now, what if the app was previously purchased on the Apple App Store (iOS), not using RevenueCat and entitlements? I’ve only added RevenueCat in the most recent version, which has not yet gone live on the App Store. Will originalApplicationVersion still be populated with the correct build number when the user first purchased the app even if it was originally purchased without RevenueCat? (Also, that build number is in fact the build number, and not the version number, as in version 3.0 build 1234, correct?)

 


5 replies

Badge +4

 

Digging deeper, it looks like I will need to migrate previous purchases to RevenueCat first, since RevenueCat will not see older purchases that did not use RevenueCat.

Existing users are those who purchased a previous version of the app (one-time purchase, no IAP or subscriptions).

So if I perform a client-side migration, how do I determine if the user who has just downloaded the newest version of the app (with RevenueCat support) had previously purchased the app using the standard App Store install (one-time purchase) without RevenueCat?

More information is given here, but there aren’t enough details on checking for purchase receipts for previous versions of the app.

https://www.revenuecat.com/docs/migrating-existing-subscriptions

 

Badge +4

Continuing to work this, if I have understood the docs correctly, checking the originalApplicationVersion for nil will determine if I need to migrate purchases from the old system (simple one-time app purchase on iOS App Store from a previous app version) to RevenueCat.

If originalApplicationVersion is nil, then call syncPurchasesWithCompletion: and do something with the resulting sycnedCustomerInfo.

If originalApplicationVersion is NOT nil, then the purchase already exists in the RevenueCat system, and we can just use the resulting customerInfo.

Here’s the code. Does this look right or am I missing something?

- (void)migratePurchasesToRevenueCatIfNecessary
{
[[RCPurchases sharedPurchases] getCustomerInfoWithCompletion:^(RCCustomerInfo * customerInfo, ...) {

if (customerInfo.originalApplicationVersion == nil)
{
[[RCPurchases sharedPurchases] syncPurchasesWithCompletion:^(RCCustomerInfo * syncedCustomerInfo, ...) {
// do something with syncedCustomerInfo...
}];
}
else
{
// do something with customerInfo...
}
}];
}

 

Badge +4

Is this forum being monitored?

Userlevel 6
Badge +8

Hey @Dalmazio!

You’re definitely on the right track here - I try to touch on these topics in our blog post here: https://www.revenuecat.com/blog/engineering/converting-a-paid-ios-app-to-subscriptions/

 

The originalApplicationVersion will be populated in CustomerInfo once you sync the iOS receipt to RevenueCat, and will include metadata about the purchase even before implementing RevenueCat. Additionally, the “originalApplicationVersion” does refer to the build number. 
 

Your code snippet looks great - every production iOS user will have a receipt with metadata, so it’s safe to check that property and then sync purchases if it doesn’t exist. Let me know if you have any questions!

Badge +4

Thanks for the confirmation.

Reply