My attempt to code in some facebook credits

0 favourites
  • 6 posts
From the Asset Store
5 levels with simple coding Source-code (.c3p) + HTML5 Exported
  • Hi everybody,

    As you know I personally love the idea of in game purchases. Today I tried to see if I could make my own plugin to make Facebook credits available to use in construct 2.

    As mentioned by Scirra it will be impossible to have IGP without some kind of server side scripting. I think I can devise a plan based on this picture

    developers.facebook.com/attachment/Screen%20shot%202011-04-12%20at%2010.06.45%20AM.png

    Basically I think that the existing FB function can be modified slightly to accommodation this. Here is how it should work

    EVENT -> FB click to buy

    -> Calls up the server in which your app purchase code is on

    • On this you would have to manually code your dialogue box. I am not that talented of a coder and I can do it. If this ever comes to be Ill make a tutorial on it. I also suggest doing it this way so that you have control over what you your store dialogue to look like.

    -> Displays the dialogue to buy

    • In the dialogue it there would be a click to purchase

    -> Requesting the payment status update from your callback

    • Click to confirm

    -> Display the you purchased X dialogue box

    • Then you can set your IGP Boolean variable to true

    And that would be the extent on how this would work. I recommend global variables and you can set up any other code you need from there.

    Again I am not the most talented coder around and this implementation doesn't seem too hard to do. I might take another stab at this later in the week.

    Has anybody tried something like this?

    Thanks

    Mammoth

  • It's actually perfectly possible to use FB credits/Chrome Web Store payments/whatever in Construct 2 already, as you say you just need to follow each site's developer instructions to integrate it with the server side scripts (which is the only secure way to do it), then make a custom plugin with the SDK to talk to the server and see what's been purchased. Obviously if this was integrated with the built-in plugins it would be a bit easier, but if you're going as far as setting up the server-side scripts then using the SDK isn't that big a hurdle either. Plus on top of that your own plugin means you can add your own security system and custom functionality, which means it's probably harder to hack than having a one-size-fits-all official plugin.

    So I think there are people sitting around waiting for us to do something to enable IAP, which actually just means us making some tweaks to plugins that makes it marginally easier. If you're desperate for IAP there's nothing stopping you going for it now, but I guess you'd be the first.

  • I started looking into how you guys actually made construct 2 and I'm really impressed. In 3 months you guys made more progress than most other 2D engines.

    Im going to work on IGP right now. Once I am finished I will share this with the community.

  • Hello, I am a new game developer and looking to purchase this software. Mammoth... do you have any other details to share about your progress with IGP?

  • To be quite honest, a developer should not need to access the server to provide IGP. Yes, restful webservice endpoints need to be created on the server, but utilizing FB.ui, the developer should be able to initiate the purchase process. Is there an easy way to do this in Construct2? (call FB.ui facebook javascript function)

    Updated FB payments SDK reference: developers.facebook.com/docs/payments/build

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I did set it up for Facebook a while back using URL redirects by using the Facebook docs. Going that route it's extremely simple. I've got the javascript to add to the plugin as well to do it without redirects but I'm having a difficult time wrapping my head around the way plugins are built for c2. Ill keep plugging away at it but at least you know it's doable as is now. lockegames.com/relicsofyore/store I believe is my working example using redirects.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)