• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by navi2121 · Dec 28, 2015 at 05:42 AM · androidunity 5android buildin-app purchasein-app

In-app purchase in Unity 5.3 not working

Hello everybody.

Need your help. Internal Unity In-app. Unity version: 5.3.1p1

Situation: I make everything well in code (I hope), and then I was tested purchases on real devices with working acount (and with credit card).

And I have a problem with initialising purchases ~1 week already. And can not understnad what wrong.

Error message on start: PurchasesUnavailable. Error on Android.

Windows Store not working too.

May be wrong here? :

// vars:

 public class Purchaser : MonoBehaviour, IStoreListener
 { 

 private string B3000 = "2000_gold_coins";
 private string B10000 = "10000_gold_coins";
 private string ADS = "noads";

// procedure:

 public void InitializePurchasing  () {
     if (IsInitialized ()) {
         if (characterController.DebugMode) {
             Debug.Log ("AIP already INITED");
         }
         return;
     } else {
     var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());

         builder.AddProduct    (ADS, ProductType.Consumable, new IDs
             {
                 {"noads_google", GooglePlay.Name},
                 {"noads_windows", WindowsPhone8.Name},
                 {"noads_mac", MacAppStore.Name}
             });
         
         builder.AddProduct    (B3000, ProductType.Consumable, new IDs
             {
                 {"2000_gold_coins_google", GooglePlay.Name},
                 {"3000_coins_windows", WindowsPhone8.Name},
                 {"2000_gold_coins_mac", MacAppStore.Name}
             });
         UnityPurchasing.Initialize (this, builder);
     }

// Call

     IAPScript.GetComponent<Purchaser> ().Buy (productString);

// Request

     public void Buy    (string productId)
     {

     InitializePurchasing ();

     if (IsInitialized ()) {
         controller.InitiatePurchase (productId);
     }

     else {
         
         Debug.LogError ("BuyProductID FAIL. Not initialized.");
         AVATAR.GetComponent<characterController>().PurchaseInitFail();
     }
     }


Thank you!

And Happy New Year!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image navi2121 · Dec 30, 2015 at 07:30 AM 0
Share

Windows error:

UnibillWin8:Exception loading listing information:Exception from HRESULT: 0x805A0194

(Filename: C:/buildslave/unity/build/artifacts/generated/$$anonymous$$etro/runtime/UnityEngineDebugBindings.gen.cpp Line: 40)

avatar image navi2121 · Jan 11, 2016 at 11:14 AM 0
Share

5.3.1p2 - same

7 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by bitween · Jan 15, 2016 at 09:32 AM

Hey guys,

this need an immediate attention don't waste time people like me are waiting to submit some games for this issue please fix it ASAP

Thanks

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Banderous · Jan 15, 2016 at 10:22 AM 0
Share

This is not the right place for technical support. Please go to the Unity forums.

avatar image
0

Answer by navi2121 · Dec 28, 2015 at 05:45 AM

Very strange with this 5.3 build. People now report me: IAP works on 4.3 Android one time of four-five attempts. ON BETA!

Not working on Windows Phone 10 and Windows Phone 8.1 (Windows Store);

wtf with this? :-}

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Banderous · Dec 28, 2015 at 06:10 PM

@navi2121 Have you set up your products and followed the steps outlined [here]?[1]

Please attach an adb trace from application startup through to the unexpected behaviour.

Edit - I suggest the forums are more appropriate for this, it is impossible to give an answer to IAP related questions such as this when there are many publisher configuration specific problems that can cause IAP not to work.

[1]: http://docs.unity3d.com/Manual/UnityIAPGooglePlay.html

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image navi2121 · Dec 29, 2015 at 06:56 AM 0
Share

App not crashing. Just in-app not working. I see, this is problem inside in-app module. Now testing again - PurchasingUnavalible. This is lottery.

In-app not woking on published game too. And, ofcourse, app signed. And sometimes working on beta, sometime not working ONE version.

if not have a solution, I will try more. Thanx for answer.

avatar image
0

Answer by fyy · Jan 09, 2016 at 09:03 AM

Can you fix it ?? I get the same problem.

Where is the problem?

Need your help~

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image navi2121 · Jan 09, 2016 at 12:23 PM 0
Share

@fyy, IAP not working in Windows Store.

For Google Play a make this small solution: Awake runs Invoke for init IAP every 5 seconds. After 30 second if can't init - CancelInvoke and Close Shop in game (like as "Offine status").

If (isInitialized) CancelInvoke.

This helps for second, third and next executes, but NOT FOR FIRST. idk, why.

avatar image fyy navi2121 · Jan 11, 2016 at 01:21 AM 0
Share

Do you try App Store? I just can't Initialized.Everytime i run project in Xcode,it just report "OnInitializedFailed". I don't know what's wrong with it. So sad.

avatar image navi2121 fyy · Jan 11, 2016 at 09:19 AM 0
Share

No, I have not tried the Apple Store. Just Windows Store and Google Play for now.

avatar image Banderous · Jan 11, 2016 at 10:36 AM 1
Share

Please raise this in the forums, this is the place for answers to specific questions rather than technical discussions.

avatar image
0

Answer by basavaraj_guled · Jan 27, 2016 at 06:53 AM

hi there, in my game(android platform ) i have non consumable product google play store , how can i restore those item .

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nomibuilder · Sep 02, 2016 at 04:10 AM 0
Share

You can do that by calling Restore Purchase Function in your game. You can find sample script from Unity Forum. I will attach it here too for assistance. Restore Purchase feature will return all the purchases in case user uninstall the game and reinstall it later.

 public void RestorePurchases ()
     {
         if (!IsInitialized ()) 
         {
             Debug.Log ("RestorePurchases FAIL. Not initialized.");
             return;
         }
 
         if (Application.platform == RuntimePlatform.IPhonePlayer ||
              Application.platform == RuntimePlatform.OSXPlayer) 
         {
             Debug.Log ("RestorePurchases started ...");
 
             var apple = m_StoreExtensionProvider.GetExtension<IAppleExtensions> ();
             apple.RestoreTransactions ((result) => {
                 Debug.Log ("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
             });
         }
         else 
         {
             Debug.Log ("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
         }
     }
 

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

52 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What Emulator For Android Is The Best For Unity 3D? 0 Answers

mobile device restarts when game is uninstalled 0 Answers

Unity 2017.2.0b9 ARCore build&run with Pixel XL (Android 8.0) Failed 0 Answers

[8 days stuck at it] I upgrade project from 5.4 to 5.5 and 5.6 giving Failed assemblies stripper. 0 Answers

Different Unity games cannot install on same Android device 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges