Search Unity

[Solved] Unity IAP: Non-Consumables on Android

Discussion in 'Unity IAP' started by illuminat, Jan 29, 2016.

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

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    Hi,

    According to http://developer.android.com/google/play/billing/api.html
    all IAP products are managed products. "In Version 3, all in-app products are managed. This means that the user's ownership of all in-app item purchases is maintained by Google Play, and your application can query the user's purchase information when needed.".

    You can consume an Item and then its not owned anymore. "Consuming the in-app product reverts it to the "unowned" state, and discards the previous purchase data.".

    How can I instruct Unity IAP that a product should not be consumed?

    I've read in http://forum.unity3d.com/threads/restoring-a-purchase-on-android.374012/
    that "Unity IAP automatically consumes consumable products on google play when your app confirms a purchase as processed. A purchase is considered processed when: A result of ProcessingResult.Complete is returned from ProcessPurchase [...]".

    So should i return Pending instead of Complete if I want to use non-consumable Items on the Android platform?

    Thanks for clarification!
     
  2. iWumbo

    iWumbo

    Joined:
    Dec 5, 2013
    Posts:
    12
    U dont need to do anything, Unity handles everything by himself.

    U are able to rebuy your consumables as often as u want, just declare them as consumables in unity.
     
  3. illuminat

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    yeah, but how do i declare an item as non-consumable?
     
  4. iWumbo

    iWumbo

    Joined:
    Dec 5, 2013
    Posts:
    12
    http://unity3d.com/learn/tutorials/...ating-unity-iap-your-game-beta?playlist=17123

    Code (CSharp):
    1. // Create a builder, first passing in a suite of Unity provided stores.
    2.             var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    3.            
    4.             // Add a product to sell / restore by way of its identifier, associating the general identifier with its store-specific identifiers.
    5.             builder.AddProduct(kProductIDConsumable, ProductType.Consumable, new IDs(){{ kProductNameAppleConsumable,       AppleAppStore.Name },{ kProductNameGooglePlayConsumable,  GooglePlay.Name },});// Continue adding the non-consumable product.
    6.             builder.AddProduct(kProductIDNonConsumable, ProductType.NonConsumable, new IDs(){{ kProductNameAppleNonConsumable,       AppleAppStore.Name },{ kProductNameGooglePlayNonConsumable,  GooglePlay.Name },});// And finish adding the subscription product.
    7.             builder.AddProduct(kProductIDSubscription, ProductType.Subscription, new IDs(){{ kProductNameAppleSubscription,       AppleAppStore.Name },{ kProductNameGooglePlaySubscription,  GooglePlay.Name },});// Kick off the remainder of the set-up with an asynchrounous call, passing the configuration and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed.
    8.             UnityPurchasing.Initialize(this, builder);
     
  5. illuminat

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    oh thanks! so it was totaly my fault. i was a 100% sure that i had written NonConsumable there. now i checked again and i guess I probably need glasses.
    thanks again.
     
Thread Status:
Not open for further replies.