Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Marsh on March 03, 2014, 07:05:23 PM

Title: In App Purchases iOS & Android
Post by: Marsh on March 03, 2014, 07:05:23 PM
Unity In App Purchases for PlayMaker!

(http://i.imgur.com/9fvAdUk.png)


Requires Unity 4.3.4 or higher. (Can build lower if this is a issue)
*Requires PlayMaker
*Requires Prime31 In App Purchase iOS Plugin

This plugin implements the Prime31 In App Purchase plugin into PlayMaker.

It is no secret that iOS games make their money from In App Purchases. Turn your hobby or professional product into a revenue generating success!

In App Purchases can be a complicated and tricky process. With this plugins easy
to use step by step documentation implementation is a breeze. A full example scene is provided to guide you through the process. Simple add the corresponding PlayMaker action and you are good to go!

(http://i.imgur.com/j7X4fcQ.png)
(http://i.imgur.com/NwDWBmV.png)
(http://i.imgur.com/c4y19Tx.png)
(http://i.imgur.com/rWRQAYG.png)



Download Links:
iOS (http://www.mightyprofessional.com/#!product/prd14/1778968495/in-app-purchase-ios)
Bundle (http://www.mightyprofessional.com/#!product/prd14/1818080895/in-app-purchase-bundle)
Feel free to post questions or comments / bugs etc. Thanks for any support I receive. If you have a request for another Prime31 plugin or other let me know!

Check Out My Other Plugins!
In App Purchases (http://www.mightyprofessional.com/#!product/prd14/1778968495/in-app-purchase-ios)
Social Plugin - Facebook and Twitter (http://www.mightyprofessional.com/#!product/prd14/1707755035/social-bundle)
Google Play Services - Achievements - Leaderboards - Cloud Saving (http://www.mightyprofessional.com/#!product/prd14/1707826095/google-play-services---bundle)
Vungle - Rich Video Ads (http://www.mightyprofessional.com/#!product/prd14/1707813595/vungle-bundle)
AdMob - Banner Ads from Google (http://www.mightyprofessional.com/#!product/prd14/1779868385/admob)
Title: Re: In App Purchases iOS
Post by: Marsh on March 04, 2014, 08:36:49 PM
Just curious is no one interested in this or is anyone waiting for the App Store version?
Title: Re: In App Purchases iOS
Post by: jeanfabre on March 05, 2014, 02:14:39 AM
Hi,

 Give it some time, it's not every day that such thing is needed. Keep advertizing with new samples or how tos, IAP is a best to tackle, especiall when implement securities, so maybe if you show how easy it is with a video or something, then you will likely hook people even more.

Bye,

 Jean
Title: Re: In App Purchases iOS
Post by: escpodgames on March 05, 2014, 03:16:00 AM
Just curious is no one interested in this or is anyone waiting for the App Store version?

Waiting for app store version so I can write a review for ya.
Title: Re: In App Purchases iOS
Post by: marcos on March 05, 2014, 09:55:09 AM
Nice!

I'll also be picking this up from the Asset Store. I just simply want to have all of my add-ons in one place :) (Though granted, sometimes I won't have the option.)

Keen to see what you come up with next ;)

Mark
Title: Re: In App Purchases iOS
Post by: Marsh on March 05, 2014, 01:35:03 PM
Cool, I was just told its under review hopefully it will be up soon :)
Title: Re: In App Purchases iOS
Post by: kici on March 05, 2014, 09:09:29 PM
But I have the "combo" version and would like to be able to use this asset as a combo...

can it do that, because it says iOS on the title so I assume its iOS only?

Let me know if you are planning to upgrade it for both.

Thanks
Title: Re: In App Purchases iOS
Post by: Marsh on March 05, 2014, 09:16:05 PM
I am planning on making a bundle I am just swamped with a bunch of work in ym real job and with my packages.

If you download this it will work with your combo package. But only on iOS of course.
Title: Re: In App Purchases iOS
Post by: kici on March 05, 2014, 09:37:31 PM
Alright thanks,

I'll keep this forum thread opened that way I can see when you update it for a combo I will get it certainly.

Thanks
Title: Re: In App Purchases iOS & Android
Post by: Marsh on March 11, 2014, 06:59:02 PM
Combo is now available. Thank you all for the wait.
Title: Re: In App Purchases iOS & Android
Post by: foxhideous on March 19, 2014, 12:39:35 PM
Was it taken down? I remember seeing it in the asset store yesterday but I can't seem to find it today.
Title: Re: In App Purchases iOS & Android
Post by: Marsh on March 19, 2014, 06:54:15 PM
Im still waiting for them to approve it on the store, everytime I ask for a update they say oh yea any day now. So not sure whats up with it. You can buy it on the website if you want though.
Title: Re: In App Purchases iOS & Android
Post by: Marsh on March 31, 2014, 06:42:25 PM
These are now on the Unity Asset store for anyone who was waiting for it to be official:

https://www.assetstore.unity3d.com/#/content/16003
https://www.assetstore.unity3d.com/#/content/15469
Title: Re: In App Purchases iOS & Android
Post by: foxhideous on April 05, 2014, 03:06:13 PM
Got it on the asset store :)

Question, shouldn't "request product data" have a success or error state? Can you also provide a whole working sample where in you press a button and it goes through the whole process of checking and purchasing a non-consumable? I have something setup but I am not sure if it is the proper way to go about it since it goes thru a lot of checks.

Thanks!
Title: Re: In App Purchases iOS & Android
Post by: Marsh on April 05, 2014, 11:12:44 PM
I have modified Request product data to return a success / failure state. It should be working but I do not currently have access to a mac so I can not test it.

Replace RequestProductData.cs with this: http://pastebin.com/N2QgcYzk
and Replace StoreKitHelper.cs with this: http://pastebin.com/n383En0J

What kind of example would you like? The current example scene does what you are asking. Simply fill in your product data state. Then fill in your Purchase Product 1 state. Now run the example scene and press request product data then Purchase Product 1. It should return a purchase successful / error / canceled.

Pause / Cancel / Resume Downloads / Restore purchases etc etc can be ignored for the current step you are in.

Title: Re: In App Purchases iOS & Android
Post by: foxhideous 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.
Title: Re: In App Purchases iOS & Android
Post by: Marsh 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.
Title: Re: In App Purchases iOS & Android
Post by: foxhideous 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? :)
Title: Re: In App Purchases iOS & Android
Post by: DonnieT 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.
Title: Re: In App Purchases iOS & Android
Post by: Marsh 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.
Title: Re: In App Purchases iOS & Android
Post by: DonnieT 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.
Title: Re: In App Purchases iOS & Android
Post by: Marsh 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.
Title: Re: In App Purchases iOS & Android
Post by: DonnieT on May 01, 2014, 08:08:50 AM
Cool, was easy to implement with the update.
Title: Re: In App Purchases iOS & Android
Post by: Marsh on May 02, 2014, 04:13:53 PM
Glad it worked for you :)
Title: Re: In App Purchases iOS & Android
Post by: pampapic 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 ?
Title: Re: In App Purchases iOS & Android
Post by: Marsh on May 04, 2014, 12:23:40 PM
I believe I included a action called Get Price that should do exactly that.
Title: Re: In App Purchases iOS & Android
Post by: pampapic 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 ?
Title: Re: In App Purchases iOS & Android
Post by: Marsh 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.
Title: Re: In App Purchases iOS & Android
Post by: pampapic 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
Title: Re: In App Purchases iOS & Android
Post by: Marsh 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.
Title: Re: In App Purchases iOS & Android
Post by: pampapic on May 11, 2014, 03:33:27 PM
Awesome ! I'll try it tomorrow, thank you very much for the support ! I'll make the review tomorrow as well :)
Title: Re: In App Purchases iOS & Android
Post by: pampapic on May 13, 2014, 03:23:45 AM
The action works ! Many thanks, review done on the asset store :)
Title: Re: In App Purchases iOS & Android
Post by: Marsh on May 13, 2014, 07:54:04 AM
Great! Thanks!
Title: Re: In App Purchases iOS & Android
Post by: escpodgames on May 14, 2014, 12:16:10 AM
Just a note on the GetPrice action on the previous page -  the Action Category is incorrect, an easy fix but could be frustrating for someone who doesn't know how to write actions.

Thx heaps for the action!
Title: Re: In App Purchases iOS & Android
Post by: Marsh on May 14, 2014, 09:11:32 AM
Thanks, good catch. Here is the version with the fixed category.

http://pastebin.com/znD5JZuj

I will be adding it to the official version in a few days.
Title: Re: In App Purchases iOS & Android
Post by: kici on May 21, 2014, 06:52:20 PM
Hey are you planning to make a UniBill compatibility too or?
Title: Re: In App Purchases iOS & Android
Post by: Marsh on May 22, 2014, 01:18:43 AM
As I mentioned to some people, I do not have 200$ to pay for the Unibill plugin. Nor the blackberry device needed to test the plugin.
Title: Re: In App Purchases iOS & Android
Post by: Marsh on June 26, 2014, 08:58:23 AM
Use the coupon code 50%OFF for half price on all plugins!!
http://www.mightyprofessional.com/

Limited time only!
Title: Re: In App Purchases iOS & Android
Post by: jexon on June 30, 2015, 01:10:23 AM
Where I can buy the plugin? Is it available?
Title: Re: In App Purchases iOS & Android
Post by: Grzegorz on August 20, 2015, 09:08:59 AM
The same question here ;)