user1225584
user1225584

Reputation: 61

iOS in-app purchase receipt not returning an original_purchase_date for a redownload

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.

Upvotes: 6

Views: 2811

Answers (1)

Nikita Pestrov
Nikita Pestrov

Reputation: 5966

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.

Upvotes: 1

Related Questions