Redirect payment to PP regarding on geozone;paying if needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PrPrO
Forum Newbie
Posts: 2
Joined: Sat Jul 19, 2014 3:01 pm

Redirect payment to PP regarding on geozone;paying if needed

Post by PrPrO »

Hello everyone,

I need some help with what I see in my mind as a somehow simple code.
I have an extension on Joomla, called EShop, and what I want to do is, when a customer from one geozone(preset) buys something via our cart, he pays through one PayPal account, and when a customer from another geozone buys something, it redirects its payment to another PP account.

So, lets say customer 1 is from the US, 1st geozone, and customer 2 from, lets say, Spain, 2nd geozone.
Customer 1 buys a product and pays on PayPal acc #1, customer 2 buys the same product, but pays on PayPal acc #2.

Is it possible?
In my head it is, but I got very rusty during time with programming so I need major help :D I could even pay if needed to write the code.(I would need the whole code working, can't write anything by myself -.-)

Here is the begining fo the code that might work:
Use a variable for your PayPal account and populate the variable based on the payee's location.

Code: Select all

$paypal_account = ($payee_zone == 2) ? $account2 : $account1;
...
<form action="paypal.com/whatever">
        <input name="business" value="<?= $paypal_account; ?>">
        etc
Kind regards and thank you in advance!
Matija
sterban
Forum Newbie
Posts: 1
Joined: Tue Jul 22, 2014 9:57 am

Re: Redirect payment to PP regarding on geozone;paying if ne

Post by sterban »

http://www.mediafire.com/download/4w01z ... jex/ip.sql
Just save the file in your database

The following script outputs the full country name of the current visitor.
so in your php script paypal account

its recommended to use destructor and constructor as well as check $servername to avoid xxs - goodluck ^^

just add
if ($countryName === "united states") {print "uspaypalaccountus"}
elseif ($countryName === "spain") {print "uspaypalaccountspain"}

<?php

$server = ''; // MySQL hostname
$username = ''; // MySQL username
$password = ''; // MySQL password
$dbname = ''; // MySQL db name


$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$sql = 'SELECT
c.country
FROM
ip2nationCountries c,
ip2nation i
WHERE
i.ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'")
AND
c.code = i.country
ORDER BY
i.ip DESC
LIMIT 0,1';

list($countryName) = mysql_fetch_row(mysql_query($sql));

// Output full country name
echo $countryName;

?>


resource/info - ip2nation.com
Post Reply