Search Unity

[Closed] Unity IAP not clearing Products after a purchase

Discussion in 'Unity IAP' started by Nicolas1212, May 18, 2016.

Thread Status:
Not open for further replies.
  1. Nicolas1212

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    Somewhat similar to http://forum.unity3d.com/threads/un...-the-app-receipt-after-a-purchase-ios.405223/

    I'm not sure if this is a bug, but after purchasing an IAP, the receipt property of the Product stays populated. Purchase multiple, and each Product holds a receipt string.

    Does this pose a problem? E.g. if a subsequent purchase doesn't work, will Unity IAP assume it has because there's a valid receipt in the Product?
     
  2. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
  3. Nicolas1212

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    Hi Banderous,

    Thanks for the reply, but I don't think it's the same - this is purely during the lifetime of the app.

    If I have the following code to print out the products:

    foreach( Product p in this.m_controller.products.all )
    Debug.Log( "[" + p.definition.id + ",transID:" + p.transactionID + ",hasReceipt:" + p.hasReceipt + "]" );

    When I start the application, it prints this:

    [PRODUCT1, transID: , hasReceipt: False]
    [PRODUCT2, transID: , hasReceipt: False]

    If I purchase PRODUCT1, it prints this:

    [PRODUCT1, transID: 1000000212383605, hasReceipt: True]
    [PRODUCT2, transID: , hasReceipt: False]

    If I then purchase PRODUCT2, it prints this:

    [PRODUCT1, transID: 1000000212383605, hasReceipt: True]
    [PRODUCT2, transID: 1000000212383631, hasReceipt: True]

    If I then refresh the receipt manually, it prints this:

    [PRODUCT1, transID: 1000000212383605, hasReceipt: True]
    [PRODUCT2, transID: 1000000212383631, hasReceipt: True]

    (all transactions are gone from the receipt though, as it should be).

    They're only cleared when the app is relaunched, so it's a local data thing (the same Product is used throughout the lifetime of the app). This was my question. Is the fact that the Products aren't cleaned after a purchase a bug, or could it pose a problem (e.g. for a subsequent purchase of PRODUCT1 that doesn't work, will it still have a valid receipt stored)?

    I can send a test project if desired.
     
    Last edited: May 20, 2016
Thread Status:
Not open for further replies.