How can I see if a non consumable in-app purchase is valid using Apples Receipt Validation Endpoint

1.2k views Asked by At

I recently set up a service to validate and record purchases from my iOS in accordance with Apples documentation. After a few purchases had gone through I reviewed my table and found that I had 45 purchases that came back with a status code of 0 which according to Apple's docs means that they are valid. The issue is that when I logged into my iTunes Account it had only recorded 22 valid purchases. Upon closer examination of the JSON responses from Apple with the status of 0 I found two variations:

{
    "status": 0,
    "environment": "Production",
    "receipt": {
        "receipt_type": "Production",
        "adam_id": 888310447,
        "app_item_id": 888310447,
        "bundle_id": "com.studioName.gameName",
        "application_version": "1.4",
        "download_id": 62010318102259,
        "version_external_identifier": 810789159,
        "request_date": "2014-12-16 15:34:17 Etc/GMT",
        "request_date_ms": "1418744057267",
        "request_date_pst": "2014-12-16 07:34:17 America/Los_Angeles",
        "original_purchase_date": "2014-07-08 18:04:28 Etc/GMT",
        "original_purchase_date_ms": "1404842668000",
        "original_purchase_date_pst": "2014-07-08 11:04:28 America/Los_Angeles",
        "original_application_version": "1.1",
        "in_app": []
    }
}

{
    "status": 0,
    "environment": "Production",
    "receipt": {
        "receipt_type": "Production",
        "adam_id": 888310447,
        "app_item_id": 888310447,
        "bundle_id": "com.studioName.gameName",
        "application_version": "1.4",
        "download_id": 39011903209949,
        "version_external_identifier": 810789159,
        "request_date": "2014-12-16 15:11:10 Etc/GMT",
        "request_date_ms": "1418742670718",
        "request_date_pst": "2014-12-16 07:11:10 America/Los_Angeles",
        "original_purchase_date": "2014-10-15 05:52:28 Etc/GMT",
        "original_purchase_date_ms": "1413352348000",
        "original_purchase_date_pst": "2014-10-14 22:52:28 America/Los_Angeles",
        "original_application_version": "1.2.4",
        "in_app": [
            {
                "quantity": "1",
                "product_id": "com.studioName.gameName.productName",
                "transaction_id": "190000148450370",
                "original_transaction_id": "190000148450370",
                "purchase_date": "2014-11-29 08:22:49 Etc/GMT",
                "purchase_date_ms": "1417249369000",
                "purchase_date_pst": "2014-11-29 00:22:49 America/Los_Angeles",
                "original_purchase_date": "2014-10-17 08:30:26 Etc/GMT",
                "original_purchase_date_ms": "1413534626000",
                "original_purchase_date_pst": "2014-10-17 01:30:26 America/Los_Angeles",
                "is_trial_period": "false"
            }
        ]
    }
}

Note that the first objects in-app array is empty while the second seems to actually have a receipt for the IAP. My assumption was that I should look to the receipts that have the in-app array populated. My issue is now that I have parsed out the receipts without an in-app array I am still left with 25 valid purchases (3 more than was recorded by Apple).

My next thought was that maybe some of these purchases were restores. I found this note in the Receipt Validation Programming guide. It states under the original transaction identifier:

"For a transaction that restores a previous transaction, the transaction identifier of the original transaction. Otherwise, identical to the transaction identifier."

After I examined all of my valid receipts I found no instances where the original_transaction_id and the transaction_id were different. For that matter I made a duplicate purchase which gave me the prompt that the item had already been purchased and asked if I would like to restore it for free. When I did so and checked the receipt I found that even in this instance the two transaction ids were the same which should not be the case.

When I put in an inquiry I received a canned response telling me that the IAP section of itunes was working properly. If anyone could help to shed some light on how I could better filter these to match Apples final count of IAPs it would be much appreciated!

0

There are 0 answers