Coly010 Posted December 9, 2013 Posted December 9, 2013 I'm thinking of putting donator packs into my game, however, I don't know at the minute how I would go about doing this, especially as it would be much better for me to have a system that has them donate £x.xx amount, but then automatically gives them the pack once the money has gone through. Is there a way to do this, securely? Thanks, Colum Quote
Seker Posted December 9, 2013 Posted December 9, 2013 I'm thinking of putting donator packs into my game, however, I don't know at the minute how I would go about doing this, especially as it would be much better for me to have a system that has them donate £x.xx amount, but then automatically gives them the pack once the money has gone through. Is there a way to do this, securely? Thanks, Colum Erm. As in an IPN that pretty much every payment gateway provider has available? Sure, that's possible. Quote
KyleMassacre Posted December 10, 2013 Posted December 10, 2013 Erm. As in an IPN that pretty much every payment gateway provider has available? Sure, that's possible. Yep. You would need an IPN like with paypal. Something like: Check status of payment; Check currency used (so they don't trick you with conversion rates); If status is good check the transaction id (if the same number exist then they are trying to cheat payment auth.); Grab al the parameters you set that the place like paypal sends back; Credit the item and do whatever else you need to do; else: DENIED; Quote
Coly010 Posted December 10, 2013 Author Posted December 10, 2013 **** it sounds a bit complex, looks like I might have to do a bit of digging, and it'll definitely be paypal Quote
Seker Posted December 10, 2013 Posted December 10, 2013 **** it sounds a bit complex, looks like I might have to do a bit of digging, and it'll definitely be paypal It's not at all. --- Figure out PayPal's needed parameters. --- Send to PayPal through form submission. --- PayPal sends back the confirmed data to your IPN file. --- Use confirmed data to update player as needed. Quote
Djkanna Posted December 10, 2013 Posted December 10, 2013 And use the sandbox to test it all. :) Quote
serend Posted December 10, 2013 Posted December 10, 2013 It's not at all. Have to agree here. I was nervous as well when I wanted to do it but it wasn't too bad. Paypal already has a decent IPN help section but its the code samples that did the most for me. We've basically setup it up and just implement a if else statement on status - Paypal will send back the "product id", user id and status of payment itself. So all you would have to do it tell it what to do when it does. Paypal Sample Scripts: http://paypal.github.io/sample-apps/ Good luck! Quote
Coly010 Posted December 10, 2013 Author Posted December 10, 2013 Thanks for the helps guys. Still a bit nervous, always will be when handling money, dont want angry players. But i'll look at the code samples and the IPN help :) Quote
Dave Posted December 10, 2013 Posted December 10, 2013 If you're wanting to integrate donations into your McCodes game I supply a donation system which could be helpful. http://davemacaulay.com/product/ajax-donation-system/ Depending on your needs there are a number of different services provided by PayPal to take payments. I'd suggest briefly looking over the options here: https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/howto_overview Your best bet with game donations is probably the "Express Checkout" option. (https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECGettingStarted/) as serend has already posted there are a number of samples provided by PayPal which you can adapt for your needs, Quote
Jigsaw Posted December 10, 2013 Posted December 10, 2013 Personally, I think one file that can do the the same thing (give users there items automatically), is easier. My personal preference, though I've never seen anyone do that... Quote
Seker Posted December 10, 2013 Posted December 10, 2013 Personally, I think one file that can do the the same thing (give users there items automatically), is easier. My personal preference, though I've never seen anyone do that... Confused about what you mean here. Same thing what? An IPN usually is one file. Quote
Dave Posted December 11, 2013 Posted December 11, 2013 Confused about what you mean here. Same thing what? An IPN usually is one file. You could do it all in one file with all the various different processes separated out... but it's generally easier to separate these things and keep the logic apart. Quote
Coly010 Posted December 11, 2013 Author Posted December 11, 2013 I'm not using mccodes, i'll be making the game from scratch, thats why i'm trying to learn about the IPN and the code i'll need. But in my head i keep getting to a point: what if someone has donated, money takes a while to go through, but the script only runs once, sees money hasnt gone through, doesnt credit user, even though they have donated? Quote
Seker Posted December 11, 2013 Posted December 11, 2013 I'm not using mccodes, i'll be making the game from scratch, thats why i'm trying to learn about the IPN and the code i'll need. But in my head i keep getting to a point: what if someone has donated, money takes a while to go through, but the script only runs once, sees money hasnt gone through, doesnt credit user, even though they have donated? That's not the way it works. PayPal sends the notification, themselves, once the payment goes through. As long as the crediting is done from the IPN and not from the purchase action, there's no risk of that. Because of that, eChecks can be a problem, as they can take days to process. And MC or not, the code is going to look basically the same, as the purchasing will likely be a form submit and the crediting is just using variables given to you by PayPal. Quote
Coly010 Posted December 11, 2013 Author Posted December 11, 2013 so paypal sends the notification that payment went through to the ipn, how does my code interpret the code and find what user to update? i think i'll need to look at code samples and tutorials properly Quote
Seker Posted December 11, 2013 Posted December 11, 2013 so paypal sends the notification that payment went through to the ipn, how does my code interpret the code and find what user to update? i think i'll need to look at code samples and tutorials properly Store the info in one of the values you send to PayPal. For example: <input type='hidden' name='item_name' value='example.com|{$itemname}|{$price}|{$userid}'> And then, in your IPN: $info = explode("|", $_POST['item_name']); $user = $info[3]; Quote
KyleMassacre Posted December 12, 2013 Posted December 12, 2013 Store the info in one of the values you send to PayPal. For example: <input type='hidden' name='item_name' value='example.com|{$itemname}|{$price}|{$userid}'> And then, in your IPN: $info = explode("|", $_POST['item_name']); $user = $info[3]; or to make life a bit easier in my opinion instead of having 1 input type you can have as many hidden values as you like. It may make your form a bit longer but it may be a bit easier on the crediting script. But seker's way mwould also work fine. Bottom line is that once paypal gets a response about payment status they will notify you and your crediting begins Quote
Coly010 Posted December 13, 2013 Author Posted December 13, 2013 So I take it the ipn file is constantly running? Quote
dnenb Posted December 13, 2013 Posted December 13, 2013 No. Paypal would call your script (just as you would go to a website in your browser) and send some information with it. Your script will then process the information, verify that it's coming from paypal, check the status and credit the correct player. Quote
Coly010 Posted December 13, 2013 Author Posted December 13, 2013 Ahhh!! I understand now, at last :P thanks everyone with all the help, I just wanted to be sure because money is involved. Quote
KyleMassacre Posted December 13, 2013 Posted December 13, 2013 once paypal recieves confimation from whatever bank they will let you know the outcome and hit your site with the notification sending a response to your ipn Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.