Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Official PayPal IPN Support Thread


Mark Evans

Recommended Posts

At which point in the process for the user would everything happen?

I am trying to add the checkout_process functions in the paypal file at exactly the same time the order status is updated - that means the exact time when IPN is received.

 

I haven't had any joy yet as time is limited because I am working on a clients site and then I plan to go on holiday next week and won't return till 3/4 january but will be pre-occupied with other things - it looks like i can't spend any more time on this before the middle of january

Edited by chooch

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

Guys as a newbie to Paypal IPN can someone tell me where the IPN's should go and how do I see them. At present my orders are not being updated by Paypal although I am getting payments through along with the relevant emails, just no IPN's. I have my live paypal account email with the same name as the sandbox one (although the 2 email accounts under it are different), does this make a difference? I have installed IPN 1.4. Any feedback would be welcome as I've spent a lot of time on this already without success. Thanks

Link to comment
Share on other sites

I have ipn 1.4 installed and can't tell if the ipn is working correctly or not. The payment shows up in the order but the description reads

 

PayPal IPN Verified [Completed (Unverified; $105.72)]

 

Can someone tell me if this is the message that I should expect to see.

 

Many thanks in advance.

Link to comment
Share on other sites

I have searched the entire thread, but could not find an answer for this:

 

I installed Coupons and Gift Vouchers. To make it work I changed the setting to use agregate when passing the details to Paypal. When the customer receives his Paypal receipt it shows:

Item/Product MyStoreName

 

How do I change it so instead it passes the description as

 

Item/Product MyStoreName Order no. #####

 

Thanks a million for your help.

Link to comment
Share on other sites

Here's a weird one.

 

First of all, I'm using osC 2.2 with a number of contributions, including the PayPal IPN. The only shipping module in use is standard (included) USPS.

 

We received an order yesterday. The "Order Process" email shows that the customer chose Express Mail and calculated the charge correctly. The PayPal notification email also shows Express Mail and the same amount.

 

But when I look at the order in osC, it shows Priority Mail--with a lesser (also correct) shipping amount and an order total that includes the Priority Mail amount.

 

I haven't spoken with the customer, to find out what they intended. Since the system collected the amount for Express Mail, we went ahead yesterday and shipped it overnight. So I don't really know yet what happened when they entered the order.

 

Has anyone else had this happen? Any clue where to look to solve this problem?

 

Thanks.

Mike in Key West

Link to comment
Share on other sites

I have ipn 1.4 installed and can't tell if the ipn is working correctly or not. The payment shows up in the order but the description reads

 

PayPal IPN Verified [Completed (Unverified; $105.72)]

 

Can someone tell me if this is the message that I should expect to see.

 

Many thanks in advance.

 

That is what you want to see!

Link to comment
Share on other sites

Here's a weird one. Has anyone else had this happen? Any clue where to look to solve this problem?

Have you tried replicating the problem with other payment modules?

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

Have you tried replicating the problem with other payment modules?

 

Good point. You're right, I have no reason to believe the problem has anything to do with the PayPal IPN module. I just thought it would be worthwhile to see if someone chimed in and said "Yes, that's exactly what happened to me--and here's what the problem is."

 

Since no one has done that, I guess I have to get to work. :'(

 

Thanks for the suggestion. I'll try some stuff to isolate the source of the problem.

Mike in Key West

Link to comment
Share on other sites

Thanks for the suggestion. I'll try some stuff to isolate the source of the problem.

I think as it is shipping price related, one of your shipping modules may be at fault.

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

Well, I was hoping to get IPN up and going, but I have an issue. My Payment Modules page in admin looks like this...

 

http://www.bitofthesouth.com/OsAdmin.gif

 

...Notice no option to install or remove a module on the right, no further options after paypal, and no footer info. It'slike the page just quit building. The Shipping and Order Total module page looks and works fine.

 

Not sure how this occured or if there is a simple fix. If not, can I do a clean Osc install without losing my databae info (products, attributes, customer info, etc.) and then try IPN again?

Edited by ahaynes106
Link to comment
Share on other sites

Well, I was hoping to get IPN up and going, but I have an issue. My Payment Modules page in admin looks like this...

 

http://www.bitofthesouth.com/OsAdmin.gif

 

...Notice no option to install or remove a module on the right, no further options after paypal, and no footer info. It'slike the page just quit building. The Shipping and Order Total module page looks and works fine.

 

Not sure how this occured or if there is a simple fix. If not, can I do a clean Osc install without losing my databae info (products, attributes, customer info, etc.) and then try IPN again?

It seems to me that your IPN module is broken, or not installed correctly. Remove the IPN module and re-install it again.

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

It seems to me that your IPN module is broken, or not installed correctly. Remove the IPN module and re-install it again.

 

Thanks, I will try that this afternoon. Unfortunately, I think this problem existed prior to installing/uploading the IPN files; but I will find out for sure. If all else fails and I need to do a clean install will I be able to retain everything in the database? that may be an ignorant question, but I am new to working with databases.

Link to comment
Share on other sites

ok, somebody was talking about how to update stock on receiving a verified notification. I think this is reasonable since the payment is good, you need to update the stock no matter if the order complete or not.

 

To achieve this, you need to modify 2 files.

 

open catalog/ext/modules/payment/paypal_ipn/ipn.pxp

Find: (in line 110-113)

		tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
  }
}

 

Add after:

	require(DIR_WS_CLASSES . 'order.php');
$order = new order($_POST['invoice']);
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
  if (STOCK_LIMITED == 'true') {
	if (DOWNLOAD_ENABLED == 'true') {
	  $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename
						  FROM " . TABLE_PRODUCTS . " p
						  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
						  ON p.products_id=pa.products_id
						  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
						  ON pa.products_attributes_id=pad.products_attributes_id
						  WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
	  $products_attributes = $order->products[$i]['attributes'];
	  if (is_array($products_attributes)) {
		$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
	  }
	  $stock_query = tep_db_query($stock_query_raw);
	} else {
	  $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	}
	if (tep_db_num_rows($stock_query) > 0) {
	  $stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
	  if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
	  } else {
		$stock_left = $stock_values['products_quantity'];
	  }
	  tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	  if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	  }
	}
  }
}

 

open catalog/includes/modules/payment/paypal_ipn.pxp

Find: (in line 492-504)

		  if (tep_db_num_rows($stock_query) > 0) {
		$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
		if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
		} else {
		  $stock_left = $stock_values['products_quantity'];
		}
		tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		}
	  }

 

Replace with:

/*		  if (tep_db_num_rows($stock_query) > 0) {
		$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
		if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
		} else {
		  $stock_left = $stock_values['products_quantity'];
		}
		tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		}
	  }*/

That's it. The stock update code is now moved to ipn.php as requested.

 

With this modification, try not to return to store after paypal payment completed, wait until order status updated (which means verified notification received), and then check the stock quantity.

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

Thanks, I will try that this afternoon. Unfortunately, I think this problem existed prior to installing/uploading the IPN files; but I will find out for sure. If all else fails and I need to do a clean install will I be able to retain everything in the database? that may be an ignorant question, but I am new to working with databases.

I can't see how the IPN would contribute to those problems so I am glad to hear you say that those problems were there prior to the installing of this contribution. Just retrace your steps back to the last contribution you added, then the one before, then the one before that - hopefully you'll find and rectify the error if you keep going.

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

With this modification, try not to return to store after paypal payment completed, wait until order status updated (which means verified notification received), and then check the stock quantity.

Thanks for the code Alex,

 

i tried this and it didn't work.

 

The ipn file edit was fine but the paypal_ipn file isn't that straight forward.... probably because i have QTPro installed.

 

I tried around 9 test transactions and i now need to re-evaluate and take a break .......

 

so if anyone has any ideas on a way around this please update the forum

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

open catalog/includes/modules/payment/paypal_ipn.pxp

Find: (in line 492-504)

		  if (tep_db_num_rows($stock_query) > 0) {
		$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
		if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
		} else {
		  $stock_left = $stock_values['products_quantity'];
		}
		tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		}
	  }

 

Replace with:

/*		  if (tep_db_num_rows($stock_query) > 0) {
		$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
		if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
		} else {
		  $stock_left = $stock_values['products_quantity'];
		}
		tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		}
	  }*/

That's it. The stock update code is now moved to ipn.php as requested.

 

With this modification, try not to return to store after paypal payment completed, wait until order status updated (which means verified notification received), and then check the stock quantity.

that part of the paypal_ipn file with QTPro added is like this:

//	  if (tep_db_num_rows($stock_query) > 0) {
//		$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
	if (!$download_selected) {
	  $stock_left = $stock_values['products_quantity'] - $actual_stock_bought;
	  tep_db_query("UPDATE " . TABLE_PRODUCTS . "
					SET products_quantity = products_quantity - '" . $actual_stock_bought . "'
					WHERE products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
//++++ QT Pro: End Changed Code			
if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		}
	  }
	}
//++++ QT Pro: Begin Changed code
}

I have tried with no success to add the QTPro code but am still working on it - if anyone can point me in the right direction please post here because QTPro is a very popular contribution and it's compatiability with payment modules is essential.

Edited by chooch

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

chooch, you can test without touching paypal_ipn.php, just test with the modified ipn.php which actually listen to IPN and update stocks on receiving. It works on my test store with clean install osC and IPN module.

 

BTW, the IPN code I worked with is osCommerce PayPal IPN v1.4

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

chooch, you can test without touching paypal_ipn.php, just test with the modified ipn.php which actually listen to IPN and update stocks on receiving. It works on my test store with clean install osC and IPN module.

 

BTW, the IPN code I worked with is osCommerce PayPal IPN v1.4

i did try that in my tests.... i will give it another go and see what happens.

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

chooch, you can test without touching paypal_ipn.php, just test with the modified ipn.php which actually listen to IPN and update stocks on receiving. It works on my test store with clean install osC and IPN module.

 

BTW, the IPN code I worked with is osCommerce PayPal IPN v1.4

Ok, i see what you mean Alex....

 

my original tests were all using items with attributes based on QTPro, but when i just did a transaction using an item with no QTPro based attribute it did work...

 

that gives me even more confidence to try to get it to work using QTPro and after that getting the order emails to be sent out at exactly the same time - then the contribution would be a step closer to reaching its full potential

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

I can't see how the IPN would contribute to those problems so I am glad to hear you say that those problems were there prior to the installing of this contribution. Just retrace your steps back to the last contribution you added, then the one before, then the one before that - hopefully you'll find and rectify the error if you keep going.

 

Nope, it was not the IPN. It was a %(&*(*^& operator error...excuse my french :)

In an earlier contrib that had me modify paypal.php in the includes/modules/payment directory, I had made a copy of the original file and renamed it. Well I left that file in the directory on the server. Obviously the two paypal files clashed and caused me a lot of headache. Thanks for the input you and AlexStudio gave. Now I will give the IPN another go!

Link to comment
Share on other sites

that gives me even more confidence to try to get it to work using QTPro and after that getting the order emails to be sent out at exactly the same time - then the contribution would be a step closer to reaching its full potential

another hour later i still haven't nailed it! i have tried adding various QTPro amended code in various places but i can't nail it - i'm knackered, i see my bed calling me

 

Maybe i'll give it another go tomorrow

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

On the second thoght, now I don't think it's a good idea to move anything to ipn.php.

 

When customers complete the payment at paypal and return to store, checkout_process.php takes place just like other payment modules, to complete the order. Only that the ipn module handles almost every job in checkout_process.php, and then send customers directly to checkout_success.php.

 

If you moved all those jobs to ipn.php, then when customers returned to your store but the IPN were delayed or never been received or something wrong with the payment (Invalid results), the order records were not updated, no emails would be sent out, .....etc. Nothing could be done where they should be.

 

The stock quantity should be updated only after orders have been completed, just like all other payment modules do. Customers must return to store to complete their order.

 

Rather than thinking about how to make it work if customers don't return, you should better think about how to make sure your customers know that they must return.

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

BTW, I'm looking into the paypal checkout express API document to find a solution to keep customers stay in store when they hit the confirmation button. If this works, the customers not returning issue will no longer exist.

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

 

Iam facing the same issue..

 

did you find any solution ?

 

Venk

 

 

 

 

Hi,

 

just found this thread. I just installed the current oscommerce distribution and the oscommerce_paypal_IPN_v1.3 contribution. In can see the paypal ipn module in the admin part. I can edit it, but I cannot save the changes. Does anbybody cann help me?

 

Thx.

 

Anathema

Link to comment
Share on other sites

BTW, I'm looking into the paypal checkout express API document to find a solution to keep customers stay in store when they hit the confirmation button. If this works, the customers not returning issue will no longer exist.

The only problem with that is the monthly cost - small businesses don't want to pay the monthly charge of US$20 or UK£20 (UK£20 is around US$39 at the moment!)

 

I see the benefits of express checkout but the costs defeat the object for many businesses - i can't recommend it to customers

Edited by chooch

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

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