My attempt to code in some facebook credits

Discussion and feedback on Construct 2

Post » Sun Nov 27, 2011 9:42 pm

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

http://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
B
69
S
11
G
6
Posts: 324
Reputation: 8,321

Post » Sun Nov 27, 2011 11:46 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon Nov 28, 2011 1:03 pm

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.
B
69
S
11
G
6
Posts: 324
Reputation: 8,321

Post » Fri Mar 16, 2012 7:52 pm

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?
B
5
Posts: 1
Reputation: 579

Post » Tue Jan 22, 2013 5:44 pm

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: https://developers.facebook.com/docs/payments/build/haneefkassam2013-01-22 17:44:54
B
3
Posts: 1
Reputation: 277

Post » Tue Jan 22, 2013 7:13 pm

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. www.lockegames.com/relicsofyore/store I believe is my working example using redirects.
B
68
S
21
G
15
Posts: 701
Reputation: 15,604


Return to Construct 2 General

Who is online

Users browsing this forum: blackant, Bleenx and 10 guests