This tutorial doesn’t mention for iOS you have to review and agree to the Paid App document in App Store Connect to get IAP to work at all on iOS. I was stuck on “No products available” for a while and on completing the document everything started working. Just an FYI in case anyone is having a similar issue
Oh So if I do a testflight and then IAP don't work it's because of the paid tax form ? I tried hundred of thing to no avail. Even submit my game and they refuse it saying the IAP did not work but never said why. IAP work when testing it with my Ipad and xCode storekit but thag's about it.
Yup, you are the absolute best! Best information ever, I stuck on that part for a week and even send a message to Unity forum asking, they tell me to uninstall IAP and stuff, wish I see this comment earlier so I don't have to deal with that stress lol
@@johndee2091yes most likely the tax form if everything else is set up correctly. Double check your implementation and the make sure you’ve completed the forms
Great tutorial, but unfortunately not for subscriptions! They no longer work the same as other In-App Purchases, especially Google changed their system (with multiple 'base plans' and 'offers' per subscription). Unity IAP seems not to work seamlessly with subscriptions. Do you have any advice/link for dealing with subscriptions with Unity in 2023? Or even better: please do a Tutorial for subscriptions with Unity in 2023!
great tutorial. How would i make a restore purchase button? and two only 3 of the 4 products show in the store. I am getting debug alerts stating everything was successfully loaded but only 3 Ui Products are being created
At 3:00, error: "You are not authorized to set the key." - There is no Legacy Analytics to toggle on an off. What helped for me: Insert the key in the Unity dashboard (as shown in the video in the previous step), restart Unity and logout as Unity user and login again. It took some minutes after it but then the error went away.
I LOVE YOU MAN! I did it but then I waited like an idiot for the error to go away so I wanna add that after doing everything you said, you need to insert the key again and then press "verify". I looked like that shocked O.O anime meme guy when it ended up working
1. Before uploading to the In-App Products tab you will need to set up your payment profile , you don't need to be registered as a legal company also 2. If you cannot get your csv file uploaded correctly (mine was saying there was no default language) , the only solution I found was to manually enter them into the In-app Products page
How do you implement a subscription-type IAP where the player gets charged monthly? Specifically, how can you check in your game if the player is still subscribed or if he uncubscribed in his phone settings and stop giving him the benefits of the subscription?
Can you help me? I follow your turtorial, I completed all the step, it works perfect on my laptop. When I move to my iphone, I manualy add all the product to app store. i get this error on my xcode logs : "Purchasing failed to initialize. Reason: NoProductsAvailable. More details: No product returned from the store.". Do i need to wait for my app aproved to test it on my iphone?
I think the main problem against this method is that you can't set global price which when you are using automatic unity purchasing(recommended) it setup for you automatically for all regions. Let's say initial price is 5EUR in many other countries it should be different.
when I click buy on my iPhone it doesn't open the typical apple wallet and allow Face ID to let me pay. Instead I just get a little prompt that asks me to type in my appleID email and password. Other games have the wallet appear with all the product information displayed in a nice interface. How can I get my in app purchases to look like this?
It works only with USD. If i give the price in the IAP Catalog in USD (I cannot set the currency anywhere, and it is always USD), the price on Google Play Store is wrong. If i give the price in my local currency (which is default by google, so i cannot change it), it shows an alarmingly large amount of USD in the App. Mildly infuriating.
wow muchas gracias no entendía para nada la funcionalidad de estos scripts hasta que vi tu video, por cierto para no escribir solo descargue los tuyos y los edite
One more question please X)), for purchasing in the real store, we only need to remove the two lines of 27:54?? or do we have to change something more? Thank you
As long as everything else on the store page is set up, all you should do is remove the “fake store” code and, based on the earlier implementation, should go to the correct “real store”
Man, I love the way you code, but coding the Ui to build itself (are you coming from a swift background) was a first time for me ! learned a lot about events and invoke()
In the HandleLoadIcon(AsyncOperation operation) function, the request = operation as ResourceRequest is always returning null and therefore not completing the rest of the shop setup. I've copied and pasted the code from github in case I typed it in incorrectly. Any help from anyone please T-T
I have a question, for example, If I make a purchase button for remove ads, or unlock more content, how does the state save for removing ads and unlocking more content? for example if user made the purchase and they uninstall the app from the phone and install back again, will the remove ads or, unlock more content considered purchase by the user and they don't have to buy again?
That is a good (and common) question. For persisting purchases you'll need some way to save it on the cloud. Apple and Google both (at least they used to) provide a small amount of cloud storage for your app for free. In there you could store small amounts of data such as "unlocked ad free" and pull that on app launch. In my game I had all the purchases synchronized to PlayFab, so whenever the user logged in, I pulled the data off PlayFab and knew their loadout, purchases, etc... For simpler use cases I think the Apple/Google services can suffice.
If I have a non consumable item like "remove ads", how can I manage that, once someone purchases it, set some variable inside the software to handle showing or not showing ads? thank you
I think you explained it perfectly 🙂. You check the product that was purchased, for this particular one, you set some boolean like hasPurchasedAds and persist that somewhere, such as the save file for the player, a cloud storage location, or even simply in PlayerPrefs (for initial testing at least).
@@LlamAcademy Hmmm, I think you can simply, in any place of your code, do a for loop in the catalog products and check the field "hasReceipt" of each one. That way you are always checking which items have receipt or not. I'm not 100% sure but I thinsk so.
Hello again! May I ask you for an advice? What is the best approach you have used so far for adding different entities to player? For instance, artifact and soft currency are not the same entities, they are different classes, different fields. For artifact it's obvious to set level and rarity, but for soft currency only amount. So, how do you typically handle purchase like at 24:50? Thank you in advance! And thank you very much for your impact in our learning process!
I can explain how I implemented this in my game and hopefully it provides some insight into how you can do it for your game. I used PlayFab which, upon login, I fetched the details about a player. This included information that you could store locally in a file such as the "inventory", different amounts of each "currency", and their stats. In my game I had unlockable items and currency available for purchase. When a player makes a purchase, I sent a request to PlayFab to validate a purchase and on the server there, I set "ItemXXX_Unlocked" to be true and sent a success message back to the mobile client. For more simple use cases such as only on-device unlocks, you can remove the network and server complexity and just set the boolean to true. Because my game had relatively few unlock items this was simple and worked well. If you have a large number of items, perhaps on each discrete item you would have an "Unlocked" boolean and set that based on the purchase. For currency, it is very simple because we just add the amount purchased to the player's "inventory". I only had 3 types of purchases, currency, item, or bundle which may include multiple items and/or currency. I implemented a purchase processing strategy based on the item type and either added currency, did the unlock as described above, or for the bundles, parsed the json "additional data" and used one of the other strategies for each element of the bundle.
not sure if I did something wrong, but for those making builds for IOS and google, remember to handle the fakestore, might need to do a #if to check if it's running in editor or development build, otherwise the fakestore will get carry over to real builds you uploaded.
I haven't specifically looked into that, but my understanding is you have your own server and call the google play or app store API with the token received on purchase complete.
Hi I'm currently following your tutorial and I'm in the Export To Google Play section, but on the Google Play Console it doesn't have export option. Instead there was this Message saying "Your app doesn't have any in-app products yet To add in-app products, you need to add the BILLING permission to your APK"
That usually means the version of your app that you uploaded did not include IAP. First build your game and upload it with Unity IAP in the game with no products, then it should start working for you.
Hello! Thanks for information! Very helpful video! Can you please answer, why do you load Texture2d from Resources, and noat a Sprite? Is this because optimisations reasons? Or because something else?
Nice video thank you, do you know how to handle new device ? If i change device and log again with same user , how to restore all purchases? Must be saved all on cloud save or the play/app store take care of that? For example if i have the "remove Ads" purchase item and i want to link that purchase to the google accunt.
Yeah for these you'll need some cloud save for the purchases. Another person was asking similarly for how to handle adding different entities to the player. I handled all this more or less the same way because for my game I used PlayFab so it was the "source of truth" for all player data. Regardless if the player is using 5 devices, any unlocks are stored on their account so they don't have to repurchase it.
That would be a totally separate system to support payments then. Unity IAP supports interfacing with a Store, but the Store is the one that actually processes the payments.
Hey Chris great video as usual. I was wondering can you do a video on how to setup azure for git inside of vs and an example of pushing code and assets from unity. Thanks in advance
Hey! Have you see this video? th-cam.com/video/vq5zuXBzlW8/w-d-xo.html I cover much of how to set up a git project on both Azure DevOps and GitHub and how I handle pushing code for solo projects in most cases.
In the Project Settings the update is saying you are not authorized will send an e-mail from unity to tell you Legacy Analytic is no longer working. instead it tells you to install the UGS Analytics SDK.
Hello, I am trying to figure out how to check if an item is consumable or none consumable this I don't think you covered that yet could you help me out on this pleases.
Hi! On the product, you specify if it is consumable or not. When processing the purchase it tells you which specific product was purchased along with the attributes, so you can find based on the product if it is consumable or not
I followed this guide but the payout is always null when I get the catalog item. Is this an issue with not having the Google Play key inside of Unity Dash yet?
If you are reading the IAP Catalog the payouts should always be present because it's there in the Product Catalog JSON file. Can you double check your code and configuration? Or maybe share your code?
@@LlamAcademy Still having this issue. I've realized my problem is in the builder, and it doesn't actually grab the payout there either. I've checked everything over quite a few times, so i'm pretty sure my code is fine, but ill share it if i really need to. My only thing i think it could be is the google play key, for whatever reason I can't add it, is that *required*? I wouldn't think so.
I still get the error "You are not authorized to set the license key" even after i toggle Legacy Analytics On/Off and i have already set it in the dashboard. Any help?
Hi i searched whole internet and cant find info, i have IAP integrated in Unity game that works fine on Google Play and AppStore but now i need it to work for Windows Store, what to do after switch to UWP for Windows Store, is there any changes to make in Codeless script except ID of iap item?? Any advice? Tnx
It should just be the ID and following the same kind of process to configure the UWP IAP items on their store. I haven't released on UWP/Windows Store so unfortunately I don't have any guidance on that side of things.
Iap button(lagacy) has been deprecated pls use codelss iap button instead, i keep getting this error, pls make a video on unity iap 4.93 and new iap button
I think for it to also work with Steam you would need to custom implement the Steam Store. Unity has provided implementations for App Store & Google Play Store but Steam is not supported out of the box.
Thanks a 1000 times for this great video! After adapting the code to my needs I had the problem that "private void HandlePurchaseComplete()" was never called. I guess I did sth wrong but maybe you want to double check if it really works as intended.
Hey! I'm glad you found it helpful. I did test this with a fully deployed test app and my own mobile game is even using this same paradigm. It is hard to say exactly what may be wrong, but you can always compare what you have against what's in the GitHub repository to see if there was something small missing!
Sorry, I don't have any experience with IronSource to be able to answer this. I set up UnityAds a few years ago but it may be different now that IronSource is in the mix
@@GameDeveloperTRDo you get any error or does it just give you an empty page? I had some errors when I didn't have the App Store version available on TestFlight yet.
Hello. I applied the tutorial to my own project. The internal test version does not make a real purchase. It opens the fake store just like in the editor. How can I make a real purchase?
You will need to disable/undo the fake store code we put in late in the video and initialize it with the real store. We initialized with a fake store just for the demo.
I set up “bundles” as items that granted currency and items. In the “data” field where you can specify arbitrary data, I put JSON for how much currency, and which items should be unlocked. Then when processing bundles, I would parse that data and add currency or unlock items.
I don't think Photon and IAP have much to do with one another. Maybe you would do server-side validation of an IAP receipt and validate it. I did not cover that piece here, but you can read more about the receipt validation here: docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html
I believe For WebGL you will have to implement your own store (can’t use the Unity-provided Store implementation for google play / App Store since you’re not on that store). This concept can still be used but there is more work involved
I got everything working but still a bit confused on how the PurchaseProcessingResult works. I followed your "Learn how to persist data in your game" tutorial. If the user goes on a new device how would they reload what they have bought? Any docs on this as my searches are pulling up nothing. Is there some built in way for android and apple to reload the data from last device played? Also your link for "Learn how to persist data in your game" is not working. Thanks for the videos. Last two weeks keeping getting your videos shown when looking for solutions.
Hey 👋 For persisting data across devices you'd need some system to "back up" what the user has purchased. In my game I was using PlayFab as the backend that, if you purchased anything, it was automatically persisted because I stored the user's "inventory" on PlayFab and all purchases were to grant currency or unlock items. Depending on your game, you could use a similar process, or even just persist a data file on the Google or Apple services so they're tied to the user's account. Once the user logs in you could pull that data and automatically they would get the majority of purchases back.
@@LlamAcademy hey, could you please elaborate the process on " persist a data file on the Google or Apple services so they're tied to the user's account" ? How's this service called, so I can gather more information about this on the internet?
Sorry for the delay here. Google Play Services and Apple Game Center. You have to opt-in to those and do some set up which you can see on the Google Play Console / App Store Connect. Each comes with their own SDK and you can choose which features to use and enable.
Is there a way to verify the purchase on my own server? Im using my own server databases to store item data so I want to avoid any potential cheating on the client side. Maybe some kind of reciept that verifies a transaction has been made?
Google and Apple both have server side receipt validation: docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html You can implement your own receipt validator to do whatever you need to on your side. When I implemented this, I did not do server validation, but you can wait for the validation to apply whatever changes should be there for the purchase
@@LlamAcademy Thanks, Solved it with googles verification api for python. Although it was waay too complicated to setup. Too many steps and no solid info anywhere. Seems like a good idea for a future tutorial if you need one! :)
For Whatever reason I get error "Purchase not correctly processed for product "myProductName". Add an active IAPButton to process this purchase, or add an IAPListener to receive any unhandled purchase events." I have "Initialize Unity.Purchasing automatically" unticked. And I don't have any IAPButtons or IAPListeners in my scene, cause mixing Codeless IAP and Coded one is strictly not advised. But it only works with "Initialize Unity.Purchasing automatically" ticked and actually refers to my IStoreListener (But UnityPurchasing.Initialize() does the same thing). My custom buttons use the same editor functionality as IAPButton has (not to input string manually but to choose id from catalog directly). But I don't believe this is the case. Has anyone faced the same kind of problem? Anyway thank you very much! It's a great introduction to Coded IAP.
I don't know if you already solved it, but the error is in that the dictionary is not created well, what you can do is to initialize it at the moment of entering to the Initialiaze method, it would be something like this: public static Dictionary Icons { get; private set; } public static void Initialize(ProductCollection products) { Icons = new Dictionary(); if (Icons.Count == 0) { Debug.Log($"Loading store icon for {products.all.Length} products."); TargeticonCount = products.all.Length; foreach (Product product in products.all). { Debug.Log($"Loading store icon in path StoreIcons/{product.definition.id}"); ResourceRequest operation = Resources.LoadAsync($"StoreIcons/{product.definition.id}"); operation.completed += HandleLoadIcon; } } else { Debug.LogError("StoreIconProvider has already been initialized!"); } }
also, not sure if this happened to you, after fixing the dictionary, I ran into the error: MissingReferenceException: The object of type 'DemoStorePage' has been destroyed but you are still trying to access it. What I did is add a function of OnDestroy: void OnDestroy() { StoreIconProvider.OnLoadComplete -= HandleAllIconsLoaded;
Great video. I have recently been thinking about adding cosmetic purchases to the game I am making. My game will be a browser game, played through the WebGL export however. What would be the differences between what you showed here and creating IAP purchases for WebGL? Or would you need to use a different system then Unity IAP entirely?
For WebGL, I think you can do the same process here, but you’d have to implement a custom store like they define here: docs.unity3d.com/Manual/UnityIAPImplementingAStore.html Which is totally doable, but it becomes fully your responsibility to do the integration with Shopify or whatever store you’re trying to use on WebGL.
When I try to upload the csv to Google Play, I get the error: Row 2: Missing the listing for the default language. It shows that for every row. the selected language in unity is the default: English (US). Do you know how to fix that?
You are responsible to pay users out if you want to give them real currency. Even with Unity IAP, Unity does not collect the money. They're just providing a layer of abstraction over each of the stores that actually handles the purchasing and billing.
𝗡𝗲𝗲𝗱 𝗛𝗲𝗹𝗽 I pasted the id from the google play store but it gave an error "You are not authorized to set the license key" and then I go to the Legacy Analytics to make it work. But however I don't have Legacy Analytics in the sections or services. I tried to download it from the Package Manager but it was not there. I need help.
This tutorial doesn’t mention for iOS you have to review and agree to the Paid App document in App Store Connect to get IAP to work at all on iOS. I was stuck on “No products available” for a while and on completing the document everything started working. Just an FYI in case anyone is having a similar issue
I face same problem can you please tell me how to solve
Oh So if I do a testflight and then IAP don't work it's because of the paid tax form ? I tried hundred of thing to no avail. Even submit my game and they refuse it saying the IAP did not work but never said why. IAP work when testing it with my Ipad and xCode storekit but thag's about it.
Yup, you are the absolute best! Best information ever, I stuck on that part for a week and even send a message to Unity forum asking, they tell me to uninstall IAP and stuff, wish I see this comment earlier so I don't have to deal with that stress lol
@@johndee2091yes most likely the tax form if everything else is set up correctly. Double check your implementation and the make sure you’ve completed the forms
@@rexbefall99 Thank you :)
Great tutorial, but unfortunately not for subscriptions! They no longer work the same as other In-App Purchases, especially Google changed their system (with multiple 'base plans' and 'offers' per subscription). Unity IAP seems not to work seamlessly with subscriptions. Do you have any advice/link for dealing with subscriptions with Unity in 2023? Or even better: please do a Tutorial for subscriptions with Unity in 2023!
great tutorial.
How would i make a restore purchase button? and two only 3 of the 4 products show in the store. I am getting debug alerts stating everything was successfully loaded but only 3 Ui Products are being created
Thanks for your Great tutorial!
At 3:00, error: "You are not authorized to set the key." - There is no Legacy Analytics to toggle on an off. What helped for me: Insert the key in the Unity dashboard (as shown in the video in the previous step), restart Unity and logout as Unity user and login again. It took some minutes after it but then the error went away.
I LOVE YOU MAN! I did it but then I waited like an idiot for the error to go away so I wanna add that after doing everything you said, you need to insert the key again and then press "verify". I looked like that shocked O.O anime meme guy when it ended up working
Great that it worked for you too! Yes, you have to click the button again.
sir i logOut User , restart unity, login Again, did some wait , but still i face this issue that you are not authorized to set licency key
@@abdulhaseebkhan1177 Did you get the app key on Google play and insert it in the Unity dashboard first?
@@monkegames6133 yes i did.
1. Before uploading to the In-App Products tab you will need to set up your payment profile , you don't need to be registered as a legal company also
2. If you cannot get your csv file uploaded correctly (mine was saying there was no default language) , the only solution I found was to manually enter them into the In-app Products page
How do you implement a subscription-type IAP where the player gets charged monthly? Specifically, how can you check in your game if the player is still subscribed or if he uncubscribed in his phone settings and stop giving him the benefits of the subscription?
Can you help me? I follow your turtorial, I completed all the step, it works perfect on my laptop. When I move to my iphone, I manualy add all the product to app store. i get this error on my xcode logs : "Purchasing failed to initialize. Reason: NoProductsAvailable. More details: No product returned from the store.". Do i need to wait for my app aproved to test it on my iphone?
I think the main problem against this method is that you can't set global price which when you are using automatic unity purchasing(recommended) it setup for you automatically for all regions. Let's say initial price is 5EUR in many other countries it should be different.
Did you find a way, struggling with that now
the product ui shows up in the editor, but not on the google play export. Any advice?
Thank you!
You're welcome!
when I click buy on my iPhone it doesn't open the typical apple wallet and allow Face ID to let me pay. Instead I just get a little prompt that asks me to type in my appleID email and password. Other games have the wallet appear with all the product information displayed in a nice interface. How can I get my in app purchases to look like this?
It works only with USD. If i give the price in the IAP Catalog in USD (I cannot set the currency anywhere, and it is always USD), the price on Google Play Store is wrong. If i give the price in my local currency (which is default by google, so i cannot change it), it shows an alarmingly large amount of USD in the App. Mildly infuriating.
Thx for sharing a project on git
thnx a lot!!
wow muchas gracias no entendía para nada la funcionalidad de estos scripts hasta que vi tu video,
por cierto para no escribir solo descargue los tuyos y los edite
Hola, amigo te ha funcionado el código correctamente? es decir ya lo probaste?
One more question please X)), for purchasing in the real store, we only need to remove the two lines of 27:54??
or do we have to change something more? Thank you
As long as everything else on the store page is set up, all you should do is remove the “fake store” code and, based on the earlier implementation, should go to the correct “real store”
Man, I love the way you code, but coding the Ui to build itself (are you coming from a swift background) was a first time for me ! learned a lot about events and invoke()
I haven’t used Swift. Glad to hear you’re enjoying it though!
In the HandleLoadIcon(AsyncOperation operation) function, the request = operation as ResourceRequest is always returning null and therefore not completing the rest of the shop setup. I've copied and pasted the code from github in case I typed it in incorrectly. Any help from anyone please T-T
I am still unable to verify options in In-App Purchasing .Even I On and Off the Legacy Analytics😟😟😟
What do you mean by verify options? You get an error when initializing?
I have a question, for example, If I make a purchase button for remove ads, or unlock more content, how does the state save for removing ads and unlocking more content? for example if user made the purchase and they uninstall the app from the phone and install back again, will the remove ads or, unlock more content considered purchase by the user and they don't have to buy again?
That is a good (and common) question. For persisting purchases you'll need some way to save it on the cloud. Apple and Google both (at least they used to) provide a small amount of cloud storage for your app for free. In there you could store small amounts of data such as "unlocked ad free" and pull that on app launch.
In my game I had all the purchases synchronized to PlayFab, so whenever the user logged in, I pulled the data off PlayFab and knew their loadout, purchases, etc...
For simpler use cases I think the Apple/Google services can suffice.
If I have a non consumable item like "remove ads", how can I manage that, once someone purchases it, set some variable inside the software to handle showing or not showing ads? thank you
I think you explained it perfectly 🙂. You check the product that was purchased, for this particular one, you set some boolean like hasPurchasedAds and persist that somewhere, such as the save file for the player, a cloud storage location, or even simply in PlayerPrefs (for initial testing at least).
@@LlamAcademy Hmmm, I think you can simply, in any place of your code, do a for loop in the catalog products and check the field "hasReceipt" of each one. That way you are always checking which items have receipt or not. I'm not 100% sure but I thinsk so.
What should I do if I already have the catalog setup in Apple? How can I import it in Unity?
I would like to see subscription product implementation
Quick question -> how could i have the currency change due to different locations, i have noticed this on most games.
Payouts are essentials? Just leave it blank and manually give item from code?
i get the price in my local currency 4.99 INR in google play console how to set it global
i get null refrences when i try to access the payout quantity on the ProcessPurchase Function when im trying to handle giving the player the product
When uploading google play csv I get an error "Missing the listing for the default language"
Me too
You need to ad a translation in your default Language
Hello again! May I ask you for an advice? What is the best approach you have used so far for adding different entities to player? For instance, artifact and soft currency are not the same entities, they are different classes, different fields. For artifact it's obvious to set level and rarity, but for soft currency only amount. So, how do you typically handle purchase like at 24:50? Thank you in advance! And thank you very much for your impact in our learning process!
I can explain how I implemented this in my game and hopefully it provides some insight into how you can do it for your game.
I used PlayFab which, upon login, I fetched the details about a player. This included information that you could store locally in a file such as the "inventory", different amounts of each "currency", and their stats.
In my game I had unlockable items and currency available for purchase.
When a player makes a purchase, I sent a request to PlayFab to validate a purchase and on the server there, I set "ItemXXX_Unlocked" to be true and sent a success message back to the mobile client.
For more simple use cases such as only on-device unlocks, you can remove the network and server complexity and just set the boolean to true. Because my game had relatively few unlock items this was simple and worked well. If you have a large number of items, perhaps on each discrete item you would have an "Unlocked" boolean and set that based on the purchase.
For currency, it is very simple because we just add the amount purchased to the player's "inventory".
I only had 3 types of purchases, currency, item, or bundle which may include multiple items and/or currency. I implemented a purchase processing strategy based on the item type and either added currency, did the unlock as described above, or for the bundles, parsed the json "additional data" and used one of the other strategies for each element of the bundle.
not sure if I did something wrong, but for those making builds for IOS and google, remember to handle the fakestore, might need to do a #if to check if it's running in editor or development build, otherwise the fakestore will get carry over to real builds you uploaded.
FYI - You can not import unless your APK already has IAP implemented. 9:10
hi did you know how to make server side checking when purchase complete?
I haven't specifically looked into that, but my understanding is you have your own server and call the google play or app store API with the token received on purchase complete.
Hi I'm currently following your tutorial and I'm in the Export To Google Play section, but on the Google Play Console it doesn't have export option. Instead there was this Message saying "Your app doesn't have any in-app products yet
To add in-app products, you need to add the BILLING permission to your APK"
That usually means the version of your app that you uploaded did not include IAP. First build your game and upload it with Unity IAP in the game with no products, then it should start working for you.
@@LlamAcademy thank you very much for the quick reply, I'll look into it
@@LlamAcademy Thanks bro! that solved my issue.
Hello! Thanks for information! Very helpful video! Can you please answer, why do you load Texture2d from Resources, and noat a Sprite? Is this because optimisations reasons? Or because something else?
I found it easier to put the textures there and create the sprite, but if you load a sprite from the resources folder it should work the same.
how can i do a subscription iap for my unity game i need help!!!!!
Do they code the Ui in professional environments, this is a new thing for me haha nice tutorial!
When you need Dynamic UIs, sometimes it just makes sense 🙂
I wish Apple supports the IAP xml. For small game it's ok to use AppStore but for big game setup 50-100 products at a time is driving me mad.
Me too :( very sad they stopped having an upload mechanism.
Nice video thank you, do you know how to handle new device ? If i change device and log again with same user , how to restore all purchases? Must be saved all on cloud save or the play/app store take care of that? For example if i have the "remove Ads" purchase item and i want to link that purchase to the google accunt.
Yeah for these you'll need some cloud save for the purchases. Another person was asking similarly for how to handle adding different entities to the player. I handled all this more or less the same way because for my game I used PlayFab so it was the "source of truth" for all player data. Regardless if the player is using 5 devices, any unlocks are stored on their account so they don't have to repurchase it.
it keeps saying i amnot authorize to set the liscense key, and ive tried everything
Same, did you fix it?
@@LostSol25 nah ... I guess it's a bug because it doesn't affect the build whatsoever the IAP still works fine
What if I wanted to implement crypto payments in-app?
That would be a totally separate system to support payments then. Unity IAP supports interfacing with a Store, but the Store is the one that actually processes the payments.
I met failure says store initialize failed, I checked both at true (auto initialize) at unity catalog. Is it reason?
Hey Chris great video as usual. I was wondering can you do a video on how to setup azure for git inside of vs and an example of pushing code and assets from unity. Thanks in advance
Hey! Have you see this video?
th-cam.com/video/vq5zuXBzlW8/w-d-xo.html I cover much of how to set up a git project on both Azure DevOps and GitHub and how I handle pushing code for solo projects in most cases.
how to use with pricing template
In the Project Settings the update is saying you are not authorized will send an e-mail from unity to tell you Legacy Analytic is no longer working. instead it tells you to install the UGS Analytics SDK.
2:00 😉
getting error you are not verified to verfy key
At 15:22 using a capital E "ExtensionProvider" created an error at 15:32. I used "private IExtensionProvider extensionProvider;" instead.
Glad you got it working!
Hello, I am trying to figure out how to check if an item is consumable or none consumable this I don't think you covered that yet could you help me out on this pleases.
Hi! On the product, you specify if it is consumable or not. When processing the purchase it tells you which specific product was purchased along with the attributes, so you can find based on the product if it is consumable or not
Does the tutorial provide receipt validation ?
I briefly mention what you need from the Unity IAP package to do it, but I do not cover exactly how to handle receipt validation in this video.
I followed this guide but the payout is always null when I get the catalog item. Is this an issue with not having the Google Play key inside of Unity Dash yet?
If you are reading the IAP Catalog the payouts should always be present because it's there in the Product Catalog JSON file. Can you double check your code and configuration? Or maybe share your code?
@@LlamAcademy Still having this issue. I've realized my problem is in the builder, and it doesn't actually grab the payout there either. I've checked everything over quite a few times, so i'm pretty sure my code is fine, but ill share it if i really need to. My only thing i think it could be is the google play key, for whatever reason I can't add it, is that *required*? I wouldn't think so.
I still get the error "You are not authorized to set the license key" even after i toggle Legacy Analytics On/Off and i have already set it in the dashboard. Any help?
Make sure now that both Legacy Analytics and IAP are turned ON and try to restart the editor to see if that helps
@@LlamAcademy i get an email that Legacy Analytics is no longer in use every time i try to turn it on. But ill try that and see how it goes
@@LlamAcademy I restarted the project and the Lecagy Analytics window is gone and am still getting the error. Any advice?
Which version of Unity are you using 2021?
@@LlamAcademy 2021.3.6f1
Hi i searched whole internet and cant find info, i have IAP integrated in Unity game that works fine on Google Play and AppStore but now i need it to work for Windows Store, what to do after switch to UWP for Windows Store, is there any changes to make in Codeless script except ID of iap item?? Any advice? Tnx
It should just be the ID and following the same kind of process to configure the UWP IAP items on their store. I haven't released on UWP/Windows Store so unfortunately I don't have any guidance on that side of things.
@@LlamAcademy thanks, i will try then.
Iap button(lagacy) has been deprecated pls use codelss iap button instead, i keep getting this error, pls make a video on unity iap 4.93 and new iap button
I checked out the documentation, there is very little difference between the two. Did you try using the other button?
can this work on steam as well?
I think for it to also work with Steam you would need to custom implement the Steam Store. Unity has provided implementations for App Store & Google Play Store but Steam is not supported out of the box.
Thanks a 1000 times for this great video! After adapting the code to my needs I had the problem that "private void HandlePurchaseComplete()" was never called. I guess I did sth wrong but maybe you want to double check if it really works as intended.
Hey! I'm glad you found it helpful. I did test this with a fully deployed test app and my own mobile game is even using this same paradigm. It is hard to say exactly what may be wrong, but you can always compare what you have against what's in the GitHub repository to see if there was something small missing!
Do you know if this can be managed via IronSource API? I have ads managed with it and would be nice if you can also manage In App Purchases
Sorry, I don't have any experience with IronSource to be able to answer this. I set up UnityAds a few years ago but it may be different now that IronSource is in the mix
Placeholders (sold items) do not come on iphone. what could be the reason for this?
I'm not sure I understand this question. You mean you can't view already purchased items?
@@LlamAcademy While iap store is displayed properly on android devices, items sale are not displayed/loaded on IOS devices.
@@GameDeveloperTRDo you get any error or does it just give you an empty page? I had some errors when I didn't have the App Store version available on TestFlight yet.
Hello. I applied the tutorial to my own project. The internal test version does not make a real purchase. It opens the fake store just like in the editor. How can I make a real purchase?
You will need to disable/undo the fake store code we put in late in the video and initialize it with the real store. We initialized with a fake store just for the demo.
@@LlamAcademy Thank you. You've been very helpful. respect
Is there a way to assign directly a SetupModel quantity to give goods after we succed to buy currency
I set up “bundles” as items that granted currency and items. In the “data” field where you can specify arbitrary data, I put JSON for how much currency, and which items should be unlocked. Then when processing bundles, I would parse that data and add currency or unlock items.
@@LlamAcademy why make this such overcomplicated? Can't I just providing it directly into OnPurchaseProcessing ()? Like using switch statement?
Hello , Is this how it is done for Photon?
I don't think Photon and IAP have much to do with one another. Maybe you would do server-side validation of an IAP receipt and validate it. I did not cover that piece here, but you can read more about the receipt validation here: docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html
@@LlamAcademy So can you make a video about it? Difficult to find help online
Does this work for webgl?
I believe For WebGL you will have to implement your own store (can’t use the Unity-provided Store implementation for google play / App Store since you’re not on that store). This concept can still be used but there is more work involved
I got everything working but still a bit confused on how the PurchaseProcessingResult works. I followed your "Learn how to persist data in your game" tutorial.
If the user goes on a new device how would they reload what they have bought? Any docs on this as my searches are pulling up nothing. Is there some built in way for android and apple to reload the data from last device played?
Also your link for "Learn how to persist data in your game" is not working.
Thanks for the videos. Last two weeks keeping getting your videos shown when looking for solutions.
Hey 👋 For persisting data across devices you'd need some system to "back up" what the user has purchased. In my game I was using PlayFab as the backend that, if you purchased anything, it was automatically persisted because I stored the user's "inventory" on PlayFab and all purchases were to grant currency or unlock items.
Depending on your game, you could use a similar process, or even just persist a data file on the Google or Apple services so they're tied to the user's account. Once the user logs in you could pull that data and automatically they would get the majority of purchases back.
@@LlamAcademy hey, could you please elaborate the process on " persist a data file on the Google or Apple services so they're tied to the user's account" ? How's this service called, so I can gather more information about this on the internet?
Sorry for the delay here. Google Play Services and Apple Game Center. You have to opt-in to those and do some set up which you can see on the Google Play Console / App Store Connect. Each comes with their own SDK and you can choose which features to use and enable.
its saying that I need to add permission for BILLING in the SDK when trying to upload the csv file into google play store
Just got it! You need to upload a version with the new In app purchase package. If he said that, I am sorry
glad you got it working!
how do i update the IAPProductcatalog.json file?
This is generated by making changes in the inspector like we did early in the video.
Is there a way to verify the purchase on my own server? Im using my own server databases to store item data so I want to avoid any potential cheating on the client side. Maybe some kind of reciept that verifies a transaction has been made?
Google and Apple both have server side receipt validation: docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html
You can implement your own receipt validator to do whatever you need to on your side. When I implemented this, I did not do server validation, but you can wait for the validation to apply whatever changes should be there for the purchase
@@LlamAcademy Thanks, Solved it with googles verification api for python. Although it was waay too complicated to setup. Too many steps and no solid info anywhere. Seems like a good idea for a future tutorial if you need one! :)
For Whatever reason I get error "Purchase not correctly processed for product "myProductName". Add an active IAPButton to process this purchase, or add an IAPListener to receive any unhandled purchase events."
I have "Initialize Unity.Purchasing automatically" unticked. And I don't have any IAPButtons or IAPListeners in my scene, cause mixing Codeless IAP and Coded one is strictly not advised. But it only works with "Initialize Unity.Purchasing automatically" ticked and actually refers to my IStoreListener (But UnityPurchasing.Initialize() does the same thing). My custom buttons use the same editor functionality as IAPButton has (not to input string manually but to choose id from catalog directly). But I don't believe this is the case. Has anyone faced the same kind of problem? Anyway thank you very much! It's a great introduction to Coded IAP.
Well, the answer is obvious. The order is important. You have to wait until unity services initialize before calling UnityPurchasing.Initialize() 😁
😁 glad you figured it out, and thank you for sharing the answer as well!
Is there any option to lower down the minimum android API requirements in the play store?
You can have a lower minimum version, but the target must be the latest one Google requires. These two drop downs do not have to be the same number.
I get an "StoreIconProvider has already been initialized!" error when I reset the scene. can ı help you?
I don't know if you already solved it, but the error is in that the dictionary is not created well, what you can do is to initialize it at the moment of entering to the Initialiaze method, it would be something like this:
public static Dictionary Icons { get; private set; }
public static void Initialize(ProductCollection products)
{
Icons = new Dictionary();
if (Icons.Count == 0)
{
Debug.Log($"Loading store icon for {products.all.Length} products.");
TargeticonCount = products.all.Length;
foreach (Product product in products.all).
{
Debug.Log($"Loading store icon in path StoreIcons/{product.definition.id}");
ResourceRequest operation = Resources.LoadAsync($"StoreIcons/{product.definition.id}");
operation.completed += HandleLoadIcon;
}
}
else
{
Debug.LogError("StoreIconProvider has already been initialized!");
}
}
You are a life saver!@@EdgarRdzG09
also, not sure if this happened to you, after fixing the dictionary, I ran into the error: MissingReferenceException: The object of type 'DemoStorePage' has been destroyed but you are still trying to access it.
What I did is add a function of OnDestroy:
void OnDestroy() {
StoreIconProvider.OnLoadComplete -= HandleAllIconsLoaded;
}
this solve my problem, hope this is helpful😃
Great video. I have recently been thinking about adding cosmetic purchases to the game I am making. My game will be a browser game, played through the WebGL export however. What would be the differences between what you showed here and creating IAP purchases for WebGL? Or would you need to use a different system then Unity IAP entirely?
For WebGL, I think you can do the same process here, but you’d have to implement a custom store like they define here: docs.unity3d.com/Manual/UnityIAPImplementingAStore.html
Which is totally doable, but it becomes fully your responsibility to do the integration with Shopify or whatever store you’re trying to use on WebGL.
When I try to upload the csv to Google Play, I get the error: Row 2: Missing the listing for the default language.
It shows that for every row. the selected language in unity is the default: English (US). Do you know how to fix that?
Strange one. Can you try to update the value of the dropdown to something other than english, then change it back to see if it resolves it?
Having the same problem. Did you find a fix?
Same problem here
Had the same problem
You need to ad a translation in your default Language
I hyperventilate every time see someone using PascalCase for the variable names
use camelCase or snake_case or anything but that. It's so easy to confuse a variable with a class/struct type that way.
👀🙃
Olá, quero rodar um joguinho quem fica responsável pelos pagamento aos jogadores? Sou eu ou o Unity?
You are responsible to pay users out if you want to give them real currency. Even with Unity IAP, Unity does not collect the money. They're just providing a layer of abstraction over each of the stores that actually handles the purchasing and billing.
𝗡𝗲𝗲𝗱 𝗛𝗲𝗹𝗽
I pasted the id from the google play store but it gave an error "You are not authorized to set the license key" and then I go to the Legacy Analytics to make it work. But however I don't have Legacy Analytics in the sections or services. I tried to download it from the Package Manager but it was not there. I need help.
Does not work on mobile. Stucks on " UnityPurchasing.Initialize(this, builder);"
What error do you get?
@@LlamAcademy np errors. Fixed by moving next operators to OnInitialized and enabling auto-initialization
@@laniakeadev.2271 oh, great! I'm glad you got it working!