NB: I won't be publishing/releasing the full codebase. If you want it, go and buy it from King Fox.
Link: https://foxtrot-studios.co/store/view/7-store-v2
Why might this be helpful? Typically, a disgruntled player will charge back their payments to you by telling PayPal their account was hacked and all the payments are false/fraud. One of the ways you can help prove this is not the case, is by being able to give the players IP at the time of purchase. You can then give this to Paypal and ask them to check with their stored IPs relating to the player. This is in no way fool proof nor is it guaranteed to win a chargeback. There are plenty of ways to get around this. It's simply a start, and may help you win a couple more chargebacks. It's also super simple to do.
Second NB: If you're storing a buttfuck ton of user IP's, please take some precautions and secure your database. Also GDPR laws likely apply but you're running an RSPS so you're probably not too bothered either way.
Step 1 - Database Column
First you need to store your IP in a database column. We're going to use a VARCHAR for this and we're going to give it a limit of 50 characters so we're capable of handling IPV6 and IPV4 addresses.
I'm going to naively assume most of you are using PhpMyAdmin (Third NB: It's shit, don't). As such I'll explain how to do it using that.
Go to your store database, then click the 'payments' table and then click 'SQL' once you're there. Below is an image in case you've failed the first and most basic part of the tutorial.
Inside that SQL box, simply copy and paste the following:
Code:
ALTER TABLE global_data
ADD COLUMN ip VARCHAR(15);
Now I know what you're thinking - "holy shit harry brah, it needs to be nullable in case we don't manage to store an IP!!!!"
Well chill, it's nullable by default. This has been your impromptu SQL lesson.
Step 2 - Code
This bit's quite complicated so I want you to read very carefully. Re-read it if you need to.
- Open up pp_ipn.php with an editor of your choice.
- Find the following line:
Code:
$quantity = $_POST['quantity'.$i];
It should be around line 110. - Right below it, add the following line:
Code:
$ip = $_SERVER['REMOTE_ADDR'];
- Then, in the array below, at the bottom of the array, add So it'll look like:
Code:
"buyer" => $buyer,
"receiver" => $receiver,
"player_name" => $buyer_name,
"ip" => $ip
- Save the file.
Congratulations, you're now storing IP's(most the time)(literally don't rely on this whatsoever, it is but a small defence)(proxies will literally destroy this, upgrade the php at your leisure to help account for them).