Guest Posted February 15, 2005 Share Posted February 15, 2005 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); } ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted February 18, 2005 Share Posted February 18, 2005 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? Quote Link to comment Share on other sites More sharing options...
Guest Posted February 18, 2005 Share Posted February 18, 2005 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: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.