Search Unity

Official Unity IAP FAQs

Discussion in 'Unity IAP' started by nicholasr, Feb 25, 2016.

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

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    Thank you for using Unity IAP. We appreciate your feedback and suggestions.

    NOTE: Find similar and more up to date information on our Knowledge Base.

    Here are a list of FAQs that we will add to as questions pop up:
    [May 2016 - Updated 4, and 6. Added questions 14+. June 2016 - Added questions 22+. July 2016 - Added question 24. October 2016 - Added questions 25+. Jan 2017 - Moved some Q to KB.]

    1. On Apple’s Sandbox Testing Environment why do no transactions complete?
    [Moved to KB]

    2. Why does my app hang if I try to make a purchase after not completing (via returning PurchaseProcessingResult.Complete from ProcessPurchase) a previous purchase?
    [Moved to KB]

    3. Why does the Android build fail with Unity IAP and AdMob?
    [Moved to KB]

    4. Is receipt validation supported with Unity IAP, for added security?
    [Moved to KB]

    5. Is Unity IAP on Windows for IL2CPP (a.k.a. 64bit, x64) supported?
    No. IL2CPP is considered experimental and a required DLL accessibility feature needed for any plugin to run on Windows IL2CPP has not yet been released.

    6. Is Unity IAP for Amazon or Samsung supported?
    [Moved to KB] Yes.

    7. What is the difference between WindowsPhone8 and WinRT?
    From a Unity IAP API perspective there is no difference. This redundancy has been eliminated in a recent plugin update.

    8. What is unverified revenue?
    [Moved to KB]

    9. Why do I see “Unable to purchase <my-product-id>” in the Android log for Google Play only for consumable products?
    [Moved to KB]

    10. How do I configure my Product IDs for the app stores?
    [Moved to KB]

    11. How do I resolve error code 0x805A0194, shown in logs when the launching my Windows game?
    [Moved to KB]

    12. How does Unity IAP initialization work?
    [Moved to KB]

    13. How does Unity IAP purchasing work?
    [Moved to KB]

    14. How does product restoration work on iOS?

    [Moved to KB]

    15. How does product restoration work on Android’s Google Play Store?
    Google Play and Unity IAP offer automatic restoration of purchased products that have not been consumed. This restoration happens automatically the first time an app is opened after a user re-installs it or installs it for the first time on a new device.

    16. Once a product has been restored what do I need to do to reflect in the app that the user owns the product?
    Nothing! Once product restoration has started (either automatically on Unity IAP initialization for Google Play or after the RestoreTransactions method has been called for iOS), Unity IAP's backend process will call the ProcessPurchase method (via the IStoreListener) on each item being restored. This means that whatever code the app has for the first time a purchase is made, this code will be executed again for the purchases being restored.

    17. Are there code examples of Unity IAP I can look at?
    [Moved to KB]

    18. On Apple, why is ProcessPurchase not being called at launch for previously made but unconsumed purchases?

    NOTICE: This is fixed by Unity IAP 1.6.1. For Unity IAP 1.6.0 and earlier:
    A third party plugin may be consuming Apple’s SKPaymentQueue SKPaymentTransaction notifications before your game initializes Unity IAP. Unity IAP requires those notifications to account for previously unconsumed purchases. This timing issue can be resolved on some plugins’ configuration settings. For Google’s AdMob call [GADMobileAds disableAutomatedInAppPurchaseReporting] (see also AdMob’s IAP reporting documentation) early in your -[UnityAppController application: didFinishLaunchingWithOptions:] (see the generated Xcode project’s UnityAppController.mm). For Facebook’s SDK v3.22 and higher disable IAP logging with the switch at https://developers.facebook.com > Your App > Settings > Basic > iOS > “iOS Only: Log In-App Purchase Events Automatically (Recommended)” (see also the Facebook SDK IAP App Event logging documentation).

    19. Why does Unity IAP stop receiving callbacks on our IStoreListener implementation?
    [Moved to KB]

    20. On Google Play how do I reset non-consumable purchases for repurchasing on a test account?
    You can reset Google Play owned items in the Google Payments Merchant Center. You'll also need to clear the Google Play app's cache since it caches a record of what the player owns.

    21. How do I build for different Android stores e.g. switch from Google Play to Amazon Appstore?
    [Moved to KB]

    22. Why does integrating Unity IAP result in compiler errors?
    [Moved to KB]

    23. Why can’t I enable In-App Purchasing? Who can activate Unity Services (Analytics, Ads, etc.)?
    [Moved to KB]

    24. How to troubleshoot Windows Universal and Windows Phone 8.1 issues?
    1) When exporting the Visual Studio project from Unity enable the InternetClientServer capability in Publishing Settings
    2) Check the phone date and time are correct
    3) In the project’s generated Package.appxmanifest file make sure the following fields matches the published app:
    3a) Package/Identity/Name
    3b) Package/Identity/Publisher
    3c) PhoneProductId
    3d) PublisherDisplayName
    3e) EntryPoint
    These values can be found in the Developer Center's “App management > App identity” section.

    25. Why does Apple initialization return NoProductsAvailable after I set up my iTunes Account?
    While testing if NoProductsAvailable is returned, in spite of having defined products, the iTunes Account may require additional configuration. Ensure your iTunes Account also contains completed agreements on tax and banking. Without these the App Store may refuse to interact with an IAP client.
     

    Attached Files:

    Last edited: Jan 4, 2017
  2. reinaldozhang

    reinaldozhang

    Joined:
    Jun 9, 2015
    Posts:
    8
    Hi @nicholasr , i tried to implement the Unity IAP services. Everything goes as planned during implementation and during Unity editor testing, until i build it to my iOS text device. During the test, is there no pop up message to confirm the purchase? I used the function and it directly purchased the iap without any pop up confirmation box. Fyi, i even haven't log in as a sandbox tester in my test device. I am using Unity 5.3.2p. Thank you.
     
    Last edited: Mar 2, 2016
  3. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Please take a look at the debug log from within XCode which will have more diagnostic information.
     
  4. hk1973

    hk1973

    Joined:
    Oct 14, 2008
    Posts:
    28
  5. Nodgez

    Nodgez

    Joined:
    Nov 27, 2013
    Posts:
    5
    How does the IStore interface fit into this?

    I'm looking to use it to pull down all the products I have listed in the store so I can populate my in game shop that way instead of explicitly typing out all of the product ID's.

    Is it possible to use an IStore Object for this?
     
  6. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    You can read localized product information from the IStoreController. If you want to maintain your own catalog server for listing products, you can.
     
  7. erika_d

    erika_d

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

    Yes, IAP does support showing local prices - the IStoreController includes a products variable that stores metadata sent from the relevant app store. This will include the local prices as its set up in the app store.

    *Edit* In addition to the IStoreController documentation linked to above, these pages are useful for more information about accessing metadata:
    http://docs.unity3d.com/ScriptReference/Purchasing.Product.html
    http://docs.unity3d.com/ScriptReference/Purchasing.ProductMetadata.html
    *

    IAP does not have it's own dashboard because it is part of the analytics dashboard. IAP transactions automatically send a transaction event, which shows up in the analytics dashboard under the total revenue, verified revenue and unverified revenue metrics.
     
    Last edited: Mar 11, 2016
    mpinol likes this.
  8. hk1973

    hk1973

    Joined:
    Oct 14, 2008
    Posts:
    28
    Amazing and can't wait to try it out! Thanks a lot!!
    Btw, not sure if this is the right thread to ask, we are even thinking to switch from Flurry to Unity analytic completely but I can't find a side by side feature comparison anywhere to help us make the decision. Can you help?
     
  9. mpinol

    mpinol

    Joined:
    Jul 29, 2015
    Posts:
    317
    Hey @hk1973,

    I am sorry we do not have a side by side comparison with Flurry but I can tell you that we have a lot of similar features, like funnels, custom events, raw data export, and user sessions. We also provide some other features that you might be interested in as well, such as Unity IAP and Heatmaps!
     
  10. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
  11. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    Hi guys. Well impressed with the GDC stuff yesterday and wanted to ask about Unity IAP for Amazon. I notice above it says no date in the FAQ but was wondering if this has changed after what we saw yesterday? If not, is there an approx eta? Amazon houses one of my biggest customer bases and its a real pain right now to add IAPs from their dated Sdk.

    cheers

    G
     
  12. erika_d

    erika_d

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

    Unfortunately I don't have any information on an exact date for when we will be rolling out Amazon IAP but I can tell you that it will be soon.
     
    FranticThumbs likes this.
  13. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    It'll likely be within the next couple of weeks.
     
    FranticThumbs and erika_d like this.
  14. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    Many thanks chaps/ettes! Keep up the awesome work :)
     
    mpinol and erika_d like this.
  15. MichaelFil

    MichaelFil

    Joined:
    Dec 15, 2015
    Posts:
    4
    Hi. I have a few questions.
    1. As I see firstly I must initialize Store with store-ids. But can I get list of available product from service (GooglePlay, etc)? For example I have added new consumable product (crystals) via Google Player Developer Console, how application can be notified ?

    2. How can I reinitialize store? For example when application is started the 3-rd party server sends a list of available IAP products. When the app is running , the new product is added and server sends new list of products. How can I refresh store's product list at run-time? Currently I must restart app.

    3. Tester has bought non-consumable product. How can I reset this product to test it again ?

    4. Were can I found information about is product active? I disabled product via dev console, but 'availableToPurchase' field is true.

    Thanks
     
    Last edited: Apr 20, 2016
  16. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Why is IAP under Unity Analytics?
    Should it not have own category?
     
  17. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @michael.filchak -

    (1) notifying the app can be accomplished by:

    * updating the app (re-submission), although that is the most painful
    * with a URL that you host containing a list of products that you download when the application launches, and you programmatically "ConfigurationBuilder.AddProduct( myProduct )" iterate through before Initialize()
    * with our alpha "Cloud Catalog" feature available only in Unity 5.4 beta, available for sign-up http://response.unity3d.com/analytics-early-access-sign-up and the ConfigurationBuilder.useCloudCatalog=true; flag, although the number of alpha's and beta's in that might not suitable for your project

    (2) Unity IAP does not support re-initialization. It does in Unity 5.4 beta, however, support adding products at runtime via the FetchAdditionalProducts API: http://docs.unity3d.com/540/Documen...IStoreController.FetchAdditionalProducts.html

    (3) I don't have an answer for this just yet - sorry - I'll look into it and respond if I find one!

    (4) I would expect disabling via the dev console would set availableToPurchase == false, how much time elapsed between disabling and using availableToPurchase?

    @MrEsquire organizationally Unity chose to home the IAP team inside the Analytics team to help collaboration developing related 'joined' products - Verified Revenue which existed in the Analytics Dashboard before IAP is 'reinforced' by IAP, for instance.
     
    Last edited: Apr 21, 2016
    MrEsquire, erika_d and mpinol like this.
  18. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    @michael.filchak You can reset google play owned items in your google merchant account. You'll have to clear the google play app's cache since it caches a record of what the player owns.

    Disabling a product in the google play dashboard will not cause availableToPurchase to be false - Google Play does not indicate to Unity IAP that the product cannot be bought.

    It would be false if the product did not exist at all in the dashboard.
     
    nicholasr likes this.
  19. LianLi

    LianLi

    Joined:
    Apr 21, 2016
    Posts:
    1
    HI,@nicholasr, I trying to implement the Unity IAP in our game, because we need to support app store in different country ,so I have some question about IAP.
    (1) Can I get the currency symbol directly?
    (2) Can I change the product price base on current currency exchange rate?
    We need to show this information in our game UI, Thank you for your help.
     
  20. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    nicholasr likes this.
  21. FerdieQO

    FerdieQO

    Joined:
    Apr 21, 2013
    Posts:
    5
    Hi I'm curious why I don't see IAP in my Unity Services tab. There's only Ads (on), Analytics (on), Cloud Build and Multiplayer... I've walked through the initialization tests and the age designation is set to NOT directed at children under 13 years old. Can someone please tell me how this is possible? IAP isn't a Unity Pro only feature, is it?
     
  22. mpinol

    mpinol

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

    Unity IAP is available and free for everyone! What version of Unity are you using? I believe IAP was added to the Services window in 5.3.
     
    nicholasr and erika_d like this.
  23. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    Is there any way of setting up Unity IAP to work in Unity 4.x?
     
  24. MoranShemi

    MoranShemi

    Joined:
    Jul 1, 2015
    Posts:
    9
    Hi!

    Maybe I'm missing something, but Apple says that for the first in app products I'm creating I have to submit a build to be approved with them - how can I test Unity's IAP if I'm in early development stages and there's no production ready build?

    I've set up a sandbox account but Unity IAP fails in initialization because of "product not found".

    EDIT: One more thing - when I'm trying to purchase a subscription that I've previously purchased (with a test account), even if I've cancelled it in the Play Store, after the purchase is complete, is it possible that I'm not getting a callback to "ProcessPurchase"? All I'm getting is "Already recorded transaction GPA.###...." in the console.
     
  25. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
  26. erika_d

    erika_d

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

    Thanks for your patience! In talking with one of our IAP devs it was pointed out that you in fact don't have to submit a build of your app to the apple store to test IAPs! You can follow this guide here, which walks you through setting up your app's IAPs on the Apple developer website and then testing: http://docs.unity3d.com/Manual/UnityIAPAppleConfiguration.html

    On the purchase subscription question: can you explain more about the flow you're doing when you get the unexpected message? And also if you can post or PM me your full logs?

    Our understanding based on what you described is that you successfully purchase a subscription, hold onto that subscription for awhile (how long?), cancel the subscription (have you tried via code as well as via the play store?), wait for awhile (how long?), and then try to repurchase the subscription, and that's when it tells you that the product is already owned. Is that correct, and can you flesh out the timeline for us a bit more? What kind of confirmation do you receive on cancelling the subscription?
     
    nicholasr likes this.
  27. tigerwoods1206

    tigerwoods1206

    Joined:
    Feb 18, 2015
    Posts:
    8
    Is there a function that corresponds to the getPurchases method that was present in the Android in UnityIAP?
    I would like to use the getPurchases of UnityIAP intentionally at any time.
     
  28. MoranShemi

    MoranShemi

    Joined:
    Jul 1, 2015
    Posts:
    9
    @erika_d - Thank you very much for your response!

    Re: Sandbox purchases, what was missing was filling out and submitting all the "paid application" legal contracts. Once that was done, the products were available for testing. Without these contracts filled, they products will not be active. You might want to add that to the manual because it's not documented ANYWHERE, except an old guide I found somewhere who mentioned it offhandedly.

    I'll have to re-test the responses I'm getting to properly answer your questions and provide more info. Hopefully, I'll be able to do so soon.
     
  29. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    @MoranShemi Thanks for this follow up information! We didn't realize you could get to the add products page without agreeing to those contracts! We'll look into if and where would be appropriate to add a line about it in our documentation. I'm glad you were able to get it working!

    @tigerwoods1206 IAP doesn't expose access to the getPurchases call. Instead you can use m_IStoreController.products.all to return a list of all products that have been initialized, then you can use product.hasReceipt to see for each product in the list whether there is a receipt associated with it and therefore whether it has been purchased before.
    http://docs.unity3d.com/ScriptReference/Purchasing.IStoreController-products.html
    http://docs.unity3d.com/ScriptReference/Purchasing.ProductCollection-all.html
    http://docs.unity3d.com/ScriptReference/Purchasing.Product-hasReceipt.html

    Hope that helps!
     
  30. tigerwoods1206

    tigerwoods1206

    Joined:
    Feb 18, 2015
    Posts:
    8
    @erika_d - Thank you very much for your response!
    Add the question.
    When is the timing of update receipt infomation in m_IStoreController.products.all?
    In other words, Can I update the information on the receipt at any time?
     
  31. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
  32. tigerwoods1206

    tigerwoods1206

    Joined:
    Feb 18, 2015
    Posts:
    8
    @erika_d

    ios, in both of Android I want to get the transaction of consumption type of items that are not the finishTransaction.

    For example, the transaction in the following cases during the finishTransaction from successful purchase I think that remain unfinished.
    1. to kill the app,
    2. move to the background,
    3. wifi communication is cut off of the smartphone,
    4. pending the processing for some error.

    In the No. 1 of the case, there is no problem in products.al is updated to the application restart.
    In the second case, there is no problem in products.al is updated at the time of the background return.

    products.all is also updated in the third and fourth of the cases,
    What I can confirm the transaction incomplete?
     
  33. tigerwoods1206

    tigerwoods1206

    Joined:
    Feb 18, 2015
    Posts:
    8
    @erika_d
    It is another question.

    I have tried FetchAdditionalProducts in iOS, was not a behavior has been assumed.
    FetchAdditionalProducts Then, only transactionID in the product had become null. Other information in the product is particularly no change.

    Procedure tried is as follows.
    1.m_Controller.InitiatePurchase
    2.return PurchaseProcessingResult.Complete in ProcessPurchase
    3.FetchAdditionalProducts

    I have a question,
    When UnityIAP makes a FetchAdditionalProducts, or UnityIAP is to what refresh the product?
    My assumption is, FetchAdditionalProducts was thought that if the information of the product that transaction the same as that at the time of application restart is completed is clear.
     
  34. erika_d

    erika_d

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

    Based on my understanding of what you're trying to do, it sounds like you are trying to find and process purchases that are incomplete. IAP does this automatically when the app is launched, and when a new product is purchased. There is no way to query incomplete purchases other than that right now. What you would want to do is keep track of what products have been purchased and which have been completed in a local list, for the last 3 cases described above.

    Sorry if I'm not understanding the question right, let me know if this helps!
     
  35. Hello-There-Dev

    Hello-There-Dev

    Joined:
    Jul 5, 2012
    Posts:
    20
    To my understanding, Product.hasReceipt should be true after purchasing?
    I have a problem with that not being the case after app restart and InitializePurchasing being called.
    Receipts return after calling RestorePurchases, but that's not really viable.

    I'm using the hasReceipt instead of manually managing the purchases in a save file or similar. Am I trying to use this the wrong way and how are you supposed to use it? :s

    Edit: Working fine with Google Play, but no receipts from iTunes
     
    Last edited: Jul 12, 2016
  36. AdeptDan

    AdeptDan

    Joined:
    May 24, 2015
    Posts:
    4
    Hello!
    Unity IAPs test purchases works fine at the editor, but on OSX
    var builder = ConfigurationBuilder.Instance(module);
    crashes.
    Unity version - 5.3.5f1
    Any help would be greatly appreciated.

    Cathed exception:
    System.DllNotFoundException: /Users/admin/Desktop/inapposx.app/Contents/Plugins/unitypurchasing.bundle/Contents/MacOS/unitypurchasing
    at (wrapper managed-to-native) UnityEngine.Purchasing.OSXStoreBindings:setUnityPurchasingCallback (UnityEngine.Purchasing.UnityPurchasingCallback)
    at UnityEngine.Purchasing.OSXStoreBindings.SetUnityPurchasingCallback (UnityEngine.Purchasing.UnityPurchasingCallback AsyncCallback) [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.AppleStoreImpl.SetNativeStore (INativeAppleStore apple) [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateApple () [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateStore () [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.StandardPurchasingModule.Configure () [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.Extension.AbstractPurchasingModule.Configure (IPurchasingBinder binder) [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.PurchasingFactory..ctor (IPurchasingModule first, UnityEngine.Purchasing.Extension.IPurchasingModule[] remainingModules) [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.ConfigurationBuilder.Instance (IPurchasingModule first, UnityEngine.Purchasing.Extension.IPurchasingModule[] rest) [0x00000] in <filename unknown>:0
    at IAPDemo.Awake () [0x00000] in <filename unknown>:0
     
  37. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Please try reimporting our store package from the In App Purchase cloud service window; hit the 'import' button to download and install the latest version.
     
  38. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @Hello-There-Dev,

    For Apple: hasReceipt is currently not persisted across app restarts for any type of product (our documentation is a little misleading there). Currently we recommend that to persist inventory across app restarts, it should be stored in playerPrefs. Alternatively, you can read the appReceipt stored on the device and parse it for the products you're interested in: http://docs.unity3d.com/Manual/UnityIAPiOSMAS.html (We recommend performing receipt validation whenever reading the appReceipt: http://docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html)

    We are looking into fixing this relaunch behavior in a near-future release, to align more with how the documentation describes it.
     
  39. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    Hey all! Super excited that IAP has arrived on Amazon. I have one question about set up, as I am sure im missing something.

    Ive followed the steps above for Amazon App Store, made sure that my Product ID in game matches the one on Amazon Dashboard (including pricing, images and other standard Amazon stuff - is that it? Or am I missing something? I reason for asking is, that Amazon like us to us their MD5/signature and I can only export assigned apks - which means that the Amazon file may not work as the MD5 won't match up.

    If anyone has published IAPs on Amazon Underground using Unity IAP, any input would be welcome - or from those who know!
    Cheers
    G
     
  40. AdeptDan

    AdeptDan

    Joined:
    May 24, 2015
    Posts:
    4
    Unfortunately, it does not solve the problem..
     
  41. erika_d

    erika_d

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

    Great to hear your excited for the Amazon support! Sorry the set up is not going smoothly...I'm not sure which steps above you're referring to (perhaps #21 in the original post?), but have you checked out these docs on setting up Amazon IAP: http://docs.unity3d.com/530/Documentation/Manual/UnityIAPAmazonConfiguration.html
    http://docs.unity3d.com/530/Documentation/Manual/UnityIAPAmazonExtendedFunctionality.html

    The first one in particular goes through a lot of good detail on getting things set up. If those don't help can you be more specific about what errors you're getting (or is this just a preemptive question)?
     
    FranticThumbs likes this.
  42. Hello-There-Dev

    Hello-There-Dev

    Joined:
    Jul 5, 2012
    Posts:
    20
    Thanks for the reply!
    I'll go ahead and try out the validation route :)
     
    erika_d likes this.
  43. AdeptDan

    AdeptDan

    Joined:
    May 24, 2015
    Posts:
    4
    The problem was in project architecture
     
    erika_d likes this.
  44. tigerwoods1206

    tigerwoods1206

    Joined:
    Feb 18, 2015
    Posts:
    8
    In iOS,
    For the consumption type of product,
    If there is a flaw in the registration of the credit card,
    It seems there is a problem that is double billing again of purchase.
    UnityIAP is either would be able to address this issue?

    This error seems not be confirmed in the sandbox,
    Is there is only likely to be verified in post-release application.

    And the description of this problem in,
    No following site sorry in Japanese of the site,
    Measures for the problem is it is written.
    (This is part of the source code at the bottom.)

    http://glassonion.hatenablog.com/entry/20111201/1322697417

    in short,

    - (Void) paymentQueue: (SKPaymentQueue *) queue updatedTransactions: (NSArray *) transactions

    Among the above methods,
    If the transaction of state is the following,
    It is a state in which there is a deficiency in the registration of the credit card.

    (transactionState == SKPaymentTransactionStateFailed) && (transaction.error.code == SKErrorUnknown)

    In this case,
    as a solution in the above site,
    It seems to be corresponding to restore the above-mentioned transaction.
     
  45. m4ko

    m4ko

    Joined:
    Feb 8, 2013
    Posts:
    21
    I am currently implementing Unity IAP for iOS & Android. We only have one possible purchase:
    (auto renewing) subscription for 1 month

    Could someone please point me into the right direction on how to check if the "user has access". Meaning: He has a valid subscription or a cancelled one with time remaining until expiry. The Unity documentation is not clear on how to validate running subscriptions. My current guess is i have to check the receipts. But the fields exposed by CrossPlatformValidator give little to no information (productID purchaseDate transactionID only).

    Question
    What do I need to do to check an active/valid subscription on Google/iOS?

    To help with understanding what I want to do:
    Pseudocode
    if(subscriptionActive || lastRenewalDate+30days >= currentDate)
    hasAccess = true;
     
    siddharth3322 likes this.
  46. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    Thanks for your reply Erika.
    Unbelievably, it was EXTREMELY straight forward. I couldn't believe it was going to be that easy, maybe I just got lucky - but everything appears to be working well. Superb addition to Unity IAPs! Please thank the team - and thanks to you too :)
     
    erika_d likes this.
  47. erika_d

    erika_d

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

    Sorry for the lacking documentation! The answer is different for Google vs Apple:

    Google is easy - they only return the product if the subscription is valid (https://developer.android.com/google/play/billing/billing_subscriptions.html#user-billing). So on app launch, IAP gets all the products from Google and calls processPurchase on them. If a subscription product is returned, processPurchase will be called on it and the subscription will be granted.

    For Apple, there is actually an additional member of the receipt returned by the Apple Tangle: productReceipt.subscriptionExpirationDate. You can compare the result in that to the current date to determine whether to grant product. It's recommended to do this check on a server vs on the client, since it's relatively easy to change the date by changing the phone's clock.
    You can see productReceipt.subscriptionExpirationDate being used in this post: http://forum.unity3d.com/threads/unity-iap-subscription-expiration-returns-always-wrong-date.394520/
     
    siddharth3322 likes this.
  48. erika_d

    erika_d

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

    I'm sorry I don't quite understand what you're asking, if you would like you can post in your native language and I'll see if we have someone here who can answer it...
     
  49. jevin05

    jevin05

    Joined:
    Apr 7, 2013
    Posts:
    5
    Hi, I use unity iap to work in unity5.3

    i have a problom,

    when i get receipt from payload,and Send Receipt Data to App Store,

    always return {"status":21002}

    This is my code:

    SimpleJson.JsonObject jsonObject = SimpleJson.SimpleJson.DeserializeObject(json) as SimpleJson.JsonObject;
    string data = jsonObject["Payload"].ToString();

    byte[] recBytes = System.Text.Encoding.UTF8.GetBytes(data);
    string receipt = Convert.ToBase64String(recBytes);

    SimpleJson.JsonObject obj = new SimpleJson.JsonObject();
    obj.Add("receipt-data",receipt);
    string sendJson = SimpleJson.SimpleJson.SerializeObject(obj);


    WWWForm wwwForm = new WWWForm();
    wwwForm.AddField("receipt",sendJson);
    WWW www = new WWW("https://sandbox.itunes.apple.com/verifyReceipt", wwwForm);

    when i use

    string data = jsonObject["Payload"].ToString();
    obj.Add("receipt-data",receipt);

    it’s same

    something am i wrong?
     
  50. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
Thread Status:
Not open for further replies.