Skip to main content
Question

originalPurchaseDate nil in production environment.


Forum|alt.badge.img+6

I’m using the following code to set originalPurchaseDate:
 

Purchases.shared.getCustomerInfo { info, error in

            if let error = error {

                print(error)

                return

            }

            if let date = info?.originalPurchaseDate {

                UserDefaults.standard.originalPurchaseDate = date

            }

        }
However I noticed `info?.originalPurchaseDate` is nil (either the info or originalPurchaseDate) in production. (I extracted UserDefaults on my JB device, the app is installed from the AppStore and I can see the StoreKit/receipt is present as expected)
In the debug build the info (CustomerInfo) is not nil, but as expected the `originalPurchaseDate` is not available.

What could be the problem?
I want to use this code in my second app which I’m moving from the paid-upfront to freemium, but it seems I might not be able to use it.
Thank you.

4 replies

sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • November 29, 2023

Hey @boramaapps,

That property requires you to send the receipt to RevenueCat. You can do this by calling syncPurchases or any of the purchase methods.

Alternatively you can use our receipt parsing library to read the receipt on the device.


Forum|alt.badge.img+6
  • Author
  • Member
  • 7 replies
  • November 29, 2023

Thank you.

Do you also provide a way to get the data from the device and from AppStore (if needed)?
 


Forum|alt.badge.img+6
  • Author
  • Member
  • 7 replies
  • November 29, 2023

It looks like the library you provide don’t have the originalPurchaseDate value. 


sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • December 6, 2023

Hi @boramaapps sorry about that, you’re correct. I’ll pass this feedback to the team. In this case the only way to get the original purchase date is by sending the receipt to RevenueCat using syncPurchases, restorePurchases, purchasePackage, or purchaseProduct. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings