Jump to content
MakeWebGames

Recommended Posts

Posted

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

Posted
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.

Posted
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;

Posted
**** 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.

Posted
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!

Posted

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 :)

Posted

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,

Posted

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...

Posted
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.

Posted
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.

Posted

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?

Posted
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.

Posted

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

Posted
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];
Posted
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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...