6

I am trying to use the iOS store receipt to tell the difference between a purchase and a redownload, based on the original_purchase_date and/or original_transaction_id . Regardless of whether a transaction is a new purchase or a redownload, the store receipt always returns a new original_purchase_date which is equal to the purchase_date value.

Here is a real store receipt I got back (which is a redownload of an existing in app purchase - as I am currently having to rely on UDID tracking to tell them apart)

{
  "product_id": "com.myproduct.id",
  "original_purchase_date_ms": "1329825956382",
  "purchase_date_ms": "1329825956382",
  "original_purchase_date": "2012-02-21 12:05:56 Etc/GMT",
  "purchase_date":          "2012-02-21 12:05:56 Etc/GMT",
  "bvrs": "1.0",
  "original_purchase_date_pst": "2012-02-21 04:05:56 America/Los_Angeles",
  "purchase_date_pst":          "2012-02-21 04:05:56 America/Los_Angeles",
  "original_transaction_id": "1000000028387131",
  "transaction_id":          "1000000028387131",
  "item_id": "452671574",
  "quantity": "1",
  "bid": "com.mybundle.id"
}

Regardless of whether I'm using the sandbox URL and testing with a test itunes connect account, or whether its a live purchase using the live URL for receipt verification, these values are always identical:

original_purchase_date_ms  ==  purchase_date_ms
original_purchase_date == purchase_date
original_purchase_date_pst == purchase_date_pst
original_transaction_id == transaction_id

Am I wrong in thinking that these are what you should use to tell the difference between a new purchase and a redownload of the same purchase? Obviously tracking the UDID of the device / making a app GUID and tracking that, is one way to do it but its not accurate enough (e.g. users who have multiple devices)

Does anyone else have this problem where these values are ALWAYS identical?

Any help on this is much appreciated! I've exhausted all other routes and hoping someone on here knows the answer.

user1225584
  • 61
  • 1
  • 2

1 Answers1

1

It depends on what you mean by "redownload".

The original_purchase_date should differ from purchase_date only when you are restoring your purchase, so the SKPaymentTransaction returns you SKPaymentTransactionStateRestored. If it's the case, there's something wrong.

Otherwise, for example, if you are repurchasing a consumable purchase, theese dates will be the same all the time, and everything's ok.

Nikita Pestrov
  • 5,876
  • 4
  • 31
  • 66
  • Hi, thanks for the reply. Yeah I meant a restore of an original purchase - so when someone deletes the app off their phone and the in app downloads are deleted also - when they re-install the app and restore the in app purchases - im guessing the original purchase date should differ from the purchase date - however in all cases these are the same for me – user1225584 Apr 18 '12 at 08:51
  • 1
    If you have an auto-renewable subscription, the original_purchase_date should be the date of the purchase of the first period. – Joris Weimar Sep 09 '12 at 15:57