Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

YowCow IPN part needed...


Guest

Recommended Posts

Hey guys, I am using YowCow, but noticed the released YowCow module does not take advantage of YowCow's IPN.

 

Here is the template PHP for YowCow's IPN, but I am unsure how to modify this to work properly with osC. Can someone help me work this out or point me to a version that has already been tweaked to work with osC?

 

YowCow IPN PHP Code

 

PHP 4.1

// read the post from YowCow system
$req = '';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// post back to YowCow system to validate
$header .= "POST /ipn/ HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.YowCow.com', 80, $errno, $errstr, 30);

// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary YowCow email
// check that payment_amount/payment_currency are correct
// process payment
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>

Link to comment
Share on other sites

Can anyone help me work this out?

 

Or, does anyone know of a hack that I can do to insert orders into the database prior to navigating off to the payment site (like YowCow) so that I have records of the orders?

Link to comment
Share on other sites

Well, I have found a mish-mash on the contrib part of the site that will at least capture these orders. Though, I'd like to get YowCow IPN working. Any help is appreciated and I am sure would help others besides me. :thumbsup:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...