New Unity In-App Purchase integration (Android)
Asked Answered
D

2

5

Im trying to integrating new Unity inapp serivice and got the next problem:

I created project on google play (now it is only in Alpha-testing with no-publishing) and i created in-app content for purchasing. In unity editor all works well, but when im trying run its on device got next:

*Unavailable product coins500 -**.coins500 OnInitializeFailed InitializationFailureReason:NoProductsAvailable*

Google play API key inserted in Code by builder.setPublicKey() and in unity analytics dashboard The app have permission on BILLING

Why i cant get the product from the GP?

Edit: Just finded this topic: http://docs.unity3d.com/Manual/UnityIAPGooglePlay.html Now im trying to publish my application and test IAP again. Possibly problem in this.

Edit2: Publishing my app dont help me with my question. Any solutions? Still see my products are unaviable. OnInitializeFailed InitializationFailureReason:NoProductsAvailable

Decortication answered 6/4, 2016 at 8:26 Comment(2)
ps go HERE forum.unity3d.com/threads/… for some lovely code to get started with Unity's amazing new IAP/IAB stuff.Cloakanddagger
IAP can be quite tricky to implement on Android since there is alot of small things that needs to be setup in order to test a purchase. If you use something like MobiShop (assetstore.unity3d.com/en/#!/content/63636 ) you can get it up and running while testing in the editor.Oophorectomy
C
5

OK, here's an amazing tip,

With google IAB, in fact, it will only work once you download it as a beta from the playstore, it will NOT work if you just load the .apk locally.

it's incredibly annoying, but that's how it is.

Note that - in contrast - when you are using PlayGames (to post achievements and so on), you can in fact just load it as an apk locally, and the achievements will work. (Again, actual IAB will not work.)

You must get it on playstore as a beta, and then load it that way.

AND you must be a registered beta tester on playstore for the app.

(And!!!!!!!! Don't forget, google actually charges you when you test it, you literally need your credit card / paypal / whatever all working to test purchases.) (You can instantly get a refund, but you must have credit card working so you can buy stuff for real on the playstore.)

Note that in contrast

with Apple iOS IAP, it's fine to build, sign and load locally from Xcode - you can then test Apple IAP that way. You do not have to wait for it to be on TestFlight. But not with Android!

So it's different on the two platforms.

Cloakanddagger answered 6/4, 2016 at 14:7 Comment(3)
Unity IAB still not working, if i downloading game from Playstore. What you mean, what it will not work? In my problem i cannot get the product via Unity inapp api. Just uninitialized. Important note: im trying to intergrate OpenIAB service and its work well Thanks you for answer!Decortication
ok, to be clear, you are actually putting the build up on playstore, and you are downloading it as a Beta? MUST BE A "BETA".Cloakanddagger
please click "Edit" in your question, and post a screenshot of your android, when you try to buy something ....Cloakanddagger
F
6

Okay, not to take away from @JoeBlow's answer, but there's some bad info in there and this was too long for a comment.

APK

You do need to have your APK in the Alpha OR Beta release channels, but you don't have to download it (personally, we use Alpha). You can sideload it no problem. The only issues are that the APK needs to be "validated" (an hour or two, or slightly longer if it's a new app) and the version that you're loading has to be the same - i.e. if you have version 1.0.0 on the App Store, then if you have 1.0.1 on your phone, you won't be able to buy anything, with a "Product unavailable" message.

So, if you upload a basic shell to get validated, you can continue to develop and load locally to get your implementation right.

Testers

In order to test your purchases, you need to have access to the Alpha/Beta channels. You can either do this by sharing a specific link with them (Open Alpha Testing), or by setting up a specific Google Group and having them confirm by visiting a specific URL (in the form https://play.google.com/apps/testing/YOUR_APP_ID).

They only need to do this once.

You can choose which system you want to use by clicking on the relevant tab in the "APK" section of your Google Play Developer Console.

BTW, this also means that if they have automatic updates enabled, then they will automatically get any updated APK that you've pushed to the channel - keep that in mind if you occasionally see weird behaviour when trying to use the production APK and you've a new version in Alpha

Paying for purchases

You can pay for them, and get an immediate refund, buy why when you can get them for free? :)

On your Google Play Developer Console, along the left you have the options "All Applications", "Game services", "Reports", "Settings", etc. Click "Settings", there's a section called "Licence testing". You can add email addresses here, and assuming the "Licence Test Response" is "RESPOND_NORMALLY", they won't be charged for the purchase - you'll see the message "This is a test order, you will not be charged" on the purchase popup, so you know it's in effect (adding or removing an email address can take a few minutes to update).

You'll still get an email like it's a normal purchase, but they'll show up with a price of €0.00 and a non-normal transaction ID and about 2 weeks later you get another one saying your payment has been cancelled.

You do need to have a valid payment option set up though.

Signing your application

As far as I know, you do need to build a signed APK when testing (i.e. not a debug one). I haven't really tested this, as we always build signed as a matter of course, so take that one with a pinch of salt.

Gotchas

The bad thing about this system, is that you can't purchase using the developer account - so if your Google Play account is [email protected], you'll have to use [email protected] to actually test it. It's one of those annoying things that Google does.

There's also the initial wait, as Google doesn't really tell you when your app is validated, so it's possible that you've gotten everything working, but purchases still won't pass because you the APK still isn't ready (whether shell or production). Worst case, upload it before you leave work/go to bed and it should be fine in the morning.

Fed answered 28/11, 2016 at 9:57 Comment(0)
C
5

OK, here's an amazing tip,

With google IAB, in fact, it will only work once you download it as a beta from the playstore, it will NOT work if you just load the .apk locally.

it's incredibly annoying, but that's how it is.

Note that - in contrast - when you are using PlayGames (to post achievements and so on), you can in fact just load it as an apk locally, and the achievements will work. (Again, actual IAB will not work.)

You must get it on playstore as a beta, and then load it that way.

AND you must be a registered beta tester on playstore for the app.

(And!!!!!!!! Don't forget, google actually charges you when you test it, you literally need your credit card / paypal / whatever all working to test purchases.) (You can instantly get a refund, but you must have credit card working so you can buy stuff for real on the playstore.)

Note that in contrast

with Apple iOS IAP, it's fine to build, sign and load locally from Xcode - you can then test Apple IAP that way. You do not have to wait for it to be on TestFlight. But not with Android!

So it's different on the two platforms.

Cloakanddagger answered 6/4, 2016 at 14:7 Comment(3)
Unity IAB still not working, if i downloading game from Playstore. What you mean, what it will not work? In my problem i cannot get the product via Unity inapp api. Just uninitialized. Important note: im trying to intergrate OpenIAB service and its work well Thanks you for answer!Decortication
ok, to be clear, you are actually putting the build up on playstore, and you are downloading it as a Beta? MUST BE A "BETA".Cloakanddagger
please click "Edit" in your question, and post a screenshot of your android, when you try to buy something ....Cloakanddagger

© 2022 - 2025 — McMap. All rights reserved.