Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Official PayPal IPN Support Thread


Mark Evans

Recommended Posts

If you changed the orders status settings (via Localization->Orders status or phpMyAdmin) after PayPal IPN installed, you need to remove PayPal IPN and re-install it in Modules->Payment page.

 

If you're asking about the IPN messages logged in the comments field of orders status history, there is no way to change it because it is what PayPal has in the IPN messages.

 

My actions were:

 

1) Remove Paypal IPN

2) Follow install instructions, changing some text in languages folders

3) Reinstall new Paypal IPN

 

 

I have previously changed the orders status settings, but this is before step 1. It's just odd that I don't get a status change on Completed.? Is there any way for me to debug to locate the reason?

 

Thanks again for your time, great work as always =)

Link to comment
Share on other sites

Did you update the file in catalog/ext/modules/payment/paypal_ipn/ipn.php ?

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

		if ($_POST['payment_status'] == 'Pending') {
	  $comment_status .= '; ' . $_POST['pending_reason'];
	} elseif ( ($_POST['payment_status'] == 'Reversed') || ($_POST['payment_status'] == 'Refunded') ) {
	  $comment_status .= '; ' . $_POST['reason_code'];
	} elseif ( ($_POST['payment_status'] == 'Completed') && (tep_not_null($_POST['address_street'])) ) {
	  $comment_status .= ", \n" . PAYPAL_ADDRESS . ": " . $_POST['address_name'] . ", " . $_POST['address_street'] . ", " . $_POST['address_city'] . ", " . $_POST['address_zip'] .
", " . $_POST['address_state'] . ", " . $_POST['address_country'] . ", " . $_POST['address_country_code'] . ", " . $_POST['address_status'];
	} 

	$order_status_id = DEFAULT_ORDERS_STATUS_ID;

// modified AlexStudio's Rounding error bug fix 
// variances of up to 0.05 on either side (plus / minus) are ignored
	if ((((number_format($total['value'] * $order_db['currency_value'], $currencies->get_decimal_places($order_db['currency']))) -  $_POST['mc_gross']) <= 0.05)  
	  &&
	  (((number_format($total['value'] * $order_db['currency_value'], $currencies->get_decimal_places($order_db['currency']))) -  $_POST['mc_gross']) >= -0.05)) {

// Terra -> modified update. If payment status is "completed" than a completed order status is chosen based on the admin settings 
	  if ( (MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID > 0) && ($_POST['payment_status'] == 'Completed') ) {
		$order_status_id = MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID;
	  } elseif (MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0) {
		$order_status_id = MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID;
	  }

 

Hmm, I definitely get the address in the Comments history. (which must mean the status is set to completed as well).

Given that the status is completed, the I guess the only thing for me to check is that the MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID is set correctly (which I think it is) ... how do I check that manually (i.e. in the database?)

Edited by veral
Link to comment
Share on other sites

Search in configuration table with configuration_key = 'MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID' in phpMyAdmin and then check configuration_value.

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

What version of osCommerce you're using?

 

$currencies->get_value() function came with the stock currencies class, if it's not working then you have a serious problem either in your currencies settings or in the code.

 

The return URL you posted is also pointing to a serious problem in your osCommerce. It was generated by:

$parameters['return'] = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

In your case the tep_href_link() function is not working properly as well.

 

Ok, thanks, I got it working. Now they are returned to my checkout_process.php and sent to checkout_success.php.

 

I am curious though how does the checkout_process.php know not to create the order in the DB and send confirmation email? (as this has already been done)

 

ALso is there any way to make it so that the customer DOESN'T have to click the "Complete your Order Confirmation" button - so that PayPal automatically redirects them back to the store. 2CheckOut has such an option.

 

Lastly, should the order update automatically from Preparing [PayPal IPN] (to whatever the next status is) once the customer is returned back to out store? This didn't happen for me.

Link to comment
Share on other sites

Search in configuration table with configuration_key = 'MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID' in phpMyAdmin and then check configuration_value.

 

 

| 471 | Set PayPal Completed Order Status | MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID | 2 | Set the status of orders which are confirmed as paid (completed) to this value | 6 | 13 | NULL | 2007-11-18 20:35:40 | tep_get_order_status_name | tep_cfg_pull_down_order_statuses( |

 

 

Hmm, that's correct also. Going to try again...

 

 

...

 

Pending PayPal IPN Verified [payment status: Completed (Verified; £6.44),

Customer PayPal address: <address GB>, confirmed]

 

 

orders_status_id | language_id | orders_status_name |

+------------------+-------------+------------------------+

| 1 | 1 | Pending |

| 2 | 1 | Processing |

 

 

Errr ....

Link to comment
Share on other sites

1. This PayPal IPN module takes over the checkout process flow and redirects customers to checkout success page, so it won't create a second order in database.

2. This PayPal IPN module doesn't have the ability to change PayPal server behavior. You need to ask them at PayPal.

3. Please read the install guide about IPN troubleshooting. (v2.3.3 only)

 

You got me this one. I have no idea either. It should be working with all these we checked correctly set....

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's this if statement:

 

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

// Terra -> modified update. If payment status is "completed" than a completed order status is chosen based on the admin settings
	  if ( (MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID > 0) && ($_POST['payment_status'] == 'Completed') ) {
	  //  $order_status_id = MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID;
		$order_status_id = 2;
	  } elseif (MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0) {
		//$order_status_id = MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID;
		$order_status_id = 2;
	  }
	}

 

It's not going into the modified bit... Obviously I've hardcoded the order_status_id here, but that's what it's failing at.

What's mc_gross?

Edited by veral
Link to comment
Share on other sites

You're making a mistake here. The two lines you hardcoded should be different.
if ( (MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID > 0) && ($_POST['payment_status'] == 'Completed') ) {
	  //  $order_status_id = MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID;
		$order_status_id = 2;
	  } elseif (MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0) {
		//$order_status_id = MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID;
		$order_status_id = 2;
	  }
	}

The 1st line is for completed payments, the 2nd line is for payment status not completed.

mc_gross is a parameter PayPal sends back in IPN calls, reflecting the total amount paid at PayPal.

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

Found it.

 

I charge a 3.5% fee for people who want to pay via Paypal, and this is causing the check to fail.

 

mc_gross for me is the sum WITHOUT the paypal fee (in my example, £6.44, with the fee being 0.23)

 

$total['value'] for the order is £6.67, thus causing the discrepancy...

 

 

Hmm, how do I tell paypal I want the whole of the order charged - which should be the sum that INCLUDES the 3.5% fee?

Edited by veral
Link to comment
Share on other sites

Sorry I'm not supporting the extra 'PayPal fee', you're on your own.

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, it would seem my ipn.php file isn't been called by PayPal. (I am using the SandBox).

 

I put some debug code at the top of the ipn.php file and the devug code isn't being executed.

 

I loaded the 'ipn.php' file directly in the browser (as suggested by the trouble shooting notes,ie. http://www.mydomain.com/_/ipn.php) and the debug code gets executed when doing this.

At the order confirmation screen I do a view source and make sure the notify_url is correct, and it is.

 

Why isnt it being called? When, in SandBox mode, is this ipn.php file called?

Link to comment
Share on other sites

Ok, it would seem my ipn.php file isn't been called by PayPal. (I am using the SandBox).

 

I put some debug code at the top of the ipn.php file and the devug code isn't being executed.

 

I loaded the 'ipn.php' file directly in the browser (as suggested by the trouble shooting notes,ie. http://www.mydomain.com/_/ipn.php) and the debug code gets executed when doing this.

At the order confirmation screen I do a view source and make sure the notify_url is correct, and it is.

 

Why isnt it being called? When, in SandBox mode, is this ipn.php file called?

Link to comment
Share on other sites

You can not change the directory structure of the ext folder. It has to be catalog/ext/modules/payment/paypal_ipn/ipn.php , the first folder catalog should be the directory where your osCommerce is installed.

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

You can not change the directory structure of the ext folder. It has to be catalog/ext/modules/payment/paypal_ipn/ipn.php , the first folder catalog should be the directory where your osCommerce is installed.

 

I am not trying to change the directory structure of the ext folder.

 

I am trying to work out why the ipn.php file is not being called.

I put debug code in the ipn.php file but it doesn't get called by payPal.

Link to comment
Share on other sites

Unless I am being blind, this contribution has omitted proper install instructions. All I can see is the following:

 

1. Copy the files in the directory structure set in the contribution download file to your osCommerce installation directory inc. the new /ext/ folder.

2. Make any changes you need to the language level files.

3. Go to the Administration Tool->Modules->Payment section at your osCommerce Administration Tool.

4. Install the PayPal IPN module and configure its parameters. Note: The module is disabled by default so configuration can occur during the operation of a live store.

 

Where are the instructions for manual integration, i.e. adding it to the admin panel, and any db changes if there are any?

Link to comment
Share on other sites

Hi all,

 

I'm getting:

 

11/19/2007 03:55:52 False Preparing [PayPal IPN]

11/19/2007 03:57:45 True Processing PayPal IPN Verified [payment status: Completed (Verified; <total>EUR),

Customer PayPal address: <address> unconfirmed]

11/19/2007 04:00:18 False Pending PayPal IPN Invalid [Completed]

 

Any ideas why I'd be getting an invalid PayPal IPN? (From the Completed status?)

 

Thanks

Link to comment
Share on other sites

blimey having read through this lot i am very confused - i installed this on latest oscommerce installation following instructions with download and when get to payment selection mine shows up as

 

MODULE_PAYMENT_PAYPAL_IPN_TEXT_PUBLIC_TITLE

 

then when selecting that and clicking continue i get to paypal website but to a page that is not found.

 

am stumped - have i installed incorrectly?

Link to comment
Share on other sites

Can anybody help with the following errors? Apart from some problems I had back in September and October when Paypal made some changes their end, everything has been working perfectly! I amended my code mid October to rectify the problems I was having with the shipping being left off and it worked up until today when I looked at my shoppings module to discover a load of errors (as below) It appears that I can no longer access any of my payment modules either??? I'm very confused as most of the errors look like they are trying to access a file I created as a backup? (paypal_ipn_backup0ct2007_before_paypal_screwed_things_up.php) I dont know if someone has been attempting to hack my site or whether some thing has changed with my server? anyone got any ideas??? I'm not sure if it's affected whether or not anyone can purchase or not but either way it's not looking good :( I've compared offline and online code and looked at server dates but nothing seems to have changed :'(

 

Payment Modules	  

Warning: main(): Unable to access /usr/home/xxx/www.somewhere.com/catalog/includes/languages/english/modules/payment/paypal_ipn_backup0ct2007_before_paypal_screwed_things_up.php in /usr/home/xxx/www.somewhere.com/catalog/admin/modules.php on line 128

Warning: main(/usr/home/xxx/www.somewhere.com/catalog/includes/languages/english/modules/payment/paypal_ipn_backup0ct2007_before_paypal_screwed_things_up.php): failed to open stream: No such file or directory in /usr/home/xxx/www.somewhere.com/catalog/admin/modules.php on line 128

Warning: main(): Unable to access /usr/home/xxx/www.somewhere.com/catalog/includes/languages/english/modules/payment/paypal_ipn_backup0ct2007_before_paypal_screwed_things_up.php in  /usr/home/xxx/www.somewhere.com/catalog/admin/modules.php on line 128

Warning: main(/usr/home/xxx/www.somewhere.com/catalog/includes/languages/english/modules/payment/paypal_ipn_backup0ct2007_before_paypal_screwed_things_up.php): failed to open stream: No such file or directory in  /usr/home/xxx/www.somewhere.com/catalog/admin/modules.php on line 128

Warning: main(): Failed opening '/usr/home/xxx/www.somewhere.com/catalog/includes/languages/english/modules/payment/paypal_ipn_backup0ct2007_before_paypal_screwed_things_up.php' for inclusion (include_path='.:/usr/local/lib/php') in  /usr/home/xxx/www.somewhere.com/catalog/admin/modules.php on line 128

Fatal error: Cannot redeclare class paypal_ipn in /usr/home/xxx/www.somewhere.com/catalog/includes/modules/payment/paypal_ipn_backup0ct2007_before_paypal_screwed_things_up.php on line 13

Link to comment
Share on other sites

Yes IPN works with sandbox, only that it is not as stable as with the live server. IPN doesn't call to any 'on screen' page, it calls the script catalog/ext/modules/payment/paypal_ipn/ipn.php which doesn't bring up any screen.

 

MODULE_PAYMENT_PAYPAL_IPN_TEXT_PUBLIC_TITLE
You missed those language level files so the text is not defined with the constant shown.

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 now I have this problem:

 

Unable to process payment. Please contact the merchant as the postal address provided by the merchant is invalid, and the merchant has requested that your order must be delivered to that address.

 

What should I do, is this related to the IPN install?

 

Thanks,

 

Nigel

Link to comment
Share on other sites

PayPal checks the shipping address in some countries (not all) and rejects the addresses if found invalid. Fix the shipping address and try again.

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

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