I am making a WebGL game for Facebook canvas. I want to use Unity IAP to handle Facebook payments. I know that Unity IAP doesn’t support Facebook store, but the documentation has a whole section on implementing a new store:
So, before I jump in to implement Facebook store for Unity IAP myself, has anyone already done that and is willing to share the code? Pretty please!
Unity IAP supports Facebook Canvas “Payments Lite” when used with Facebook Gameroom (native and WebGL.) That support is currently in beta (see the Gameroom site for details) and will be officially launched with Unity 5.6.
Unity IAP for Facebook uses Canvas Payments but requires that you select the “serverless” Payments Lite option on the Canvas Payments page. Unity WebGL games using Canvas Hosting with Payments Lite work fine in our browser-based testing (and also run in the Gameroom client.) If you are hosting the game on your own server then Unity IAP should still work from the browser, but will require some additional configuration on the app settings in Facebook.
Canvas Payments using Webhooks is not currently planned for Unity IAP.
Hi, using 5.6b10 Mac and installing the Unity IAP directly downloaded from Facebook Gameroom page I first encountered problems with the previous UNITY IAP installation specifically IAPButton scripts, but seeing I wasn’t using code less IAP implementation I just commented out those which gave errors. Testing build in Gameroom my IAP’s all return successful without any Dialogs appearing using test users?
So I took it that I don’t have to implement FB.Canvas.Pay and using normal Unity IAP code as i do for every other platform would do the job for me?
Do i have to build and test IAP’s using Development Build in Build Settings?
Is it essential I ‘Create Test App’ in Facebook dashboard for testing?
Using Development Build within unity Build Settings and Using A Test user Brings up ‘Select Payment Method’ dialog with IAP details set as ‘Always Succeeds’
Clicking Buy brings up Alert ‘Sorry something went wrong and your payment couldn’t be completed’
any idea’s to what’s wrong?
Should I not select and build a Development Build for final release and submission?
These are all questions that of course once you have working once it all seems so logical but i’ve had to do numerous experiments and sourcing answers through multiple web searches and narrowing down.
You are correct, you do not need to call FB.Canvas.Pay() in your code and your existing Unity IAP code should suffice as long as the product IDs are set correctly. You do not need to use a Development Build and you do not need to create a Facebook Test App.
Key things to check are that Payments Lite is enabled (looks like Canvas Payments is now Web Payments on the sidebar) and that you have Testers defined (to avoid charges while testing.)
The fact that you weren’t seeing any dialogs suggest that something else was wrong in the setup but would need to see logs to narrow that down. Which platform (Gameroom Windows or WebGL) were you using when the dialog didn’t apepar?
Using a Development Build shouldn’t change anything with respect to IAP so it could just be a matter of settings changes propagating through FB to get the Payments Lite enabled on your app. The ‘Always Succeeds / Always Fails’ option in the dialog means you’re on a test user so that part is working correctly.
The “Sorry something went wrong…” message is what I’ve seen when you attempt to re-purchase a non-consumable item. The Payments Lite “Products” setup doesn’t actually have a concept of consumables vs. non-consumables. Unity IAP will use the Product Type from when you AddProduct() to decide how to manage items coming from Facebook.
Thanks for your reply that clears up some things for me, the mind does wander off in crazy directions when things don’t work.
I have 7 in-apps set up in my store and for only 2 of them when i first click on them i get no purchase dialog just a Facebook error ‘Couldn’t complete purchase. We didn’t receive all the information we needed from this app complete your purchase’
I verified both in-app product ID’s by trying to create another and says already used.
Have you come across this before?
I have a total of 8 in-apps setup in unity 7 of which are Consumable and the 8th like you say set up as NonComsumable.
Do i consider everything is fine, just under test conditions it’s falling over and just submit for public release?
I don’t recall seeing that error message before – is the error text appearing in a dialog/popup or in the player log? If you can DM me a copy of the player log there may be something useful there.
OK, then a log would be useful to get a little extra detail on what the server is reporting. For the Gameroom client the logs appear under Users\Public\Facebook Games\appid\version\appid_Data\output_log.txt
Also, do you recall if you updated the Facebook SDK version in Player Settings? 5.6b10 would default to using Facebook SDK 7.9.1 but should show 7.9.4 as available in the Build… dialog and Player Settings. You want to be on 7.9.4 (but that shouldn’t be causing this error message.)
Do you know if Facebook in regards to Payments through Gameroom are having any problems?
Paypal seems to get caught in endless processing loop after signing into PayPal and clicking confirm. I have to force close and abandon so i guess users are doing the same, Im seeing say 100 users Start Purchase 20 cancel and the rest uncounted for guessing they did what i did and have to force close payment as it doesn’t process?
Now of course only a small fraction of users going through the payment process actually buy thats common sense but my experience of using PayPal through gameroom leads me to think they are still working of things behind the scene as I paid for my own IAP using a debit card and worked so UNITY’s IAP must be set up ok thou still having problems with 2 IAP’s reporting error pop up in Gameroom saying ‘Couldn’t complete purchase. We didn’t receive all the information we needed from this app complete your purchase’, maybe my IAP item identifier Facebook just doesn’t like its a mystery that probably if i setup another IAP with a different ID then all will be fine but is a pain.
They need also to implement that when a user attempts to purchase a IAP and isn’t signed into Facebook they prompt the user to do so, first thought is you have to be signed into Facebook to use Gameroom but if you are say signed into another Facebook account in the web browser or not signed in at all seems to cause no response or dialogs appear when attempting to purchase within gameroom just nothing happens and could be improved.
For this issue is the application set up to use Web Payments / Payments Lite? Can you provide additional log text from prior to the purchase attempt? This sounds like either the app is set up for webhooks-based payments or something is otherwise wrong with your available products or InitiatePurchase()
Unity IAP should be prompting the user to log into Facebook if they’ve somehow gotten into a state where they’re not logged in (shouldn’t happen with Gameroom now I think) so if you can reproduce that case we should investigate further. WRT PayPal purchases I have not tested it recently but have successfully used it in the past. Is this happening on both the Windows Gameroom client and WebGL?
I’m using Payments Lite for my IAP. I think I’m initializing it correctly since I’m able to retrieve the data correctly for the items from my Facebook definition.
There are some updates underway from the Facebook team that may address this problem. I know that one of them is already live but I think the other is still under review. I would suggest giving your test another try later today and tomorrow to see if behavior changes.
The Unity IAP plugin available from the Gameroom site has had some debug removed – we can provide a debug build if it looks like we need to dig further into the Facebook server responses. Alternatively, if you’re comfortable with using Facebook’s Graph API Explorer I can give you some requests to try there to confirm product details.