Boidy Posted November 18, 2005 Share Posted November 18, 2005 I've just installed this contribution in favour of the standard Paypal module so that I can get IPN working for my client. I'm still in the process of testing and I've come across a very small problem, but an annoying one. When Paypal send the IPN info back and modifies the order status table, it should add simple comments i.e. PayPal IPN Verified [Completed] . Instead however, I'm getting HTML formatting codes in there aswell, PayPal IPN Verified [Completed (Unverified; <span class=currency_symbol>?</span>5.89<span class=currency_symbol></span>)] , which makes it look very untidy. I'm hoping someone has a quick answer to this. I've started working my way through 33 pages of support for this contribution, but not found anything similar yet. Quote Link to comment Share on other sites More sharing options...
Tariq Posted November 18, 2005 Share Posted November 18, 2005 (edited) Am using IPN .098 Do I need to update, and if so, how? And if so, HOW? Edited November 18, 2005 by Tariq Quote One of these days, I will actually understand what I just changed... But reading the Manual DEFINATELY helps... Link to comment Share on other sites More sharing options...
Bozmium Posted November 19, 2005 Share Posted November 19, 2005 same problem here, I took a quick look at the code, but i haven't found out how to fix this yet :( If this helps anyone i have found by comparing the checkout_process and paypal_ipn files that the email portion has a slight but significant difference that will make you lose your order invoice numbers in your emails. eg. in the email section of paypal_ipn look for entries such as: EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id. "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . "<a HREF='" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "'>" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "</a>\n" . If it says $insert_id as above, change them all to $order_id like so: EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . "<a HREF='" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "'>" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "</a>\n" . That should make your order numbers appear in your Paypal shop emails again. Hope this helps someone, coz it ticked me off for about 2 hours. :blink: Cheers :lol: Quote And with a 9 in 10 search rate success the no.1 returned Oscommerce forum hit: "The administrator has enabled flood control - please try again in 30 seconds." Never fails. Every time. Link to comment Share on other sites More sharing options...
Guest Posted November 19, 2005 Share Posted November 19, 2005 PayPal IPN Address Change During Checkout, Not updating Order (osc PayPal IPN contribution) I think this might be related to this bug report but I'm not sure if anyone has come up with a workaround: http://www.oscommerce.com/community/bugs,2498 (A) Customer places order with Ship-to address 'A' (B) Changes address during checkout to 'B' (C ) Pays in Paypal - Paypal has correct address 'B' (D) Info is returned from PayPal - order status is updated but order info still has 'A' address (E) Order email and PayPal email have correct 'B' address but order record still has 'A' address When you print out the order or packing slip, it's showing the old 'A' ship address, so you end up mistakingly shipping to the incorrect address unless you manually compare the email. Any suggestions on how to update the order with the revised 'B' shipping address? Thanks ... Quote Link to comment Share on other sites More sharing options...
mightymidget Posted November 20, 2005 Share Posted November 20, 2005 Just a quicky! I've been using this PP-IPN module for quite sometime. 90% of the time it works perfect. However I've got the same problem everyone gets in that if the client doesn't return to my site none of the order emails get sent to the customer (or me). This is something I can live with as it's a low volume site and I still get the payment notification from paypal. However I'd like to add a note to my checkout process to remind customers to click the 'reurn to merchant' button at paypal. I would be really greatful if someone could look at my below modification and confirm if there are any other files I need to change other than the catalog\includes\languages\english\modules\payment\paypal_ipn.php Here's what I've added: define('MODULE_PAYMENT_PAYPAL_IPN_TEXT_TITLE', 'PayPal (Credit Card / Debit) <br></b>After payment at paypal, please click <b>Return to Mechant</b> to complete your order.'); define('MODULE_PAYMENT_PAYPAL_IPN_TEXT_DESCRIPTION', 'PayPal IPN'); Any takers on this. I know it's only a simple line added during checkout but I'm not 100% confident when playing with the IPN php files. Just need to know if there any other files I need to alter. Cheers Andy. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2005 Share Posted November 20, 2005 Andy, I think that change to the title might present a problem if other modifications rely on the contents of the orders.payment_method field being PayPal (Credit Card / Debit). I've just modified catalog/checkout_success.php to show the PayPal-mandated auto-return text if the payment method is IPN, and I detect the payment method using that value. This is my article about it, in a different topic. Now i've found this topic I guess I should move it here. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2005 Share Posted November 20, 2005 Per-item vs Encryption In IPN v.1.1 MS2-- Per-Item Display Feature Blovked by Web Payment Encryption Just wonder if anyone else also experienced the problem below: I wondered about this... checked out the IPN source code in catalog/includes/modules/payment/paypal_ipn.php and found this in function process_button(): if ( (MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE == 'Per Item') && (MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == 'False') ) { $parameters['cmd'] = '_cart'; $parameters['upload'] = '1'; Inside this conditional clause the IPN module only builds a list of items if Encryption is disabled. The else clause has this: $parameters['item_name'] = STORE_NAME; It means that an encrypted transaction doesn't get the list built. I suspect it has something to do with PayPal accepting limited data when using encryption. However... I decided to try it anyhow, and it worked :-" I simply changed the initial if() statement to: if ( (MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE == 'Per Item') ) { I don't know if there are reasons for this not to be allowed, or whether there were reasons which have since been worked out, but its worth testing it. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2005 Share Posted November 20, 2005 Here's what I've added:define('MODULE_PAYMENT_PAYPAL_IPN_TEXT_TITLE', 'PayPal (Credit Card / Debit) <br></b>After payment at paypal, please click <b>Return to Mechant</b> to complete your order.'); define('MODULE_PAYMENT_PAYPAL_IPN_TEXT_DESCRIPTION', 'PayPal IPN'); Any takers on this. I know it's only a simple line added during checkout but I'm not 100% confident when playing with the IPN php files. Just need to know if there any other files I need to alter. Cheers Andy. I meant to say earlier that if the PayPal account has its Auto-Return enabled and set to the location of your ]checkout_success.php the browser will be automatically returned to the shop, and the customer will not see the Return to Merchant button. Also... Fix for the cart not being cleared on checkout The cart isn't cleared because in includes/application_top.php the cart is rebuilt from the session-variable cart. The fix appears to be simple (anyone know why this isn't a good idea, please shout!) ... In catalog/checkout_success.php at or around line 13, after the require('includes/application_top.php'); add a line to recreate an empty cart: require('includes/application_top.php'); $cart = new shoppingCart; // TJ mod to clear cart after successful transaction Quote Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2005 Share Posted November 20, 2005 When Paypal send the IPN info back and modifies the order status table, it should add simple comments i.e. PayPal IPN Verified [Completed] . Instead however, I'm getting HTML formatting codes in there aswell, PayPal IPN Verified [Completed (Unverified; <span class=currency_symbol>?</span>5.89<span class=currency_symbol></span>)] , which makes it look very untidy. The comment is built at or around line 87 of catalog/ext/modules/payment/paypal_ipn/ipn.php: $comment_status = $_POST['payment_status'] . ' (' . ucfirst($_POST['payer_status']) . '; ' . $currencies->format($_POST['mc_gross'], false, $_POST['mc_currency']) . ')'; currencies->format() is defined in catalog/includes/classes/currencies.php at or around line 35. The commands executed are in the else clause because calculate_currency_value = false. $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; I'd guess from this you have defined your currency strings with CSS styles in Admin->Localization->Currencies, or have used a template or other modification that does this. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2005 Share Posted November 20, 2005 Correction/updateFix for the cart not being cleared on checkout The cart isn't cleared because in includes/application_top.php the cart is rebuilt from the session-variable cart. The fix appears to be simple (anyone know why this isn't a good idea, please shout!) ... In catalog/checkout_success.php at or around line 13, after the require('includes/application_top.php'); add two lines to rcreate an empty cart: require('includes/application_top.php'); tep_session_unregister('cart'); // TJ mod $cart = new shoppingCart; // TJ mod to clear cart after successful transaction Quote Link to comment Share on other sites More sharing options...
Guest Posted November 21, 2005 Share Posted November 21, 2005 (edited) Boidy mentioned the issue that IPN doesn't store customer comments and asked me to take a look at it. I believe I've come up with a solution to it, but in trying it bear in mind I've only been hacking the OSC code for about 3 days. Having said that, I've almost completed a proper Virtual Products module so I'm doing pretty well. The issue with IPN is it has to create an order before payment is authorized. It inserts data into many of the tables that the normal checkout_process.php usually fills after confirmation, but doesn't insert a record into the orders_status_history table. It does this when PayPal connects with the IPN response. When that happens it inserts a record into the orders_status_history table with the comments field containing the IPN response. I can't see any reason why IPN can't insert the record at the same time as it creates the order, and updates it when IPN confirmation arrives. The problem is when records are deleted from the order tables because an order has not received an IPN response from PayPal. Currently the logic detects that situation by the absense of a record in the orders_status_history table, so if we're going to pre-insert to capture the customer's comment we need another way of detecting that IPN never happened. Fortunately that is simple to do. My code inserts the customer comment into orders_status_history pre-payment, and then when the IPN confirmation arrives prefixes the current comment with the IPN result. So to delete unconfirmed orders the detection logic simply looks for orders_status_history->comment that doesn't begin "PayPal IPN Verified". So, to the modifications (beware typo's here - I was very tired when I knocked this together)... In catalog/includes/modules/payment/paypal_ipn.php at or around line 186 add the insert logic: tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); } // *** START MODIFICATION $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => $order->info['comments']); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); // *** END MODIFICATION for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { and alter the delete unconfirmed orders logic at or around line 95 by changing $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1'); to $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" and comments NOT LIKE 'PayPal IPN Verified%' limit 1'); In catalog/ext/modules/payment/paypal_ipn/ipn.php at or around line 105 add the comment-update logic: // new code to cope with customer comments being inserted during the pre-payment phase $sql = "select * from ".TABLE_ORDERS_STATUS_HISTORY." where orders_id='"$_POST['invoice']."'"; $result = tep_db_query($sql); if (tep_db_num_rows($result) > 0) { $order_status = tep_db_fetch_array($result); $comment_status .= ']-[' . $order_status['comments'] . ']'; } tep_db_free_result($result); and a few lines further on, replace the tp_db_perform() statement so the current tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); becomes tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array, 'update', "orders_id='".$_POST['invoice']."'"); Hopefully that lot isn't too full of holes. Try it out and report back errors... I'll try it myself in a fresh development setup this week. Edited November 21, 2005 by phwoarrr Quote Link to comment Share on other sites More sharing options...
skase98 Posted November 22, 2005 Share Posted November 22, 2005 Can anyone help me translate the following email I got from IPN while playing in the sandbox? Unknown Post ------------------------------------------------------ An unknown POST from xx.xxx.xxx.xxx was received. Are you running any tests? ------------------------------------------------------ PayPal Response ------------------------------------------------------ PayPal - Welcome To access the PayPal Sandbox, please log in to PayPal Developer Central. And then there was the standard 'this isn't sent from PayPal' message. What I don't understand is the Unknown Post part. What does this mean? Is this why I'm not actually getting any IPN notifications in my admin window? The orders are coming through in the order window but I'm guessing any emails aren't going where they should or aren't saying what they should. How do you test what the customer gets since the sandbox doesn't really send emails? Sorry for so many questions but me and contributions have an unpleasant history ;) I'm trying everything I can to make this one work! Quote Link to comment Share on other sites More sharing options...
Boidy Posted November 22, 2005 Share Posted November 22, 2005 Can anyone help me translate the following email I got from IPN while playing in the sandbox? Unknown Post ------------------------------------------------------ An unknown POST from xx.xxx.xxx.xxx was received. Are you running any tests? ------------------------------------------------------ PayPal Response ------------------------------------------------------ PayPal - Welcome To access the PayPal Sandbox, please log in to PayPal Developer Central. And then there was the standard 'this isn't sent from PayPal' message. What I don't understand is the Unknown Post part. What does this mean? Is this why I'm not actually getting any IPN notifications in my admin window? The orders are coming through in the order window but I'm guessing any emails aren't going where they should or aren't saying what they should. How do you test what the customer gets since the sandbox doesn't really send emails? Sorry for so many questions but me and contributions have an unpleasant history ;) I'm trying everything I can to make this one work! When you log in to the sandbox (developer.paypal.com) one of the tabs on the screen is 'email'. All email generated by the sandbox is captured in this box so you can view it and check the content. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 22, 2005 Share Posted November 22, 2005 can some one explain please. firstly the debug email you get. is this necasserry, as i want to get the minimum emails possible. also why i am not recieving the email from paypal anymore saying "item notifcation......" explaining somebodies paid. i used to get this but not anymore. also is there a way i can get my osc send me an email when something is purchased letting me know i have had a sale giving information about the product. thanks Quote Link to comment Share on other sites More sharing options...
atnet Posted November 23, 2005 Share Posted November 23, 2005 I hope someone can help me out... For some reason, our store is not sending a value to Paypal, all we get is zero... This is the page we are getting...Also, if I don't use aggregate, we get an empty cart screen as well... Can someone help me out? Thanks!! ~Andrew Quote Link to comment Share on other sites More sharing options...
atnet Posted November 23, 2005 Share Posted November 23, 2005 Anyone? Quote Link to comment Share on other sites More sharing options...
penguino Posted November 24, 2005 Share Posted November 24, 2005 Hello. Please bear with me, as I am pretty new to this. I have set up a shopping cart and have installed the Website payments Pro Module. I have set up a Paypal account, and downloaded the API certificate, and uploaded it to the directory paypal_wpp/certs/cert_key_pem.txt (although my main directory is called "ecommerce", not "catalog"). When attempting to submit an order, I have received the error ?(2030) Unable to find API certificate file.? Does anyone have any suggestions on where to start troubleshooting?? Here's what I have for the module settings: Enable Website Payments Pro Module Do you want to accept credit card payments through WebSite Payments Pro? True Payment Zone If a zone is selected, only enable this payment method for that zone. (none) Set Order Status Set the status of orders made with this payment module to this value defaultDeliveredPendingProcessing Sort order of display. Sort order of display. Lowest is displayed first. Transaction Mode Select Test for SandBox transactions. Test Live API Certificate File Enter your API certificate file name and path from catalog/ paypal_wpp/certs/cert_key_pem.txt API Username PayPal API Username Xxxxxxx(copied and pasted from the paypal site) API Password PayPal API Password xxxxxxxxxxxx PayPal BN Your PayPal BN identification code OSCommerce-2.2MS2 (do I need to change this?!) IPN Notification URL Instant Payment Notification URL (what is this!?) Payment Action PayPal Payment Action Sale Enable cURL Library Set to True if PHP was compiled with libCurl support. True cURL Path Absolute Path to cURL Program /usr/bin/curl Quote Link to comment Share on other sites More sharing options...
dompazz Posted November 24, 2005 Share Posted November 24, 2005 There are no stupid questions, only stupid people. I'm afraid I may be one of those people. :blush: I downloaded and installed the PayPal IPN Module v1.1. I was hoping to find a good step by step guide on what I needed to set both on my installation and on my PayPal account. No dice (if one exists, please point me to it). I've got things setup as I think they should be, however when a customer returns to the site after paying, the order is not updated in the store, and the shopping cart is not emptied. I think may have to do with what I set as my IPN URL with PayPal. True? If so, what should it be set as? Thanks Dom Quote Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2005 Share Posted November 24, 2005 dompaz... it should be pretty self-contained but here is the information flow to help you understand it better. Product -> Cart Cart ->Checkout Checkout->PayPal IPN IPN pre-loads the order into the tables Confirmation->PayPal Payments Site Customer makes payment and is returned to the store Confirmation->Continue shopping Independently of that process, and at some point after (seconds to minutes) the payment is successfully processed, the PayPal IPN server will make an HTTP POST to your store to catalog/ext/modules/payment/paypal_ipn/ipn.php This script immediately posts exactly what it received in the POST query-string back to the PayPal IPN server. The IPN server replies with one word: VERIFIED or INVALID. If its INVALID the ipn.php script sends an email to the Debug E-Mail Address configured in the module's settings with the title PayPal IPN Invalid Process. If its VERIFIED the ipn.php script updates the order_status_history table comment to read PayPal IPN Verified [Completed (Verified; ?30.00)] and updates the orders table setting orders_status to 1 (Pending). Its now up to you, or other contributions/modifications you make, to process the order. Usually this involves changing the order status to Delivered which triggers notification of order, with an email sent with the title Order Update. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2005 Share Posted November 24, 2005 There appears to be a significant bug in the current IPN contribution. I've been debug-testing and found that it's before_process() method never gets called and therefore an order confirmation email is not sent to the customer, amongst other things. This is also why the customer comment is lost because the order_status_history table is not updated. I wrote my own customer-comment capture code in the confirmation() function recently to solve that, but I've now realised there's a fault with the module - possibly a result of recent changes to the code-base? I'll investigate some more and report back, but be aware of these issues... I've now got a list of about 5 issues with the latest download for this contribution that need patching. Quote Link to comment Share on other sites More sharing options...
dompazz Posted November 24, 2005 Share Posted November 24, 2005 (edited) TJ,Thanks for your explanation. I figured the process was something like this. However the shopping cart is not emptied when the customer returns to the site, nor is it cleared after the VERIFIED is received. I have a hard time beleiving that I am the only one that has had this problem. Since most everyone else is able to get this to work, I'm sure I've made a mistake somewhere. I'm just hoping that if the second is true, that the first is also true, and that person(s) can provide some insight. Insight anyone, I seem to be lacking! I'm a moron. Please excuse my lack of reading skills -- I just saw the post where this is covered. I was searching for it last night around dark-thirty and just overlooked it. Woke up this morning and just posted instead of looking again. Edited November 24, 2005 by dompazz Quote Link to comment Share on other sites More sharing options...
jdeproost Posted November 28, 2005 Share Posted November 28, 2005 Hello all, Who knows where this topic has move to? I have the same problem as described here but I can't get to the sollution using the link provided? I found the answer in this thread. Post #69 has the answer - http://www.oscommerce.com/forums/index.php?sho...ic=124298&st=68 Hope this helps someone else. Some help would be appreciated. Kind regards, Johnny Quote Link to comment Share on other sites More sharing options...
winzor Posted November 28, 2005 Share Posted November 28, 2005 I've installed PayPal IPN and the Coupon Voucher mod today and all seems well except in the admin section under "Customers" it has an entry for "BOX_CUSTOMERS_PAYPAL" and it links to FILENAME_PAYPAL. What file do I need to change to correct this problem? Thank you Quote Link to comment Share on other sites More sharing options...
basnyd Posted November 28, 2005 Share Posted November 28, 2005 Look at post #69 of this thread. The answer is there. Sorry about the link problem, I don't know what happened to my link. Barb Hello all, Who knows where this topic has move to? I have the same problem as described here but I can't get to the sollution using the link provided? Some help would be appreciated. Kind regards, Johnny Quote Link to comment Share on other sites More sharing options...
Brian_C Posted November 28, 2005 Share Posted November 28, 2005 (edited) I meant to say earlier that if the PayPal account has its Auto-Return enabled and set to the location of your ]checkout_success.php the browser will be automatically returned to the shop, and the customer will not see the Return to Merchant button. Also... Fix for the cart not being cleared on checkout The cart isn't cleared because in includes/application_top.php the cart is rebuilt from the session-variable cart. The fix appears to be simple (anyone know why this isn't a good idea, please shout!) ... In catalog/checkout_success.php at or around line 13, after the require('includes/application_top.php'); add a line to recreate an empty cart: require('includes/application_top.php'); $cart = new shoppingCart; // TJ mod to clear cart after successful transaction I tried this but it doesn't work for me. When returning to checkout_success.php the cart appears to be empty. But if I log off the store and log back on, the cart contents are back again. The only thing that seems to work for me is in /catalog/includes/modules/payment/paypal_ipn.php changing this $parameters['return'] = tep_href_link('/checkout_success.php'); to $parameters['return'] = tep_href_link('/checkout_process.php'); Around line 331 Edited November 28, 2005 by Brian_C Quote Brian Christensen 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.