In-App Purchase Addons

Are there any objective c libraries for in app purchases and gamecenter? At the current state of my app, I don’t fully need the library, just the functions so I can make a dummy version for within codea. I saw @zoyt had some libraries, but by the looks of the thread they don’t work past codea 2.1. Thanks for any help!

Gamecenter addon is built into the newer Codea releases. When you export to Xcode you will see the Addon there. I haven’t used it yet though.

In app purchases is a lot more involved to set up, I don’t think anyone has gotten it working with Codea yet.

@Mr_Ninja I’ve gotten GameCenter working in my app using the included libraries. I think that the documentation in the GameCenterAddon.h may be wrong because when I call gamecenter.enabled(), it gives me an error but gamecenter.enabled works fine.

@Crumble, there have been a couple in-app purchase Add On (I worked with one for one of my games), but none for 2.1 yet.

It shouldn’t be too hard to migrate one to the new API

Ok. I’ll look into it once my app is good enough to start testing on xcode. Just wondering, what are the functions used for the gamecenter add on, just so I could make a test version?

@Mr_Ninja, according to gamecenteraddon.h:

 This addon implements the following Lua API:

 -- Check if GameCenter is enabled
  if gamecenter.enabled() then

 -- Submit to default leaderboard
 gamecenter.submitScore( 1234 )

 -- Submit to specific leaderboard
 gamecenter.submitScore( 1234, “LeaderboardID” )


  -- Show default GameCenter leaderboard (pauses Codea)

 -- Show specific GameCenter leaderboard (pauses Codea)

 -- Show achievements (pauses Codea)

  -- Submit an achievement with a percent complete amount (0.0 - 100.0)
  gamecenter.submitAchievement( “AchievementID”, percent )

  -- Submit a score for a specific leaderboard
  gamecenter.submitScore( 1234, “LeaderboardID” )~~~

Thanks! The gamecenter implementation seems really simple. Now, the hard stuff. Could an addon be written in swift? It seems to be the way ios programming is drifting towards in the future, and it seems simpler to learn than onjective c. Second off, what’s required to link the addon you write to the lua api? Sorry about the incredibly huge area this question covers, im not looking for extreme specifics, just the basics, and hopefully I’ll be able to get my way through it when I get there. Thanks!

@Mr_Ninja you could write an addon in Swift. I am thinking to update the exported Xcode project in the future to be Swift-only.

After coming to the all so saddening conclusion that swift and objective C are fairly difficult, and writing my own add on is out of the picture, I figured I’d try and use the new Game Center add on as a base for converting one of the older add ons on the forums to the new runtime. Only problem is, I can’t find any old ones through the search. Does anyone have a link to a forum post with some code or just plain code? Thanks a ton. I’m hoping to have my app published by this summer, and a teaser will hopefully be coming in the next couple of weeks if all goes well. The last thing i need is the in app purchases to put onto it.

@Mr_Ninja, have a look at how Zoyt did it:

Thanks @JakAttackSeems simple enough. It looks like I’ll I’ll have to do is take the functions from his simpleinapppurchases class and implimentit into a new in app purchase addon class. Will I be able to get to the point in which it brings up the account entering stage without a dev account, or do I need to purchase my dev account before even getting my feet wet in in app purchasing?

You’ll need a developer account to enable in app purchases for the app in Xcode

Ok, thanks
edit: I soon found this out even trying to start implementing in app purchases. I began moving zoyrs easy iap classes over to my xcode project and it began throwing out tons of errors

am I correct about the process for using zoyrs in app purchase addon; Register items within itunes connect, move easy iap library to your project, call initstore, call registerobject for the objects under the same name as registered in itunes connect, then use the buy object for the things you need to buy? Also, would it work if I more or less copied the functions and all within a gutted version of the gamecenter addon? Sorry about all the questions, I just want to make sure that making an in app purchase is doable before making the jump to purchase a dev account. Thanks!

Also, am I required to run my own server to somehow “host” the addons?

@Mr_Ninja, seems like you have the process under hand.

And no, you are not required to have a server to host the iaps, it just makes it easier for you can change price, or name of your iAPs without having to push an update to the app.

When registering the items in itunes connect, what do you call them and how do you link them too your code? I see zoyt calls register item(stackPointDoubles), so is the object registered as stack point doubler in itunes connect, or is it com.something.nonconsumable.stackpoint doubler and stackpointsoubler is just what’s linked to that in the code? If so, where do you link that to the code? Sorry if this is confusing, and thanks!