Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Introducing Unibill - the cross platform In App purchase plugin!

Discussion in 'Assets and Asset Store' started by Banderous, Jan 16, 2013.

  1. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
  2. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    I suggest reimporting unibill into your project.

    If the inventory editor isn't working then try importing unibill into a blank project, configure your inventory and them copy unibillinventory.json from the new project into your existing project
     
  3. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
    I did do that several days ago, but that didn’t solve the problem….which I believe is fundamentally caused because the “Save” button in Unibill may do other functions besides generate the inventory.json file. The problem is in the Manifest, not in the inventory file. That Unity post details what I’ve tried to solve that…can you help more?

    <http://forum.unity3d.com/threads/paid-fix-errors-with-unibill-on-android.430754/>

    ________________________________________________
     
  4. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
    And reimporting Unibill doesn't solve the initial problem either -- when I click "Save" on the inventory editor, I still get this error in the console:

    NullReferenceException: Object reference not set to an instance of an object
    Unibill.Impl.MiniJsonExtensions.getString (System.Collections.Generic.Dictionary`2 dic, System.String key, System.String defaultValue) (at Assets/Plugins/unibill/src/impl/MiniJSON.cs:757)
    Unibill.Impl.UnibillConfiguration..ctor (System.String json, RuntimePlatform runtimePlatform, ILogger logger, System.Collections.Generic.List`1 runtimeProducts) (at Assets/Plugins/unibill/src/impl/UnibillConfiguration.cs:61)
    UnibillInjector.GetConfig () (at Assets/Editor/unibill/src/Injector.cs:16)
    UnibillInjector.GetStorekitGenerator () (at Assets/Editor/unibill/src/Injector.cs:44)
    InventoryEditor.serialise () (at Assets/Editor/unibill/src/InventoryEditor.cs:203)
    InventoryEditor.OnGUI () (at Assets/Editor/unibill/src/InventoryEditor.cs:120)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    So I tried deleting the iOSKey (as indicated on line 61 of UnibillConfiguration), but I still get the error, and while the inventory.json file is rewritten on disk, it still has the iOSSKU so I guess it's not actually getting rewritten? If I can solve this problem, maybe all the other problems will be solve too?
     
  5. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
    Well, we dug into the error and finally figured it out: Unibill was using the wrong MiniJSON - not its own but one from another plugin. And of course they were slightly different... (Good thing Unity has implemented JSON now so that everyone doesn't have to include MiniJSON anymore...) Fixing that fixed all the other problems.
     
  6. DominiqueT

    DominiqueT

    Joined:
    Mar 27, 2014
    Posts:
    49
    Hi @Banderous

    We still have an issue with consumable products. We got "this in-app purchase has already been bought it will be restored for free" on iOS.

    We found how to reproduce it:

    - Open the game
    - Tap on a button calling Unibiller.initiatePurchase
    - Kill the app
    - (apple) Popup of payment is displayed
    - Enter your password
    - (apple) Popup of confirmation is displayed
    - Launch the game again
    - Try to buy the same product, have the popup with "this in-app purchase has already been bought it will be restored for free"

    We try to call
    Unibiller.restoreTransactions();
    but it doesn't fix our issue.

    We can't give you logs, we need to kill the app to have the issue and XCode stop logging when the app is killed but you have steps to reproduce it.
     
  7. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    The transaction should complete when you next launch your application. Can you attach a log from when you relaunch the app having killed it?

    I also suggest repeating this test with a new itunes connect test user account.
     
  8. DominiqueT

    DominiqueT

    Joined:
    Mar 27, 2014
    Posts:
    49
    Yes it should but it doesn't.

    Here's the log after the relaunch:



    Unibill.RemoteConfigManager: Not using cached inventory, using bundled.

    Unibill.Impl.RemoteConfigManager:.ctor(IResourceLoader, IStorage, ILogger, RuntimePlatform, List`1)

    Unibiller:Initialise(List`1)



    2016-12-02 15:54:32.515155 aaa[11029:2919273] Unibill: requestProductData

    2016-12-02 15:54:32.515575 aaa[11029:2919273] Unibill: requestProducts:{(

    "xxx",

    "xxx",

    "xxx",

    "xxx",

    "xxx",

    "xxx",

    "xxx"

    )}

    2016-12-02 15:54:32.518315 aaa[11029:2919273] Unibill: Traceout: requestProductData




    2016-12-02 15:54:33.429020 aaa[11029:2919273] Unibill: productsRequest:didReceiveResponse:(

    "<SKProduct: xxx>",

    "<SKProduct: xxx>",

    "<SKProduct: xxx>",

    "<SKProduct: xxx>",

    "<SKProduct: xxx>",

    "<SKProduct: xxx>",

    "<SKProduct: xxx>"

    )

    2016-12-02 15:54:33.507369 aaa[11029:2919273] Unibill: _unibillAddTransactionObserver

    UnibillBiller: onSetupComplete(True)

    Unibill.Biller:eek:nSetupComplete(Boolean)

    Unibill.Biller:eek:nSetupComplete(List`1)

    Unibill.Impl.AppleAppStoreBillingService:eek:nProductListReceived(String)

    Unibill.Impl.StoreKitPluginImpl:processMessage(String, String, String)

    UnibillUnityUtil:Update()


    Unibill onInitialised SUCCESS

    Banque:eek:nInitialised(UnibillState)

    Unibill.Biller:eek:nSetupComplete(Boolean)

    Unibill.Biller:eek:nSetupComplete(List`1)

    Unibill.Impl.AppleAppStoreBillingService:eek:nProductListReceived(String)

    Unibill.Impl.StoreKitPluginImpl:processMessage(String, String, String)

    UnibillUnityUtil:Update()
     
  9. DominiqueT

    DominiqueT

    Joined:
    Mar 27, 2014
    Posts:
    49
    @Banderous can we force the completion of the transaction?
     
  10. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    The transaction will still be pending with storekit, it is likely that another plugin is draining the transaction queue before Unibill adds its observer; are you using facebook's SDK, for example?

    In UnibillStorekit.mm you should see the following method:

    Code (CSharp):
    1. -(void) addTransactionObserver {
    2.     [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    3. }
    Please try replacing with the following:

    Code (CSharp):
    1. -(void) addTransactionObserver {
    2.     SKPaymentQueue* defaultQueue = [SKPaymentQueue defaultQueue];
    3.  
    4.     BOOL processExistingTransactions = false;
    5.     if (defaultQueue != nil && defaultQueue.transactions != nil)
    6.     {
    7.         if ([[defaultQueue transactions] count] > 0) {
    8.             processExistingTransactions = true;
    9.         }
    10.     }
    11.  
    12.     [defaultQueue addTransactionObserver:self];
    13.     if (processExistingTransactions) {
    14.         [self paymentQueue:defaultQueue updatedTransactions:defaultQueue.transactions];
    15.     }
    16. }
    17.  
     
  11. DominiqueT

    DominiqueT

    Joined:
    Mar 27, 2014
    Posts:
    49
    Thanks

    It seems working.
    I'll test live in the future.
     
  12. John3D

    John3D

    Joined:
    Mar 7, 2014
    Posts:
    441
    I haven't used In App purchase for my games so far, but I might use it in my future games.
     
  13. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    53
    Hello

    I am trying to build a MacOS version of our app and I'm using a few plugins to help with the app(Natcorder, UTMail and Unibill).

    I kept getting an error in the application loader when I was trying to validate the app
    This didn't go through the application loader.

    So, I tried to change the bundle identfiers of these to what we used for our app, and that made it go through the application loader, but it didn't get approved by apple with this mail sent as the issue report
    Can anyone help with these issue?