Search Unity

[Closed] InApp returns more than items on verification

Discussion in 'Unity IAP' started by bilal-carameltech, Feb 15, 2018.

Thread Status:
Not open for further replies.
  1. bilal-carameltech

    bilal-carameltech

    Joined:
    Jul 22, 2014
    Posts:
    4
    Hi,

    Upon successful in-app on sandbox user we're getting receipt from Apple, when we try to verify that receipt from Apple sandbox verification url we're getting more than one In-Apps in array (we're doing only one in-app at time).

    How can we remove unused inApps from this list as we have to verify iterate this list each time on server side.

    Here is the receipt from Apple:

    {"status":0, "environment":"Sandbox",
    "receipt":{"receipt_type":"ProductionSandbox", "adam_id":0, "app_item_id":0, "bundle_id": "com", "application_version":"256", "download_id":0, "version_external_identifier":0, "receipt_creation_date":"2018-02-15 10:52:15 Etc/GMT", "receipt_creation_date_ms":"1518691935000", "receipt_creation_date_pst":"2018-02-15 02:52:15 America/Los_Angeles", "request_date":"2018-02-15 10:54:05 Etc/GMT", "request_date_ms":"1518692045560", "request_date_pst":"2018-02-15 02:54:05 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.ios5", "transaction_id":"1000000376178048", "original_transaction_id":"1000000376178048", "purchase_date":"2018-02-15 10:52:15 Etc/GMT", "purchase_date_ms":"1518691935000", "purchase_date_pst":"2018-02-15 02:52:15 America/Los_Angeles", "original_purchase_date":"2018-02-15 10:52:15 Etc/GMT", "original_purchase_date_ms":"1518691935000", "original_purchase_date_pst":"2018-02-15 02:52:15 America/Los_Angeles", "is_trial_period":"false"},
    {"quantity":"1", "product_id":"com.ios2", "transaction_id":"1000000375880808", "original_transaction_id":"1000000375880808", "purchase_date":"2018-02-14 11:59:36 Etc/GMT", "purchase_date_ms":"1518609576000", "purchase_date_pst":"2018-02-14 03:59:36 America/Los_Angeles", "original_purchase_date":"2018-02-14 11:59:36 Etc/GMT", "original_purchase_date_ms":"1518609576000", "original_purchase_date_pst":"2018-02-14 03:59:36 America/Los_Angeles", "is_trial_period":"false"},
    {"quantity":"1", "product_id":"com.ios3", "transaction_id":"1000000376080515", "original_transaction_id":"1000000376080515", "purchase_date":"2018-02-15 05:42:50 Etc/GMT", "purchase_date_ms":"1518673370000", "purchase_date_pst":"2018-02-14 21:42:50 America/Los_Angeles", "original_purchase_date":"2018-02-15 05:42:50 Etc/GMT", "original_purchase_date_ms":"1518673370000", "original_purchase_date_pst":"2018-02-14 21:42:50 America/Los_Angeles", "is_trial_period":"false"},
    {"quantity":"1", "product_id":"com.ios1", "transaction_id":"1000000376163790", "original_transaction_id":"1000000376163790", "purchase_date":"2018-02-15 10:13:00 Etc/GMT", "purchase_date_ms":"1518689580000", "purchase_date_pst":"2018-02-15 02:13:00 America/Los_Angeles", "original_purchase_date":"2018-02-15 10:13:00 Etc/GMT", "original_purchase_date_ms":"1518689580000", "original_purchase_date_pst":"2018-02-15 02:13:00 America/Los_Angeles", "is_trial_period":"false"}]}}
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The behavior is by design. We receive bundled receipts from Apple like that. In the future we may consider parsing the receipt per product, but we generally try not to impact store default behavior.
     
  3. bilal-carameltech

    bilal-carameltech

    Joined:
    Jul 22, 2014
    Posts:
    4
    How this pending array is calculated, like how these items grow when I am doing in-app?
    Also is there any way I can consume or clear these pending in-apps?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Not sure what you mean by unused. These are the products that the user has purchased. This is the information we receive from Apple.
     
  5. bilal-carameltech

    bilal-carameltech

    Joined:
    Jul 22, 2014
    Posts:
    4
    According to Apple documentation: The in-app purchase receipt for a non-consumable product, auto-renewable subscription, non-renewing subscription, or free subscription remains in the receipt indefinitely.

    We're doing consumable in-app which is supposed to be removed from the receipt once user consumed it. But we're getting more than one items in this case. So my question is how can we clear this array list which is supposed to contain only last purchased item (consumable only).
     
  6. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @bilal-carameltech

    "The in-app purchase receipt for a consumable product is added to the receipt when the purchase is made. It is kept in the receipt until your app finishes that transaction. After that point, it is removed from the receipt the next time the receipt is updated - for example, when the user makes another purchase or if your app explicitly refreshes the receipt."

    Their wording is a bit confusing, but I believe the product will stay in the receipt until another purchase of the same product ID is made or until you refresh the App Receipt. Looking at the example you posted, there are no duplicate product IDs, so I believe this is working as expected.
    Unity IAP does have an Apple extension that allows you to refresh the receipt:
    https://docs.unity3d.com/Manual/UnityIAPiOSMAS.html

    To your original question, Unity IAP does not modify the App Receipt as received from Apple. If there is any format change you would like to request, you would need to make the request to Apple:
    https://developer.apple.com/support/
     
Thread Status:
Not open for further replies.