iOS renewable subscription expires_date field - in-app-purchase

UPDATE:
I'm posting #vitro 's comment here:
Year 2021 - and it is there: https://developer.apple.com/documentation/appstorereceipts/expires_date_ms
This field is returned in the JSON response, in the responseBody.Latest_receipt_info and responseBody.Receipt.In_app arrays.
The time a subscription expires or when it will renew, in UNIX epoch time format, in milliseconds. Use this time format for processing dates.
thx #vitro
ORIGINAL POST:
While verifying a renewable subscription receipt I am attempting to get the expiration date of the latest receipt.
According to the apple documentation on receipt fields the "expires_date" field should contain a number which is the number of milliseconds since January 1, 1970, 00:00:00 GMT.(https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1)
When I fetch the field however i am receiving a string with a formatted date from the "expires_date" field. There is another field called "expires_date_ms" that seems to provide the correct data. Apple states "Keys not documented below are reserved for use by Apple and must be ignored by your app."
here is an example of my receipt:
{"quantity":"1",
"product_id":"com.testapp.test",
"transaction_id":"1000000135676121",
"original_transaction_id":"1000000135134855",
"purchase_date":"2014-12-15 06:53:54 Etc/GMT",
"purchase_date_ms":"1418626434059",
"purchase_date_pst":"2014-12-14 22:53:54 America/Los_Angeles",
"original_purchase_date":"2014-12-15 06:51:12 Etc/GMT",
"original_purchase_date_ms":"1418626272000",
"original_purchase_date_pst":"2014-12-14 22:51:12 America/Los_Angeles",
"expires_date":"2014-12-15 06:56:10 Etc/GMT",
"expires_date_ms":"1418626570000",
"expires_date_pst":"2014-12-14 22:56:10 America/Los_Angeles",
"web_order_line_item_id":"1000000028947356",
"is_trial_period":"false"
}]
Which field should i use to obtain the expired date with best practices?

As you found, the documentation for "expires_date" at this link...
https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1
...states Keys not documented below are reserved for use by Apple and must be ignored by your app. However it does now say that "expires_date" is an ASN.1 Field Value IA5STRING, interpreted as an RFC 3339 date.
It appears that as of today (2015-12-04), a year after your question, Apple has yet to clarify and make official the "expires_date_ms" field which clearly has the milliseconds representing the "expires_date".
As you will also find, a receipt contains a _ms version and _pst version of dates. The _pst is clearly for "PST" or America/Los_Angeles timezone.
receipt":{"receipt_type":"ProductionSandbox", "adam_id":0, "app_item_id":0, "bundle_id":"com.my.cool.app", "application_version":"1.0.3", "download_id":0, "version_external_identifier":0, "receipt_creation_date":"2015-12-04 03:48:00 Etc/GMT", "receipt_creation_date_ms":"1449200880000", "receipt_creation_date_pst":"2015-12-03 19:48:00 America/Los_Angeles", "request_date":"2015-12-04 03:53:45 Etc/GMT", "request_date_ms":"1449201225187", "request_date_pst":"2015-12-03 19:53:45 America/Los_Angeles", "original_purchase_date":"2013-08-01 07:00:00 Etc/GMT", "original_purchase_date_ms":"1375340400000", "original_purchase_date_pst":"2013-08-01 00:00:00 America/Los_Angeles", "original_application_version":"1.0",
"in_app":[
{"quantity":"1", "product_id":"com.my.cool.app.inapppurchase1", "transaction_id":"1000000000000589", "original_transaction_id":"1000000000000589", "purchase_date":"2015-12-03 08:09:32 Etc/GMT", "purchase_date_ms":"1449130172000", "purchase_date_pst":"2015-12-03 00:09:32 America/Los_Angeles", "original_purchase_date":"2015-12-03 08:09:34 Etc/GMT", "original_purchase_date_ms":"1449130174000", "original_purchase_date_pst":"2015-12-03 00:09:34 America/Los_Angeles", "expires_date":"2015-12-03 08:14:32 Etc/GMT", "expires_date_ms":"1449130472000", "expires_date_pst":"2015-12-03 00:14:32 America/Los_Angeles", "web_order_line_item_id":"1000000031087708", "is_trial_period":"false"},
"latest_receipt_info":[
{"quantity":"1", "product_id":"com.my.cool.app.inapppurchase1", "transaction_id":"1000000000000589", "original_transaction_id":"1000000000000589", "purchase_date":"2015-12-03 08:09:32 Etc/GMT", "purchase_date_ms":"1449130172000", "purchase_date_pst":"2015-12-03 00:09:32 America/Los_Angeles", "original_purchase_date":"2015-12-03 08:09:34 Etc/GMT", "original_purchase_date_ms":"1449130174000", "original_purchase_date_pst":"2015-12-03 00:09:34 America/Los_Angeles", "expires_date":"2015-12-03 08:14:32 Etc/GMT", "expires_date_ms":"1449130472000", "expires_date_pst":"2015-12-03 00:14:32 America/Los_Angeles", "web_order_line_item_id":"1000000031087708", "is_trial_period":"false"},
"latest_receipt":"MIItbAYJKoZIhvcNAQcCoIItXTCCLV...truncated...nA=="}
Nevertheless, until the ios releasenotes changes its wording or list of fields, it is, however ignominious, not recommended to use the _ms and _pst fields.

Related

Should I check cancellation_date_ms in addition to expires_date_ms for a auto-renewable subscriptions?

I am implementing an auto-renewable subscription in my app.
Currently, to check if the user have an active subscription, I examine all the records in latest_receipt_info array from the response JSON returned from the Apple's /verifyReceipt service, find the one with the max expires_date_ms and check if this date is in the future. Before checking the dates I also check if the status field is 0 (receipt is valid).
I was thinking that it is enough, but I recently found out that there is another field - cancellation_date_ms. As I understand from the docs, this filed is present if user has canceled his subscription through the Apple support.
From (Apple docs)
You can use this value to:
Determine whether to stop providing the content associated with the
purchase.
Check for any latest renewal transactions, which may indicate the user
re-started or upgraded their subscription, for an auto-renewable
subscription purchase.
So I am wondering, if a user cancels his subscription through the Apple support, will this affect the expires_date_ms for the current subscription period? So the next time I check expires_date_ms, I know the subscription is not active.
Or does expires_date_ms stays the same as it was before the user canceled the subscription, and so I need to check the cancellation_date_ms as well?
You should check for cancellation_date_ms as well. Expires_date field doesn't change when customer cancels subscription through Apple Support.
Here is production JSON example with refund:
"latest_receipt_info": [
{
"quantity": "1",
"product_id": "XXX",
"transaction_id": "150000567873035",
"original_transaction_id": "150000567873035",
"purchase_date": "2019-11-10 17:37:05 Etc/GMT",
"purchase_date_ms": "1573407425000",
"purchase_date_pst": "2019-11-10 09:37:05 America/Los_Angeles",
"original_purchase_date": "2019-11-10 17:37:06 Etc/GMT",
"original_purchase_date_ms": "1573407426000",
"original_purchase_date_pst": "2019-11-10 09:37:06 America/Los_Angeles",
"expires_date": "2019-12-10 17:37:05 Etc/GMT",
"expires_date_ms": "1575999425000",
"expires_date_pst": "2019-12-10 09:37:05 America/Los_Angeles",
"cancellation_date": "2019-12-05 19:14:48 Etc/GMT",
"cancellation_date_ms": "1575573288000",
"cancellation_date_pst": "2019-12-05 11:14:48 America/Los_Angeles",
"web_order_line_item_id": "150000194283402",
"is_trial_period": "false",
"is_in_intro_offer_period": "false",
"cancellation_reason": "0",
"subscription_group_identifier": "20502261"
}
],
"pending_renewal_info": [
{
"auto_renew_product_id": "XXX",
"original_transaction_id": "150000567873035",
"product_id": "XXX",
"auto_renew_status": "0"
}
]}

Need to understand iOS InApp purchase receipt

I'm digging into iOS in-app purchase validation (server side) and I got pretty much confused about the receipt fields returned by apple's validation server. The documentation available here is not really clear (at least for me)
So here is a real (obfuscated) in-app purchase receipt returned by Apple's validation server
{
"receipt": {
"receipt_type": "Production",
"adam_id": XXXXXXX,
"app_item_id": XXXXXXXXX,
"bundle_id": "com.XXXXX.XXXXX",
"application_version": "XXXXXXXXX",
"download_id": XXXXXXXXXXXX,
"version_external_identifier": XXXXXXXXXXX,
"receipt_creation_date": "2019-10-15 14:01:41 Etc/GMT",
"receipt_creation_date_ms": "1571148101000",
"receipt_creation_date_pst": "2019-10-15 07:01:41 America/Los_Angeles",
"request_date": "2019-10-15 14:04:20 Etc/GMT",
"request_date_ms": "1571148260390",
"request_date_pst": "2019-10-15 07:04:20 America/Los_Angeles",
"original_purchase_date": "2018-11-27 18:28:48 Etc/GMT",
"original_purchase_date_ms": "1543343328000",
"original_purchase_date_pst": "2018-11-27 10:28:48 America/Los_Angeles",
"original_application_version": "XXXXXXXXX",
"in_app": [
{
"quantity": "1",
"product_id": "com.XXXXXXXXXX.XXXXX.XXXXXX",
"transaction_id": "XXXXXXXXXXX",
"original_transaction_id": "XXXXXXXXXX",
"purchase_date": "2019-10-15 14:01:41 Etc/GMT",
"purchase_date_ms": "1571148101000",
"purchase_date_pst": "2019-10-15 07:01:41 America/Los_Angeles",
"original_purchase_date": "2019-10-15 14:01:41 Etc/GMT",
"original_purchase_date_ms": "1571148101000",
"original_purchase_date_pst": "2019-10-15 07:01:41 America/Los_Angeles",
"is_trial_period": "false"
}
]
},
"status": 0,
"environment": "Production"
}
So my questions are:
The fields starting with "original_purchase_date" represent a datetime but why they have a different value in the 2 parts of the receipt ?
In the in_app part of the receipt, can the values of the fields starting with "purchase_date" and the values of the fields starting with "original_purchase_date" be different ? And if yes, in which case ?
Is the "application_version" field contains the value of the current build version published of the app since the "original_application_version" field, according to the documentation, represent the build version of the app the user used to make the purchase ?
Thanks a lot for your help and answers.
R.E.B Hernandez!
original_purchase_date inside in_app is the time when in-app purchase has been made, the one outside this array is the date when the app was installed for the first time.
If you use non-consumable and non-renewing subscriptions, then purchase_date will be the same as original_purchase_date. However, if you use auto-renewable subscriptions, then you should check latest_receipt_info array instead of in_app. And in case of subscriptions, original_purchase_date will represent only the date of the first transaction.
Yes, application_version is the current version of the app on the device.
original_application_version is the version of the app that the user originally purchased.
Here is documentation link

Apple receipt_data sample

I need to implement a back-end for verifying Apple's in-app purchase receipt_data, for an in-app purchase of in-app points (i.e. not a subscription and not an item that needs to be "remembered" and re-verified in every application launch).
I am not proficient in iOS. I just need to develop the back-end so that it can be integrated with a client's mobile app.
I found tutorials and sample code for doing the verification, but I would very much like to have an actual receipt_data to test with.
The best thing would be to have two receipt_datas: one sandbox and one production.
I understand that there two variations of receipt_datas I need to support - one that contains a single purchase's data, and another that contains the full history of purchases. If that's the case, it would be great to have a sample for each...
I realize that this is not a question per se, but maybe sample receipts would be useful for other developers as well...
In-app purchase with name test2:
Sandbox receipt-data (generated on 13 Nov 2018, still working):
MIITuAYJKoZIhvcNAQcCoIITqTCCE6UCAQExCzAJBgUrDgMCGgUAMIIDWQYJKoZIhvcNAQcBoIIDSgSCA0YxggNCMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgEDAgEBBAMMATMwCwIBCwIBAQQDAgEAMAsCAQ4CAQEEAwIBWjALAgEPAgEBBAMCAQAwCwIBEAIBAQQDAgEAMAsCARk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FT18Dln5bndTvWQJZcsbI4xa7BAEhjg/nfwPhaL17tHZeW8mOcCtG9UcuAgXXC6usVAOSocenhmKUR8W+D6F/jhBn0k9ahApPDmpZh
Apple validiation response:
{
"receipt": {
"receipt_type": "ProductionSandbox",
"adam_id": 0,
"app_item_id": 0,
"bundle_id": "com.belive.app.ios",
"application_version": "3",
"download_id": 0,
"version_external_identifier": 0,
"receipt_creation_date": "2018-11-13 16:46:31 Etc/GMT",
"receipt_creation_date_ms": "1542127591000",
"receipt_creation_date_pst": "2018-11-13 08:46:31 America/Los_Angeles",
"request_date": "2018-11-13 17:10:31 Etc/GMT",
"request_date_ms": "1542129031280",
"request_date_pst": "2018-11-13 09:10:31 America/Los_Angeles",
"original_purchase_date": "2013-08-01 07:00:00 Etc/GMT",
"original_purchase_date_ms": "1375340400000",
"original_purchase_date_pst": "2013-08-01 00:00:00 America/Los_Angeles",
"original_application_version": "1.0",
"in_app": [{
"quantity": "1",
"product_id": "test2",
"transaction_id": "1000000472106082",
"original_transaction_id": "1000000472106082",
"purchase_date": "2018-11-13 16:46:31 Etc/GMT",
"purchase_date_ms": "1542127591000",
"purchase_date_pst": "2018-11-13 08:46:31 America/Los_Angeles",
"original_purchase_date": "2018-11-13 16:46:31 Etc/GMT",
"original_purchase_date_ms": "1542127591000",
"original_purchase_date_pst": "2018-11-13 08:46:31 America/Los_Angeles",
"is_trial_period": "false"
}]
},
"status": 0,
"environment": "Sandbox"
}
URL for validation:
https://sandbox.itunes.apple.com/verifyReceipt
Validation request JSON body:
{ "receipt-data": "_paste_your_receipt-data_here_" }
Validation Apple Documentation:
https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html
Validation in Postman:
Itunes Connect In-App Purchases page:
Sandbox receipt-data:
eyJzaWduYXR1cmUiID0gIkFoaHEwbmFxaG01ci8wSUNuYk9hVThCeVBLNkRja2ZsanRCMDNnZUh4dk0ybEVjVkdqK2NVM1lnWGZ0RkZCZ2lFYkR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z7gFz//uLk8NZkDN6fiFb+rAB00mI2CTX6lW3kGtUAAefg2tRFrJ0tpCdt5+03popovMb8KzDRqlJuKs6D6xzx+MSxKV6i7iPHHaxoq3eAFS2i9N6BwuH52vwSJ6+vUJsH+klw2sSCL/XAaLCpzQDS66V6CqbUo6peo/hqtHsOAjDmFgTNPXXVAPXMk+q3loe+oveSC4n362W7f+N6R9CB6lJ8rloluUN2JvNwiFzPY0eAtCToLpBfGdL2I3ymDFJWiQbCuuNRa/PfGBFpMc0PGSqyQ0C5GFULTDVU=
Both from sandbox (sorry can't give you any production ones). Enjoy.
Edit: It occurs to me that would won't be able to communicate to Apple's servers with these receipt without my shared secret (not something I am willing to disclose).
However you can decode them, if you're using ruby I wrote a gem called ItunesReceiptDecoder. I also have a gem called ItunesReceiptValidator that also provides the remote calls to Apple.

Auto-renewable subscriptions expiration date off Apple specification

I am trying to validate auto-renewable subscriptions on iOS. More specifically I want to:
1) Verify that the signature is correct [ √ ]
2) Verify that the subscription has not expired [ X ]
When I hand the receipt of to the server I get validation status 0, which is exactly what I expect, nothing wrong with that.
However, when I try to read the expiration date of the receipt in the sandbox environment, the expiration dates drift off of the specified expiration dates for subscriptions from the Apple documentation, meaning, instead of having the subscription expire after 5 minutes in the case of our 1 month subscription, we get expiration times of several hours!
{
"quantity": "1",
"product_id": "{PRODUCT_IDENTIFIER}",
"transaction_id": "1000000182307463",
"original_transaction_id": "1000000182307463",
"purchase_date": "2015-11-27 23:47:06 Etc/GMT",
"purchase_date_ms": "1448668026000",
"purchase_date_pst": "2015-11-27 15:47:06 America/Los_Angeles",
"original_purchase_date": "2015-11-27 23:47:07 Etc/GMT",
"original_purchase_date_ms": "1448668027000",
"original_purchase_date_pst": "2015-11-27 15:47:07 America/Los_Angeles",
"expires_date": "2015-11-28 02:35:06 Etc/GMT", // ---> expires_date - purchase_date => ~ 3 hrs
"expires_date_ms": "1448678106000",
"expires_date_pst": "2015-11-27 18:35:06 America/Los_Angeles",
"web_order_line_item_id": "1000000031037801",
"is_trial_period": "true"
}
If you look at the purchase_date and expiration_date fields you will quickly notice that they are almost 3hrs apart! (It is not even an even number, which also adds to the confusion...).
I haven't seen anybody else having this issue, which is why I am basically pulling my hair out over this.
The problem was that we didn't create sandbox accounts and used our iTunes Connect ones. After we created and used those it suddenly worked perfectly!

iOS always returning the same transaction id when validating IAP receipt

I'm testing In App Purchasing in iOS using 1 SandBox user. When I validate the receipt using Apple server, I get the following response:
{"status":0, "environment":"Sandbox", "receipt":
{"receipt_type":"ProductionSandbox", "adam_id":0, "app_item_id":0,
"bundle_id":"xxxxxxxxx", "application_version":"0",
"download_id":0, "version_external_identifier":0,
"request_date":"2015-05-19 22:04:45 Etc/GMT",
"request_date_ms":"1432073085427",
"request_date_pst":"2015-05-19 15:04:45 America/Los_Angeles",
"original_purchase_date":"2013-08-01 07:00:00 Etc/GMT",
"original_purchase_date_ms":"1375340400000",
"original_purchase_date_pst":"2013-08-01 00:00:00 America/Los_Angeles",
"original_application_version":"1.0", "in_app":[ {"quantity":"1",
"product_id":"xxxxxx", "transaction_id":"xxxxxxxxx",
"original_transaction_id":"xxxxxxxx", "purchase_date":"2015-05-19 18:32:54 Etc/GMT", "purchase_date_ms":"1432060374000",
"purchase_date_pst":"2015-05-19 11:32:54 America/Los_Angeles",
"original_purchase_date":"2015-05-19 18:32:54 Etc/GMT",
"original_purchase_date_ms":"1432060374000",
"original_purchase_date_pst":"2015-05-19 11:32:54 America/Los_Angeles", "is_trial_period":"false"}]}}
I tried to make multiple purchases of the same product with the same sandbox user and each time, I get the same response when I validate the receipt. The ONLY fields which are different are request_date_ms and request_date_pst.
Isn't the Transaction ID supposed to be unique each time??? Is this a bug?
Also the receipt seems to be exactly the same receipt each time. Not sure though as It's a VERY long string. So not sure if it's the same one each time but it sounds so.
The product is consumable so It should have a different transaction id each time.
Thanks

Resources