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.
When a user makes an in-app purchase, the AppStore creates a receipt. What is App Store Receipt? In-App Purchases provide you a convenient way to monetize in-app content and features within your app. To provide access to your content, you need to pass a receipt through the receipt validation ( verifyReceipt) endpoint.
In-App Purchases provide you a convenient way to monetize in-app content and features within your app. To provide access to your content, you need to pass a receipt through the receipt validation ( verifyReceipt) endpoint. Receipt is an encrypted file signed with an Apple certificate.
To find your receipts, tap then choose Receipts to see a list of your receipts. If you're on a Mac or PC, click Receipts. A receipt might not be available if you made the purchase recently. Get help with an item purchased from the iTunes Store, App Store, Mac App Store, or iBooks Store Thank you for using Apple Support Communities.
To retrieve the receipt data ( appStoreReceiptURL) from the app on the device, use the appStoreReceiptURL = Bundle.main.appStoreReceiptURL Is it necessary to validate receipts?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With