Search Unity

[Solved] Is it possible to delete an IAP non-consumable product?

Discussion in 'Unity IAP' started by IntDev, Dec 9, 2015.

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

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    I have an already-purchased non-consumable item. But now I want to delete this item in order to buy it again for test purpose. But I cannot because now I have a "Already recorded transaction <id>".
     
  2. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Which platform and test environment is this on?
     
  3. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    Android for now.
     
  4. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    You can delete Unity IAP's transaction log with the following call:

    Code (CSharp):
    1. Directory.Delete (Path.Combine (Path.Combine (Application.persistentDataPath, "Unity"), "UnityPurchasing"));
     
  5. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    Actually, first I made a test purchase in the play store. Later, I uninstalled that version and installed a version directly from Editor to my android device. Since then I cannot purchase anymore because somehow it takes that information from somewhere. I even disabled Wifi but same result.

    Btw I already had a debug script that clears that folder:

    Code (CSharp):
    1. Directory.Delete(Application.persistentDataPath, true);
     
  6. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    How many IAPs do you have and what are their product identifiers and types?
     
  7. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    Only one. This is the setup:

    Code (CSharp):
    1. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance())
    2.     .AddProduct("enable_premium", ProductType.NonConsumable);
    3.  
    4. UnityPurchasing.Initialize(this, builder);
     
  8. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    The transaction log is stored in persistent storage. If that's cleared, I'm not sure how it could possibly be de-duplicating that transaction.
     
  9. jeffkenz

    jeffkenz

    Joined:
    Apr 8, 2013
    Posts:
    22
    go to your payment merchant account then search for history of your test transaction ,then cancel the receipt & wait until google cancel your order then you can buy non consumable item again & don't forget clear com.android.vending
     
    Last edited: Dec 29, 2015
  10. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Unfortunately when purchasing "android.test.purchased" Google gives the same transaction ID every time of "transactionId.android.test.purchased". Unity IAP performs de-duplication based on transaction ID so you would not see a purchase event for this item again.

    Unity 5.4 will have a method for clearing the transaction log for testing purposes, for now you can do it with the following snippet -

    Code (CSharp):
    1. using System.IO;
    2. //...
    3. Directory.Delete(Path.Combine (Path.Combine (Application.persistentDataPath, "Unity"), "UnityPurchasing"), true);
     
Thread Status:
Not open for further replies.