I'll pay $20 through paytox to anyone who can adapt the following simple php script to suit my needs...
I need the following script to post all transaction variables to a perl script on my server. I can take over from there. It must post the result of the transaction (authorised or otherwise), and all the variables it receives if authorised to the perl script.
I'll pay $20 to anyone who provides me with a working version. Here's the PHP instructions (along with the script)...
xIPN Instructions
RETRIEVE TRANSACTIONS VALUES
Comma delimited output as follows
trans id,paid by, paid to, date, amount, fees, paid by comment, if pending, if reversed, if subscription payment, subscription id, payment type, shipping address, if refunded, if cancelled, if CC buyer info, item list, cart items, last 4 of card
CC Buyer info is ; delimited (name on card/name;email;phone;address;city;state;zip;country;encrypted card number;cc expire;cvv2;order number;order code;
Item list ; delimited (item id;setup fee;quantity)
Cart Items || delimited ( shopping cart items if applicable)
Example Output
13601,admin@buyer123.com,demo@seller123.com,2005-06-21 09:37:00,33.00,3.65,,0,f,f,0,b,address city state zip US-United States,f,f,Name on card;email;phone;address;city;state;zip;US-United States;7e600f83daf74d06880a613b1d5ba09d13cf3689ded23ae2d02699d7f3ffb847;02/09;025;;,Shopping Cart;3.00;1,ORDER 1 = 'Name-cart item 1' 'Product Id-cart item 1' 'Quantity-1' 'Item Price-10'|| ORDER 2 = 'Name-cart item 1' 'Product Id-cart item 1' 'Quantity-1' 'Item Price-10'|| ORDER 3 = 'Name-cart item 1' 'Product Id-cart item 1' 'Quantity-1' 'Item Price-10'||,1111
Your script must post to https://www.paytox.com/?cmd=retrieve_trans
with the following required fields
- user_id
- xipn
- xhash
- trans_id
Example
https://www.paytox.com/?cmd=retrieve_trans&user_id=<USERID>&xipn=<XPIN>&xhash=<XHASH>&trans_id=<TRANSID>
Example PHP Query Statement:
<?
$query = "https://www.paytox.com/?cmd=retrieve_trans&user_id=<USERID>&xipn=<XPIN>&xhash=<XHASH>&trans_id=<TRANSID>";
$url = parse_url($query);
$host = $url["host"];
$path = $url["path"] . "?" . $url["query"];
$timeout = 1;
$fp = fsockopen ($host, 80, $errno, $errstr, $timeout)
or die('Can not open connection to server.');
if ($fp) {
fputs ($fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n");
while (!feof($fp)) {
$buf .= fgets($fp, 128);
}
$lines = split("\n", $buf);
$data = $lines[count($lines)-1];
fclose($fp);
} else {
enter error handing code here
}
$trans = explode(",",$data);
//the data
?>