Community Add-Ons
osCommerce PayPal IPN Module v1.0 For 2.2MS2
for osCommerce Online Merchant v2.2
This module stores orders prematurely in the database to be processed by PayPal IPN notifications. This takes care of customers not returning back to the store to store the order in the database, and allows processing to occur when the PayPal IPN notification is received.
When communicating with the IPN notification, the order information is sent back to PayPal in a secure manner through PHP native OpenSSL capabilities or through cURL when OpenSSL is not available, or through a normal unsecure manner when no secure communication means exists, to confirm the order made. If the result is successful, the order status is updated automatically to show a successful order has been made. Invalid orders are left alone for the store administrator to verify.
This module also has OpenSSL public/private key encryption capabilities to securely send the order information to PayPal during the checkout procedure.
More information about this feature can be read here:
Encrypted Web Payments: https://www.paypal.com/us/cgi-bin/webscr?cmd=p/xcl/rec/ewp-intro-outside
This module was built to be as simple as possible without having the need to touch core codebase files or database changes for installation and usage.
Fixes for Data not returning from Paypal and Email Confirmation all jumbled Up.
Our order was not returning data back from paypal due to the php.ini file not being present in the
catalog/ext/modules/payment/paypal_ipn folder with Register_Globals = On
Full Package Included.
For those like me searching for the reason why PayaPal does not deduct the discount coupon value, HERE IS THE ANSWER!
In the admin IPN the Transaction Type needs to be set to 'AGGREGATE', it will only work this way as I have found so far.
Bug fix - In v2.3.2 shipping tax would be added twice if set 'Display Prices with Tax' to true. Added configuration key 'Display Prices with Tax' checking to decide whether to add shipping tax as an item or not.
Bug fix - In v2.3.2 when item quantity larger than 1, extra shipping tax would be added at PayPal. Fixed by multiplying the item tax by quantity before checking the tax total.
**************************************
Full package. Upgrading from v2.3.2 just replace the core file in catalog/includes/modules/payment/paypal_ipn.php
Please report bugs/problems/issues to this support thread:
http://forums.oscommerce.com/index.php?showtopic=179917
Bug fix - Rewrote the amounts calculating code so that no matter what has been set with 'Display Prices with Tax', 'Display Tax' and 'Move tax to total amount' options, amounts are now correctly sent to PayPal in both 'Per Item' and 'Aggregate' modes.
Added parameter 'charset' in the button code so the character set can be defined.
Added Shipping tax displayed as an item if 'Per Item' mode selected. Now you can add tax to shipping cost and won't mess up the amounts displayed at PayPal.
*************************************************
Full Package
Support thread: http://forums.oscommerce.com/index.php?showtopic=179917
This is exact the same package as the previous one (the second v2.3.1), just correcting the version number listed.
Bug fix - Rewrote the amounts calculating code so that no matter what has been set with 'Display Prices with Tax', 'Display Tax' and 'Move tax to total amount' options, amounts are now correctly sent to PayPal in both 'Per Item' and 'Aggregate' modes.
Added parameter 'charset' in the button code so the character set can be defined.
Added Shipping tax displayed as an item if 'Per Item' mode selected. Now you can add tax to shipping cost and won't mess up the amounts displayed at PayPal.
*************************************************
Full Package
Support thread: http://forums.oscommerce.com/index.php?showtopic=179917
Bug fix - In v2.3 when "Display Prices with Tax" set to true under admin configurations, the handling amount become negative and causes the error message "PayPal system contains an incorrectly formatted packing value" issue. Fixed by adding a configuration key checking when calculating handling amount.
Bug fix - In v2.3 The shipping/handling amount could have discrepancies when 'Per Item' mode selected. Re-wrote the shipping/handling calculation so the amounts are now accurate.
Bug fix - If the order content type is 'virtual', the customer's billing address should be sent to PayPal instead of the delivery address.
Added post v2.2 multi-language support fix by Terra.
Added 'Per Item' mode supported when Encrypted Web Payments is enabled.
************************************
Full Package
Support thread: http://forums.oscommerce.com/index.php?showtopic=179917
Bug fix - Shipping/handling/tax not sent to Paypal or sent incorrectly in previous versions. Now it sends the correct shipping/handling no matter in 'per item' or 'aggregate' mode.
.
Bugs fix in ipn.php and now it should reduce the problems in previous version.
.
Add cURL proxy server setting option.
.
Bug fix - Force shipping setting removed. Now it always sends user selected shipping address to Paypal if the order content type is not 'virtual'.
.
================================
Full package, French file included
English:
This is the french translation of Paypal IPN v2.1 & v2.2's install guide and documentation.
You'll only find a Guide_installation_LISEZ_MOI.html file replacing the install_guide_READ_ME.html in english.
French:
Le fichier à télécharger est la traduction du guide d'installation et documentation de Paypal IPN v2.1 & v2.2.
Vous trouverez uniquement un fichier Guide_installation_LISEZ_MOI.html file remplaçant le fichier install_guide_READ_ME.html en anglais.
Hello,
First, many thanx to Harald Ponce de Leon, Mark Evans and PandA.nl, Navyhost, Zoeticlight, David, gravyface, AlexStudio, windfjf, Monika in Germany and of course Terra for this very complete contribution.
You will only find here the french file for PayPal IPN. This file is based on based on v2.2.
No more need to install downloads controller to assist us in the issue we all have with digital downloads and them being made accessable to users who don't complete the transactions.
this is a MUCH easier way to fix the problem @ hand.
Please view the zip for the instrucitons.
Version 2.2 Release
3rd order status included on request of AlexStudio to make it better compatible with Download Controller
You can now select an order status for orders where PayPal sends back a "completed" status (i.e. when money has been sucessfully received into your PayPal account). For all other others (e.g. pending echecks etc.) it uses the acknowledged order status.
Minor fix to "customer's paypal address included in comment field of order"
This now only shows if "force shipping" is set to True.
Bug fix in rounding error calc
Minor updates to documentation
Community Support thread:
http://forums.oscommerce.com/index.php?act=ST&f=7&t=179917
This is a full package
I'd recommend users of version 2.0 and 2.1 to upgrade
Version 2.1
Changes:
1. Update to "force shipping" -> customer's paypal address included in comment field of order
NB: the PayPal address is NOT necessarily the the osCom shipping address - please check user guide & screenshots fore more information
2. update to documentation -> NEW screenshots document added
3. Module now includes a footer which is included in emails. Footer text can be defined in language level file (MODULE_PAYMENT_PAYPAL_IPN_TEXT_EMAIL_FOOTER). Default is an empty line.
4. AlexStudio's rounding bug error fix has been incorporated with modifications
5. AstonK2120's variable naming fix has been applied (previously two variables had same name in ipn.php)
[ref: http://forums.oscommerce.com/index.php?s=&showtopic=179917&view=findpost&p=998771]
6. Fixed shipping bug in Aggregate mode where PayPal has it's own shipping set
[ref: http://forums.oscommerce.com/index.php?s=&showtopic=179917&view=findpost&p=999192]
Package includes the "empty cart" fix by Monika in Germay posted as update on 2 Jan 2007
Community Support thread:
http://forums.oscommerce.com/index.php?act=ST&f=7&t=179917
This is a full package
if you'd like to empty the cart in any case, even for those customers that do not return to your site, it can be done right after the extra order emails have been sent in the COMPLETED loop of Terra's new code
add this code
//begin emptying cart for everyone!
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $_POST['custom'] . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $_POST['custom'] . "'");
//end emptying cart for everyone
right above the line that says
} // END STATUS == COMPLETED LOOP
which is line 256 for me, so it looks like this:
// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
//begin emptying cart for everyone!
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $_POST['custom'] . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $_POST['custom'] . "'");
//end emptying cart for everyone
} // END STATUS == COMPLETED LOOP
enjoy!
Version 2.0 contains different code to previous versions. If you have a customised checkout you will need to integrate this carefully! Code fixes published for versions 1.x probably don't work with version 2.x.
This release contains the following updates:
1. Order emails & Stock update moved into ipn.php
standard order email & stock update executed when payment status is "completed"
NEW! short notification email executed when payment status is "pending"
What this means: even if customer does not return to your shop, your stock will be updated and the order emails will be sent.
2. Expaned currency support for:
AUD, CAD, CHF, CZK, DKK, EUR, GBP, HKD, HUF, JPY, NOK, NZD, PLN, SEK, SGD, USD
default US Dollars
3. Added locale support (language support) for US English, UK English, German, Japanese, and French (default US English)
changes in which language PayPal presents itself based on customer's country from their primary address
4. Added "force shipping address?" option to IPN
If force shipping address is set to to TRUE, then shipping address is transmitted to PayPal and order can be eligible for Seller Protection. However this setting currently has one remaining bug as customers without PayPal account will have to re-enter their address.
If force shipping is set to FALSE, then order is not eligible for Seller Protection but customers without PayPal account will have their address fields pre-populated.
IMPORTANT! To check whether the order is eligible for Seller Protection you must check the order info in your PayPal account!
5. Extensive updates to the documentation including a brand-new FAQ section
And the following bug fixes:
6. Address details changed to transmit DELIVERY address to PayPal
7. Stock update only executed if payment_status is "completed" (otherwise every status changed would trigger stock update)
8. Aggregate now only one sum (required to fix problem when IPN is used together with CCGV(trad) and the discount results in a negative sub-total)
Remaining issues:
-> shopping cart not emptied if customer does not return to shop
-> problem with pre-populating UK county field for customers without PayPal account
-> If force shipping == True, then customers without PayPal account will have to retype their address
-> The language files could do with translating
-> Integration help files need to be updated due to new code structure
Community Support thread:
http://forums.oscommerce.com/index.php?act=ST&f=7&t=179917
COMPLETE FILE PACKAGE
Released as version 2.0 due to the code changes to give greater differentiation to version 1.x code
History:
========
1.0 initial modifications
1.1 fixed state abbreviation support -- tested with Canadian provinces and U.S. states
ToDo:
========
Add international support for telephone numbers
Description:
============
This modification enables pre-populating of the PayPal "billing information" form with order/customer information.
(Saves the customer from having to enter it in twice.)
Requirements:
=============
PayPal IPN 1.4 module must be installed and enabled.
This snippet of code adds all the required PayPal "billing information" fields (except the "security code" and credit card information) to the IPN module.
Now when a customer chooses to pay with a credit/debit card on PayPal, the billing information values are pre-populated using order/customer data from osCommerce.
This is a complete file package.
update /include/modules/payment/paypal_ipn.php
fix missing Products Attributes
============
fix 3 bugs - PayPal IPN missing updated informaton
1. When user goes to checkout_confim page but goes back to edit his/her address or comments...etc, and doesn't update the shopping cart, the updated information will not be writen to order.
2. order comments will not be updated when user goes to PayPal and doesn't click "RETURN to merchant" button
3. order id growing each time when user updates shopping cart
fix 3 bugs - PayPal IPN missing updated informaton
(/include/modules/payment/paypal_ipn.php)
1. When user goes to checkout_confim page but goes back to edit his/her address or comments...etc, and doesn't update the shopping cart, the updated information will not be writen to order.
2. order comments will not be updated when user goes to PayPal and doesn't click "RETURN to merchant" button
3. order id growing each time when user updates shopping cart
This release makes the PayPal IPN module compatible with the Register Globals Patch v1.4 - it works for both patched & standard osCom shops!
In addition the following changes were made:
- currency support for AUD (Australian Dollar) added
- ability to name the "continue" button on PayPal Payment Complete page in language file
- user guide now includes information on PayPal account
And the file package now includes integration guides for:
- QTPro 4.25
- CCGV(trad)
- oscAffiliate
Rule of thumb for integrating with other contributions: whenever a contribution requires changes to checkout_process.php you probably also need to amend paypal_ipn.php.
Community Support thread:
http://forums.oscommerce.com/index.php?act=ST&f=7&t=179917
This is a complete file package.
Version 1.2 A complete set with bug fix
- this is a complete set of all files
- contains a bug fix for the missing attributes in order confirmation email problem.
- tax fix by navyhost has also been incorporated.
You must set the module to send in Aggregate mode and also set 'Move tax to total amount' to True for this module to work properly.
The amendment below by chiwawa has not been included as it changes the base funtionality of the module.
The support thread for this module can be found here:
http://forums.oscommerce.com/index.php?showtopic=179917
Background
This is an enhancement based on the osCommerce PayPal IPN Module v1.0 For 2.2MS2 (the one that contribute on 30 Nov 2004).
I added two additional filters to the IPN module, an order Maximum filter and a country filter. If the order amount is more than a pre-defined threshold, or the delivery country is not within a predefined country list, the Paypal_ipn module will be unavailable as a payment option.
The purpose of this contribution is to avoid accepting Paypal payment for customers from some high risk countries (in terms of credit card fraud), and set a ceiling on the order amount to accept PayPal payment.
Same file as navyhost 's.
I'm new to OSC and I followed his instructions to the T. Hence I never got it to work.
To get his fix to work, the module must be "Removed" and then "Installed."
Disabling and re-enabling it is not sufficient because the intall process modifies the database. So here are his instructions with my small change...
============ navyhost's ==========
The paypal ipn module leaves tax out of the total when sending to paypal.
This is fixed with the attached zip file.
In your admin, remove the Paypal IPN module.
Then , unzip the attached file, and overwrite your existing paypal_ipn.php file in the /catalog/includes/modules/payment directory.
In your admin, install the Paypal IPN module.
You must set the module to send in Aggregate mode and also set 'Move tax to total amount' to True.
The paypal ipn module leaves tax out of the total when sending to paypal.
This is fixed with the attached zip file.
In your admin, disable the Paypal IPN module.
Then , unzip the attached file, and overwrite your existing paypal_ipn.php file in the /catalog/includes/modules/payment directory.
You must set the module to send in Aggregate mode and also set 'Move tax to total amount' to True.
- Added support for php native openssl functions
- Added check to verify the order total before changing the order status
- Store the customers paypal account status as part of the order status
- Updated Description to show credit / debit cards are accepted
This module stores orders prematurely in the database to be processed by PayPal IPN notifications. This takes care of customers not returning back to the store to store the order in the database, and allows processing to occur when the PayPal IPN notification is received.
When communicating with the IPN notification, the order information is sent back to PayPal in a secure manner through PHP native OpenSSL capabilities or through cURL when OpenSSL is not available, or through a normal unsecure manner when no secure communication means exists, to confirm the order made. If the result is successful, the order status is updated automatically to show a successful order has been made. Invalid orders are left alone for the store administrator to verify.
This module also has OpenSSL public/private key encryption capabilities to securely send the order information to PayPal during the checkout procedure.
More information about this feature can be read here:
Encrypted Web Payments: https://www.paypal.com/us/cgi-bin/webscr?cmd=p/xcl/rec/ewp-intro-outside
This module was built to be as simple as possible without having the need to touch core codebase files or database changes for installation and usage.
