playMaker

Author Topic: In App Purchases iOS & Android  (Read 22992 times)

foxhideous

  • Playmaker Newbie
  • *
  • Posts: 8
Re: In App Purchases iOS & Android
« Reply #15 on: April 06, 2014, 10:23:31 AM »
Thanks for the update, I'll try to test it out when I fix my in-app purchases.

The confusion I'm having is about the procedures on how IAP is meant to execute. This is how it is setup now:

You press the (BUY) button then it goes to:

1)"Request Product Data" <---- does this need to execute everytime? If I have X amount of different items to buy, should it be on every BUY button?

2)"Get Can Make Payments" <---- is this necessary? does it get the bool from Apple or from the iphone?

3)"Purchase Product"

Hope you can shed some light on best practices regarding IAP.

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: In App Purchases iOS & Android
« Reply #16 on: April 06, 2014, 02:00:23 PM »
Request Product Data should only be called once in your entire application. Think of it is a init. List ALL of your products in the action then call it on game start.

Get Can make payments is not really necessary. I just gave you the actions that Prime31 made available to me. Though I do know from experience that if your game is launched in certain countries only and someone got a hold of your game somehow from a different country they may not be able to make purchases because they are not in that country.

Purchase product is what actually purchases the product.



So it goes

Game Start: Call Init and Request product data

Press buy Button: Purchase Product.

It is as simple as those 2/3 actions. You can call Get Can Make payments if you want to make sure. But it will not change from product to product. So you could call it at the start of your game and then just keep the variable in mind.

foxhideous

  • Playmaker Newbie
  • *
  • Posts: 8
Re: In App Purchases iOS & Android
« Reply #17 on: April 07, 2014, 01:20:13 PM »
It seems like the modified RequestProductData.cs and StoreKitHelper.cs doesn't work with the Purchase Product Action. When testing on the device using the purchase product action, in the xcode debugger/console the purchase action doesn't show anything. So I imported back the build from the asset store and the Purchase Product works. Can you please make the revised code work with the purchase action? :)

DonnieT

  • Playmaker Newbie
  • *
  • Posts: 9
Re: In App Purchases iOS & Android
« Reply #18 on: April 26, 2014, 06:47:33 PM »
When I try to run the test scene I get an error about the loop count being exceeded. The only change I've made is in the init action to set the public key from the Android developer portal. (I grabbed this key from the Services & APIs tab, I assume this is the correct one?)

Any guidance you can offer is appreciated.

Side note: You should update the original post to mention this now requires Unity 4.3.4.
« Last Edit: April 26, 2014, 10:47:39 PM by DonnieT »

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: In App Purchases iOS & Android
« Reply #19 on: April 27, 2014, 08:36:39 AM »
Yea, the package seems to have broken, perhaps by a update. I will be checking it out tomorrow to try to find out why. If you do not wish to wait that long, shoot me a pm and I can refund you. I removed it from the store a couple days back.

DonnieT

  • Playmaker Newbie
  • *
  • Posts: 9
Re: In App Purchases iOS & Android
« Reply #20 on: April 27, 2014, 09:06:43 AM »
Sounds good, I'll wait. :) Thanks for the quick response, I'll focus on something else in the meantime.

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: In App Purchases iOS & Android
« Reply #21 on: April 28, 2014, 11:08:39 PM »
There was a bit of confusion over how the Purchase Product works with consumables on android. You must purchase the product normally, then once it is purchased consume it. The action did not make that clear or work that way.

So now when you tick Consumable in Purchase product it will purchase it and then automatically consume it on succeed. If you prefer I have also added a action that will do nothing but Consume a product.

New Purchase Product: http://pastebin.com/1XR6hwe0
New Consume Product: http://pastebin.com/YA8kT6LP

I have also found the issue with blank screens and have updated the version on the forums. If you still have the asset store copy and want to fix the error simply delete the "Finish" state on the Init. This causes a infinite loop. No idea how it got there.
« Last Edit: April 28, 2014, 11:20:19 PM by Marsh »

DonnieT

  • Playmaker Newbie
  • *
  • Posts: 9
Re: In App Purchases iOS & Android
« Reply #22 on: May 01, 2014, 08:08:50 AM »
Cool, was easy to implement with the update.

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: In App Purchases iOS & Android
« Reply #23 on: May 02, 2014, 04:13:53 PM »
Glad it worked for you :)

pampapic

  • Playmaker Newbie
  • *
  • Posts: 15
Re: In App Purchases iOS & Android
« Reply #24 on: May 04, 2014, 09:09:57 AM »
Hi,

I just bought your asset on the asset store and thank you it works well, very easy to implement.

I was wondering if there is a way to get back the price of the IAP registered in itunes connect, like in a string, to display the price directly in my game.

Do i need a custom action for that or is it actually possible ?

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: In App Purchases iOS & Android
« Reply #25 on: May 04, 2014, 12:23:40 PM »
I believe I included a action called Get Price that should do exactly that.

pampapic

  • Playmaker Newbie
  • *
  • Posts: 15
Re: In App Purchases iOS & Android
« Reply #26 on: May 09, 2014, 06:49:55 AM »
I've bought the iOS storekit package and it seems that this action is not included.
Even when i'm looking into the package content of the bundle i can't find an action called Get Price :
https://www.assetstore.unity3d.com/#/content/16003

Are you planning to do an update for that ?

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: In App Purchases iOS & Android
« Reply #27 on: May 09, 2014, 01:33:09 PM »
Huh, I could have sworn I included that. Anyway it is simple enough. I will try to create the action in the next few days.

pampapic

  • Playmaker Newbie
  • *
  • Posts: 15
Re: In App Purchases iOS & Android
« Reply #28 on: May 10, 2014, 03:15:28 AM »
Ok ! I will wait. I think it is essential for your package to include it. i'll make a good review of your product on the asset store, because it was really easy to implement and well documented.

Thanks in advance

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Re: In App Purchases iOS & Android
« Reply #29 on: May 11, 2014, 01:14:31 PM »
I would appreciate a 5 star review indeed! I cannot fully test this unfortunately as I do not own a mac. But this action should work. If not let me know and I will try to get it fixed up.

To use simply create a c# script and call it "GetPrice"
http://pastebin.com/0jqf6gxV


Keep in mind that it returns a string containing the currency symbol as well. That is how it is stored. So it will return say $0.99 and not 0.99.
« Last Edit: May 11, 2014, 01:16:21 PM by Marsh »