Search Unity

Unity IAP Store Guides - Amazon, Apple, Google Play, Windows

Discussion in 'Unity IAP' started by nicholasr, Dec 8, 2015.

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

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    To help illustrate connecting existing app stores with your games via the new Unity IAP feature in 5.3 (reference, manual) we are publishing a series of Store Guides. They walk through an interaction with the Store's web portal, registering essential Application details, defining your in-app purchase Product, and testing game-to-store product purchase connectivity.

    Guides available now cover the following stores:
    Nick, Unity IAP / Analytics
    (Updated Apr 18, 2016)
     
    Last edited by a moderator: Aug 29, 2017
  2. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @nicholasr , great news and good job !!!

    I got one question for you, what I want to achieve if it's possible, can I send to Unity Analytics.Transaction extra info via string ? E.G:

    Code (CSharp):
    1. Analytics.Transaction("12345abcde", 0.99m, "USD", null, null "extraINFO");
    Thanks in advance !
     
  3. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    The recognition is appreciated @D0R1N, thanks!

    There is a way to do this with Analytics.CustomEvent. Send similar transaction data as a CustomEvent and include the string of extra info as an additional parameter there. One could then Build a Segment of users who bought a specific game item, also querying the "extraINFO" parameter/value as desired.

    Analytics' Transaction API is designed mainly to give revenue reports and access to receipt verification. Note that Analytics.Transaction is already called for every product transaction when using Unity IAP.
     
    RoyalCoder and mpinol like this.
  4. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    @nicholasr thanks for your quick reply ;)

    The purpose of extra info in my case is a tag for every real in app purchase in my game, can I use receipt or signature for adding my tag for purchases ?

    If I do'it via Analytics.CustomEvent can I add to the custom event the real price, taxes, or other info to be send'it on Unity Anaytics ?
    Thanks !
     
  5. buyrusdesign

    buyrusdesign

    Joined:
    Jan 7, 2015
    Posts:
    1
    Thank you for great work. I'm thinking to use this on my game.

    I have an question about security. Does Unity IAP have some security system for purchasing?
    I have a hard time, because some people overuse purchasing items in my game, so I need to use server to prohibit overusing it.
    If Unity IAP has some security system for this situation, I would like to use it!

    Does Unity IAP have some security system for purchase?

    Thank you in advance.
     
  6. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @D0R1N I see - "tag" makes sense :)

    And yes the price, and other product / purchase info can be added to a CustomEvent. It's supports a key-value dictionary for including any data fields you need to use when tagging this purchase.

    The receipt and signature fields of Transaction can be used to view receipt verification analytic reports (http://docs.unity3d.com/Manual/UnityAnalyticsReceiptVerification.html) when you desire it.
     
  7. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @buyrusdesign Cool, thanks very much!

    We are working on a new feature: client-side receipt verification. This will enable developers to determine if a user makes a purchase from an untrusted app store. Then a game can decline to provide the service it would otherwise have unlocked. The feature is still being worked on, and once complete we think it will be a useful addition.

    I am guessing the overuse of purchased items currently detected by comparing the sum of Transaction events versus verified income. Is my guess wrong?
     
    IndieFist likes this.
  8. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Any new about trusted purchases?
    And, its a way to implement inapp with Amazon Store?
     
  9. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @MrPacoGP Thank you for expressing interest in the upcoming client-side receipt validation feature! I am encouraged to know it will be used. While there is no additional news to share yet, an announcement will be made on the forum when the feature is generally available.

    Regarding our Amazon Store IAP implementation, it is on our roadmap but I cannot say when it will be officially released.
     
    IndieFist likes this.
  10. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Thank you very much.
    Amazon maybe more interesting than windows store at this moment?
     
  11. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @MrPacoGP :) Yes we are seeing, through various channels, a significant number of requests for Amazon!
     
    IndieFist likes this.
  12. Wentao

    Wentao

    Joined:
    Mar 11, 2014
    Posts:
    6
    hi, nicholar:
    to use unity analytics, do i need to buy unity subscription?
    since i cannot see any unity service in free account.

    thanks,
     
    nicholasr likes this.
  13. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    All unity Service become with the free version of unity 5.3
     
    nicholasr likes this.
  14. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
    is there a time frame on windows store IL2CPP support?
     
  15. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    AVOlight likes this.
  16. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
    nicholasr likes this.
  17. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @Wentao I agree with @MrPacoGP - we anticipate always offering a free version of Analytics. Is this what you need to know?
     
    IndieFist likes this.
  18. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    How can i get info on analytic for separates stores? I got published our game on android and ios, for unity ads, we have two tab for each market, but on analytic?
    Well i just found it. Sorry :p
     
  19. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
    so is there an rss for Unity IAP updates ? or something
     
  20. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @AVOlight Sorry to say a condensed RSS (e.g.) is not available at this time.

    However, for the code, we are looking into an IAP Plugin update mechanism. And for updates of a more textual nature, "watching" this Forum is possible (navigate back to the forum index and find 'watch forum') which for your interest "IL2CPP Windows IAP" I speculate would be spammy unless aggressively filtered by your email system for just those keywords. I would anticipate an announcement of this new support be made on this forum once available.
     
    AVOlight likes this.
  21. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
    Ok, :)
     
    nicholasr likes this.
  22. tnbao91

    tnbao91

    Joined:
    Sep 5, 2013
    Posts:
    46
  23. rizzin

    rizzin

    Joined:
    Feb 1, 2013
    Posts:
    25
    I have integrated Unity IAP into our game and during testing for Windows Store I've experienced the following:

    - x86: everything works well
    - x64: I get an exception during UnityPurchasing.Initialize() (System.AggregateException in mscorlib.ni.dll; the exception's message is simply "One or more errors occurred.")

    I've been trying to wrap my head around it for some time already and have googled a lot but haven't found anyone with the same problem. I've just read the document attached to the first post of this topic and found this:
    So what I would like to know is this: does the mock billing system for Windows Store work only for x86 architecture? Or it is supposed to work on x64 and it means that I'm doing something wrong.
     
  24. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    @CaptainTire Yeah I'm having the same problem. It seems to only work currently with x86.
    If I try x64 I receive the following error on my project when running in Visual Studio


    I only changed it to x86 after I noticed that line in the guide as well.
     
  25. rizzin

    rizzin

    Joined:
    Feb 1, 2013
    Posts:
    25
    @skullthug I've been getting pretty much the same error. Glad to see it's not only me.

    Alright, until someone of the devs sheds some light on this issue, I'll consider the IAP working alright as long as it works just on x86 platform.
     
  26. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    In retrospect I'm guessing IL2CPP is required for 64bit? And that (see above) is still in the works.
     
  27. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Well, i have setup all correctly following the information:
    https://docs.google.com/document/d/1r5CXi-vpULysjBq_cAVktOdLvgFh_o3rk8iQCvPIIos/edit#

    i got it working under google and apple store, but cant get it on windows phone.
    I have tested with :
    varbuilder=ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());

    builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem=true;

    This last line is for testing purposes really?
    But when i press button for purchase anything dont work...
    Visualdebug:
    UnibillWin8:Exception loading listing information:Exception from HRESULT: 0x805A01F7
    (Filename: C:/buildslave/unity/build/artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 40)
    BuyProductID FAIL. Not initialized.
    (Filename: C:/buildslave/unity/build/artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 40)
     
    Last edited: Jan 19, 2016
  28. rizzin

    rizzin

    Joined:
    Feb 1, 2013
    Posts:
    25
    You should set this flag for the purchasing module, like this:
    Code (csharp):
    1.  
    2. var module = StandardPurchasingModule.Instance();
    3. module.useMockBillingSystem = true;
    4. var builder = ConfigurationBuilder.Instance(module);
    5. builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = true;
    6.  
     
    IndieFist likes this.
  29. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Thank you very much.
    Now it works like a charm!
    And, when we send the final app to market, we have to remove module.usemockbillingsystem = true; really?
     
  30. rizzin

    rizzin

    Joined:
    Feb 1, 2013
    Posts:
    25
    Yeah, as far as I understand, you have to remove it both from module and from builder.
    I've separated this stuff into a separate variable in order to prevent situations where I change this flag in module and forget to do so in builder or vice versa. Like so:
    Code (csharp):
    1.  
    2. public class MyClass : IStoreListener
    3. {
    4.   private bool useMockBillingSystem = true;
    5.   void Initialize()
    6.   {
    7.     var module = StandardPurchasingModule.Instance();
    8.     module.useMockBillingSystem = useMockBillingSystem;
    9.     var builder = ConfigurationBuilder.Instance(module);
    10.     builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = useMockBillingSystem;
    11.     //other stuff
    12.   }
    13. }
    14.  
     
    IndieFist likes this.
  31. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Then, this is the final method to send the final app, ok.
    Only you use the bool to check on editor or testing really?
    Thank you for all
    Regards.
     
  32. rizzin

    rizzin

    Joined:
    Feb 1, 2013
    Posts:
    25
    I set it to true for testing in Visual Studio and on a Windows Phone device too.
    When preparing to release the game I will set it to false.
     
    IndieFist likes this.
  33. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Code (CSharp):
    1. private bool useMockBillingSystem = false;
    2.  
    3.         public void InitializePurchasing()
    4.         {
    5.             // If we have already connected to Purchasing ...
    6.             if (IsInitialized())
    7.             {
    8.  
    9.                 return;
    10.             }
    11.  
    12.             var module = StandardPurchasingModule.Instance();
    13.             module.useMockBillingSystem = useMockBillingSystem;
    14.             var builder = ConfigurationBuilder.Instance(module);
    15.             builder.Configure<IMicrosoftConfiguration>().useMockBillingSystem = useMockBillingSystem;
    16.  
    17.             builder.AddProduct("B2D2", ProductType.NonConsumable, new IDs
    18.                 {
    19.                     {"b2d2", GooglePlay.Name},
    20.                     {"b2d2", WindowsPhone8.Name},
    21.                     {"b2d2", AppleAppStore.Name}
    22.                 });
    23. UnityPurchasing.Initialize(this, builder);
    24. }
    25.  
    This is my configuration, but is not working.

    Should i use WinRt .name instead of WindowsPhone8.name ?
    Also with a blanck space between winrt and .name?

    I get this debugging on visual:
    The thread 0x690 has exited with code 0 (0x0).
    UnibillWin8:Exception loading listing information:Exception from HRESULT: 0x805A0194
    BuyProductID FAIL. Not initialized.
     
    Last edited: Jan 23, 2016
  34. rizzin

    rizzin

    Joined:
    Feb 1, 2013
    Posts:
    25
    I think you should use "WinRT.name" instead of "WindowsPhone8.name". At least I'm sure this is the case if you are targeting windows universal platform.
     
    IndieFist likes this.
  35. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    I only got published at windows phone market. But also with alot of graphics issue on some device.
     
  36. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    If your product id is "b2d2" across all platforms then you can simply give it a name of "b2d2", you don't need to redeclare it for every single platform - only those where it is different.

    You are not using the mock billing system, are you testing as a beta test distribution? Before your app is published you can only test IAP via installing the app as a beta.
     
    IndieFist likes this.
  37. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    I only need to do this?
    Code (CSharp):
    1.  builder.AddProduct("B2D2", ProductType.NonConsumable, new IDs {"b2d2"  });
    Or what should be the correct syntax?
    And, for testing purposes i can get the windows of fake purchases on testing, but for final release, what should be the method:
    Code (CSharp):
    1.  var module = StandardPurchasingModule.Instance();
    2.          
    3.             var builder = ConfigurationBuilder.Instance(module);
    4.  
    This alone?
     
  38. mpinol

    mpinol

    Joined:
    Jul 29, 2015
    Posts:
    317
    Hi @MrPacoGP,

    I believe it should be,

    builder.AddProduct("b2d2", ProductType.NonConsumable);

    I have also changed B2D2 to lower case since some platforms' product ids are case sensitive.

    Yes, you should not need to specify anything else for production Windows IAP.
     
  39. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Well, with this code my inAPP on windows still not working.
    I have missed something?
    Its required to do something on visual studio?
     
    ex_mi likes this.
  40. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Well, i got this published on my game and people are asking on game review why they can´t buy new characters!
    Arggggg need to fix that!!
     
  41. ModernAlchemist

    ModernAlchemist

    Joined:
    Feb 17, 2014
    Posts:
    9
    I only read about Win 10 Universal in the docs.
    Is Win 8.1 Universal / Win Phone 8.1 supported?

    Thanks.
     
  42. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @ModernAlchemist,

    Yes, Windows 8.1 Universal and Phone are supported. We're constantly working on improving our documentation, thank you for your feedback about it being unclear in this respect. Windows integration can be a little touch and go at times, so if you have any difficulty with integrating on any of those versions, please feel free to post additional questions on the forums, or fill out support tickets for additional help.
     
  43. Nihil688

    Nihil688

    Joined:
    Mar 12, 2013
    Posts:
    503
    The documentation is currently misleading as it states:


    public Purchasing.ConfigurationBuilder AddProduct(string id, Purchasing.ProductType type, Purchasing.IDs storeIDs);

    Parameters
    id The store independent ID.
    type The product type.
    storeIDs An optional set of store-specific identifiers, for when your product has different IDs on different stores.

    but the id is very store dependent even in 5.3.2
     
  44. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Well, i want try with latest version of unity to see if i can get inapp working this time...
     
  45. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    @Nihil688 Why do you consider that documentation misleading? It is possible to reuse the same product ID across every store. You only need to define store specific IDs when they deviate from your store independent product ID.
     
  46. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Hi Banderous,
    I really appreciate if you could answer my question. I've sent you an e-mail.
     
    Last edited: Feb 8, 2016
  47. Nihil688

    Nihil688

    Joined:
    Mar 12, 2013
    Posts:
    503
    As I explained, it says that the ID is store independent but it's not. For windows store I tried submitting it with the example in the documentation and it didn't work unless I did store dependent ids
     
    IndieFist likes this.
  48. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    1. What exact IDs were you trying to use that didn't work?
    2. What were the exact IDs that did work?
    3. What are the product IDs you defined on the microsoft developer portal?

    @alexsan75 dealt with via email
     
  49. Nihil688

    Nihil688

    Joined:
    Mar 12, 2013
    Posts:
    503
    I'll use the original poster's examples:

    if b2d2 is the ID that I have uploaded on one of the stores then the following wouldn't work:

    Code (CSharp):
    1. builder.AddProduct("B2D2", ProductType.NonConsumable, new IDs
    2.                 {
    3.                     {"b2d2", GooglePlay.Name},
    4.                     {"b2d2", WinRT.Name}
    5.                 });

    I'd have to change it to the following for it to work:

    Code (CSharp):
    1. builder.AddProduct("b2b2", ProductType.NonConsumable, new IDs
    2.                 {
    3.                     {"b2d2", GooglePlay.Name},
    4.                     {"b2d2", WinRT.Name}
    5.                 });
     
  50. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Store IDs are case sensitive. "B2D2" is not the same as "b2d2" in your second example.
     
    MrEsquire likes this.
Thread Status:
Not open for further replies.