Thanks for the confirmation.
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!
Is this forum being monitored?
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...
}
}];
}
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