Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Official PayPal IPN Support Thread


Mark Evans

Recommended Posts

Hello all,

 

i have installed this mod and have it working to a point. I can go through the whole process and it works as it is supposed to, but it never updates the status of the orders. I have spent two days reading this whole 93 page thread and trying everything suggested. I am now hoping some one can find what i have missed.

 

the specs:

I used "osCommerce PayPal IPN Module v2.0 For 2.2MS2" posted by Terra

 

server info:

MySQL 4.1.12

apache server 1.3.34

PHP version 4.4.1

registered globals "on" for both local and master

at the moment nothing password protected, not even admin area(just incase)

 

I have tried:

locally setting registered globals via php.ini and htaccess

I setup the debuggin email that Terra suggested. I get 3 emails initially then i get more as time goes by(i'm guessing they are retrying to send IPN)

 

when i try to access http://domain/shop/ext/modules/payment/paypal_ipn/ipn.php directly

i get a page cannot be displayed error?

i have checked the permissions and the whole ext directory is set at "777" which is wide open

 

i have submitted a ticket to the hosting company, AIT.com to see if they can figure out why the page won't display,Which is what i think is causing the problem. They claim it's not the firewall

 

Paypal sends out its emails notifying both the shop owner and the "customer".

 

everything appears to work,it just never updates the status.

 

any suggestions would be great, as i have already spent two days working on this.

 

brian

Edited by lebanik
Link to comment
Share on other sites

Hello,

 

like lebanik, I too can't seem to get this new version to work correctly. I installed it and I can order and click pay, it takes me to paypal and then I pay there, and then I click on finish and it brings me back to the site. However even though I paid at the paypal the status is never updated for that order. This is a problem since it always says Preparing [PayPal IPN] as my status and it has a big red x in the notified customer box. I'm assuming that this entry on the order page of my admin is the record that is saved prior to going to paypal and so I don't think paypal is able to communicate with my site after to tell it that the customer paid. Now I looked through all the files and not having a ton of experience with php can't tell exactly where its being setup to tell paypal what to load when its through. I am on a shared server that uses a shared ssl and I had everything working before, (up to 1.3 of this contrib) so I know that its just something going on with this new version.

 

Can someone describe where exactly all the info that is being sent to paypal is setup and more importantly the place that paypal is told where to return after everything has been paid so i can make sure that its using the right urls? Also anyone else have any idea what this new contrib is doing differently from 1.3 that may not be working with my shared hosting setup?

 

thanks

Link to comment
Share on other sites

Okay - for all the last posts:

 

The return URL and the IPN URL are both sent by the IPN module so you don't have to enter this.

 

The order update is handled by the ipn.php file in the /ext/ directory. Causes for not updating can vary from server to server. Common problems are firewalls (GoDaddy) and the fsocket command. If your hosting company is any good you may want to discuss this with them to find out if any firewalls are in place.

 

The info which is sent to PayPal is assembled in paypal_ipn.php ($parameters variable). The order update is in ipn.php. For code differences between v1.3 and v2.0 just use a file comparison program e.g. WinMerge. However v1.3 and v2.0 don't differ with regards to order status updating so I can't see how the new version could stop it from working.

 

Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

Hi,

 

I currently have a live osCommerce site using PayPal IPN v1.3. It all appears to work and I have been receiving live orders, except for the following problem:

 

After the customer pays using PayPal, and they are not a current PayPal user, PayPal will try to sign them up rather than offering them the option to return to my store. Most customers just finish their order here and never return to my store. I can usually consolidate what the order was with the preliminary order which was saved - however this order does not include the all important "customer comments".

 

1. I have heard that PayPal IPN v1.4 and PayPal IPN v2.0 resolves this problem?

 

2. Seeing I already have PayPal IPN v1.3 installed in a customized site, what is the best procedure to "uninstall" the current version and "install" the later v1.4 or v2.0 versions.

 

3. Is there a big difference between v1.4 and v2.0? What is the stability with both of these versions?

 

4. And finally - I just want to get this clarified once and for all. In my PayPal Profiles, under "Instant Payment Notification Preferences", should I have "Instant Payment Notification (IPN)" turned on or off? And should I include a "Instant Payment Notification (IPN) URL"? Some say I need to turn this on and specify a URL, whilst others say that this should be turned off! I simply want to return the customer to my site after they pay with PayPal.

 

Many thanks.

Link to comment
Share on other sites

I'm having a small problem with the Paypal IPN.

 

If a customer comes to my site, places an order then checks out, pays for there order via credit card for example. My Paypal account says the order is unverified and that no address was provided by the buyer. Every order is like this. Every single one says no address provided.

 

Anyone have any idea how I fix this? I can see the address in my shopping carts, its just that Paypal keeps saying no address was provided.

Link to comment
Share on other sites

There is a bug in 1.5(2.0) update which causes orders update fail to work.

 

In the file catalog/ext/modules/payment/paypal_ipn/ipn.php line 106:

		if ($_POST['mc_gross'] == number_format($total['value'] * $order['currency_value'], $currencies->get_decimal_places($order['currency']))) {

This line checks mc_gross (total amount recieved in IPN) with total value (order total in database) x order currency value (exchange rate logged with the order), which only works if you accept one currency (no need to exchange) in both of osC PayPal IPN module and PayPal Profile settings. It probably will fail if your exchange rate differs from paypal's, or the decimal round mismatch the mc_gross amount by a very small value. If you chose the Per Item option, it can be worse.

 

One possible fix is to allow tiny difference between these two total amounts, replace above line with this one:

		if ($_POST['mc_gross']/$order['currency_value'] >= $total['value'] || $total['value'] - $_POST['mc_gross']/$order['currency_value'] <= 0.02 ) {

You might lost 2 cents at most per order with this fix, by the currency which has 1.0000 exchange rate in your currencies setting.

 

The reason to check the verified amount with your databse record is obvious. Hackers can change the amount sent to paypal, with $0.01 to make a successful payment no matter how much the price you fixed. I think it is acceptable to allow this tiny difference, for IPN to update the status.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

I am using Paypal ipn1.3. Everything worked fine until yesterday. I am starting to get the following message at checkout:

 

Forbidden

You don't have permission to access /checkout_confirmation.php on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/1.3.37 Server at realhotstuff.com Port 443

 

------------------------------------------------------------------

 

When I tried to go to the admin/payment module, I clicked on Paypal module and I got the following error:

 

Forbidden

You don't have permission to access /admin/modules.php on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/1.3.37 Server at www.realhotstuff.com Port 80

----------------------------------------------------------------

 

I've changed the permission and nothing helped.

 

Can someone help please?

 

Thanks a lot.

Link to comment
Share on other sites

I've changed the permission and nothing helped.

And this started happening after you added which contribution...maybe SEO URL's? :-"

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

There is a bug in 1.5(2.0) update which causes orders update fail to work.

 

In the file catalog/ext/modules/payment/paypal_ipn/ipn.php line 106:

		if ($_POST['mc_gross'] == number_format($total['value'] * $order['currency_value'], $currencies->get_decimal_places($order['currency']))) {

This line checks mc_gross (total amount recieved in IPN) with total value (order total in database) x order currency value (exchange rate logged with the order), which only works if you accept one currency (no need to exchange) in both of osC PayPal IPN module and PayPal Profile settings. It probably will fail if your exchange rate differs from paypal's, or the decimal round mismatch the mc_gross amount by a very small value. If you chose the Per Item option, it can be worse.

 

One possible fix is to allow tiny difference between these two total amounts, replace above line with this one:

		if ($_POST['mc_gross']/$order['currency_value'] >= $total['value'] || $total['value'] - $_POST['mc_gross']/$order['currency_value'] <= 0.02 ) {

You might lost 2 cents at most per order with this fix, by the currency which has 1.0000 exchange rate in your currencies setting.

 

The reason to check the verified amount with your databse record is obvious. Hackers can change the amount sent to paypal, with $0.01 to make a successful payment no matter how much the price you fixed. I think it is acceptable to allow this tiny difference, for IPN to update the status.

 

Hi Alex - can you give more information on the kind of tests you ran on this? I've checked your post but I cannot verify that there is a bug in the code. As far as I'm aware the PHP code is correct and not a bug.

 

TESTS CARRIED OUT:

 

osCom shop (standard shop) with 3 currencies: Euro, US Dollar, UK Pounds - UK Pounds set as main currency, all other currencies with bogus exchange rates (5.0000).

 

Testing with US Dollar order.

IPN v2.0 in Aggregate mode.

 

PayPal settings:

Test 1) Only UK Pound Balance. Block payments sent to me in a currency I do not hold: No, accept them and convert them to Pounds Sterling

Test 2) UK Pound & US Dollar Balance (accept US Dollar into balance)

 

Result:

Test 1) US Dollar amount correctly verified by PHP rule (PayPal sends back the US Dollar amount and NOT the converted UK Pounds amount).

Test 2) US Dollar amount correctly verified by PHP rule

 

Summary:

PayPal sends back the order amount & currency as submitted and NOT the converted amount. The rule therefore works in all tested scenarios regardless of currency conversion.

 

The currency conversion in the rule is an osCom internal requirement as the order is stored in the unconverted format so to compare it against the order value it must be multiplied with the currency conversion. The only scenario where I can see a problem if the osCom shop currency conversion value was altered between order submission & IPN feedback (and as this is usually only a few seconds, it's probably a minimal issue).

 

To sum up - the conversion is to check the mc_gross amount osCom internally - in paypal_ipn.php mc_gross is created by:

$parameters['amount'] = number_format($order->info['total'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

so when it comes back we need to re-create it from the db:

number_format($total['value'] * $order['currency_value'], $currencies->get_decimal_places($order['currency']))

 

all the best - Terra

Edited by Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

Hi Alex - can you give more information on the kind of tests you ran on this? I've checked your post but I cannot verify that there is a bug in the code. As far as I'm aware the PHP code is correct and not a bug.

Ok, try this in your test:

 

Set IPN module Transaction Currency to Selected Currency.

Set PayPal Profile to accept GBP and auto convert to GBP on other supported currencies.

 

In osC admin, setup JPY if not already done, and update JPY exchange rate.

 

Select JPY as currency at store front, purchase some items and checkout with IPN module.

 

For the exchange rate value is very large between JPY and GBP, so it can magnify the defference.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Testing with US Dollar order.

IPN v2.0 in Aggregate mode.

I have mentioned at the beginning that US Dollar order with 1.0000 exchange rate always works!

 

You must try to sent orders with other currencies than US Dollar or any currency with 1.0000 exchange rate. JPY orders have 118.xxxx exchange rate, which is a much better testing subject.

Edited by AlexStudio

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Ok, try this in your test:

 

Set IPN module Transaction Currency to Selected Currency.

Set PayPal Profile to accept GBP and auto convert to GBP on other supported currencies.

 

In osC admin, setup JPY if not already done, and update JPY exchange rate.

 

Select JPY as currency at store front, purchase some items and checkout with IPN module.

 

For the exchange rate value is very large between JPY and GBP, so it can magnify the defference.

Hi Alex - tested your scenario and the IPN again worked. In your test is the update failing or do you get funny results? Can you tell me what actually appears in your shop on these orders? Terra

 

PS: Please note that for my test exchange rate was set to 5.0 on all tests

Edited by Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

Hi Alex - tested your scenario and the IPN again worked. In your test is the update failing or do you get funny results? Can you tell me what actually appears in your shop on these orders? Terra

 

PS: Please note that for my test exchange rate was set to 5.0 on all tests

well, I found that IPN didn't update every tested oders' status, which are all verified and completed. So I forced the debug email to send out IPN POST on every IPN received, and I found 0.01 mismatch with the mc_gross and the order records shown in admin page.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

well, I found that IPN didn't update every tested oders' status, which are all verified and completed. So I forced the debug email to send out IPN POST on every IPN received, and I found 0.01 mismatch with the mc_gross and the order records shown in admin page.

mmh - okay, looks like an osCom rounding bug then. The currency exchange rate itself does not come ito play (in the scenario you gave the shop sends the order in Yen and PayPal reports back in Yen) but as the two amounts are calculated by multiplication rounding problems can occur. I think that's a known problem with osCom based on the way it stores / calculates values. PS: to test this successfully the values should have awkward decimal points to create different results.

 

all the best - Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

an old thread which gives more background on the rounding bug:

http://www.oscommerce.com/forums/index.php?sho...c=80953&hl=

 

however, Alex' code is a neater solution as it simply allows for a small discrepancy with no need to change db settings or javascript code elsewhere. Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

Hi

 

I have an odd thing happening with my orders list in admin - I only have 7 orders listed and each new order is just overwriting the last one, so I never get more than 7 orders in the list ?

 

I'm using the same user account to create numerous orders, but I don't complete transaction I just close the paypal screen - shouldn't it still create a new order number? or if the order is left on Preparing[Paypal IPN] does a new order from the same customer just overwrite it ?

Link to comment
Share on other sites

an old thread which gives more background on the rounding bug:

http://www.oscommerce.com/forums/index.php?sho...c=80953&hl=

 

however, Alex' code is a neater solution as it simply allows for a small discrepancy with no need to change db settings or javascript code elsewhere. Terra

Thanks Terra, for clearing this up. I struggled with this rounding bug while coding the Express Checkout IPN module. Express Checkout API requires specific decimal points for every supported currency, and makes this problem worse. So I came out with this 'fix' to get around with it. I knew it's the rounding which caused this problem, just didn't know exactly how it happened.

 

BTW, the new Express Checkout IPN module is done, and tested thoroughly. The first beta version will come out soon after I finish the install guide. I will upload it as a new payment module, not an upgrade of this one.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Hi everyone,

 

I have a little question regarding the use of PayPal IPN (version 1.5N released on Jan 4th) with osC 2.2.2. I just started with osC 3 days ago, so please bear with me.

 

My webhost (dot5hosting) only supports shared SSL, so it doesn't support the use of OpenSSL. But cURL is supported.

 

The online store I am building will only deal with AUD and with PayPal Australia thought PayPay IPN payment system.

 

I've created both merchant & customer accounts in PayPal's Sandbox testing server (with Australian Sandbox urls). My testing of the osC + PP IPN communicates with PayPal Australia & processes an order.

 

However, when the order processing between my osC site to PayPal Sandbox Customer's account kicks in, no order parameters (like description of the items purchased, cost, my store's invoice ID number etc) are transferred to the PayPal Sandbox payment portal.

 

My understanding is that PayPay IPN should transmit this information in its default configuration.

 

However in my case, the only information transmitted is the order total amount in AUD, and the amount of items bought. There is no itemised breakdown of multiple purchase items.

 

 

I would like to include this information as I am concerned my customers would be hesitant to commit to the purchase if the information was missing.

 

The Sandbox merchant account contains invoice id, but not a list of itemised invoice items like I describe above. This will also allow me to double-check the order process with PayPal, and also provide an alternative record of the transaction in case of osC site melt-down.

 

I do understand that osC updates its own orders & processing, but for my own and my customer's convenience I would like to provide them this information in the PayPal portal.

 

 

Could anyone advise how this could be achieved?

Cheers,

Tim

Link to comment
Share on other sites

Similar issues as the message above, whats the solution to the following ? Any feedback is appreciated.

 

I am very new to osCommerce but had been using paypal buy now buttons on my site before this.

 

Installed paypal payment module and have the following issues,

 

1. No, order detail on the confirmation page for customer, no order details transferred to paypal before payment. Customer only sees the name of the store and order total which is very unfriendly for someone who is going to go ahead and pay you an amount. Is there a way to fix this so the customer can see the order details and pay comfortably for the order ??

 

2. I am receiving order details in my oscommerce order module even before the payment is made which is very risky as we could ship an order even before it gets actually paid for in PayPal.

 

What is the best way to link a successful payment in paypal to an order completion or order processed in the oscommerce shopping cart.

 

3. Is there a dummy paypal credit card or email id paypal provides to test transactions on paypal. I donot want to keep charging my credit card to see how transactions go through in PayPal.

 

Are there even any ways around these issues or is it a lost case ?

 

Please help as without this it will be difficult for our store to go online.

 

Thanks

 

Amit

Link to comment
Share on other sites

:D I know people don't say it often enough but THANK-YOU for this module! I thought the Paypal-IPN module was the one that came with the basic download and then I learned...

Anyway this was easy to install and I had no problems and just wanted to say Thanks!

I even installed while a customer was on my site shopping and it still went smooth.

:D

Pattie

Link to comment
Share on other sites

However in my case, the only information transmitted is the order total amount in AUD, and the amount of items bought. There is no itemised breakdown of multiple purchase items.

Okay - have you read the user guide? And is your IPN module set to "Aggregate" or "Per Item" mode? Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

Hi,

this mod is just great.... works like a charm. Thank you to the developers and fixers

 

however I have a small problem after an order is made and the custumer pays with paypal ( my paypal setting is set to autoreturn)

I am not getting the order confirmation email

any body know how to fix this, I dig deep the forum trying to find a fix..

any help gurus is very welcome....

Link to comment
Share on other sites

I am not getting the order confirmation email

few queries:

1. do you use other payment modules? NB: make sure that this problem is PayPal IPN related and NOT a generic issue with your site set-up.

2. are your customers getting their emails?

Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

Can someone please help me with my problem I posted about a page or so back. My store is at a stand still. I cant process orders until I fix this.

 

I've installed Paypal IPN and it seemed to work for about one order I think. Now whenever someone adds products then checks out and pays, Paypal says there address was not provided and I'm ineligible for seller protection because of this.

 

The Paypal IPN is not transmitting the buyers info to the Paypal payment cart. It does this for every customer.

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.

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...