Jump to content
Mark Evans

Official PayPal IPN Support Thread

Recommended Posts

Hey Ya'll -

 

Our PayPal IPN has worked great, but we've installed the CCGV1.51a Coupon and Gift Voucher contribution, and the IPN doens't seem compatble. They give you PayPal IPN files, but they don't work just right.

 

What happens is that when you apply the coupon code and redeem it, your total is reduced - but when you confirm the order, it takes you to PayPal (via the IPN) but does NOT show the discounted price - it still shows the original price.

 

Has anyone been successfuly in changing this file so that it will properly see the "new" total after the discount was applied by the coupon code?

 

Thanks!

FRED

 

Just set it up to agregate ant not to pass item per item.

I had te same pro8lem, 8ut now it works.

Share this post


Link to post
Share on other sites
Well I made these changes and see no change in the way the module works. It still only sends the customer a confirmation email less than 20% of the time and it doesn't update the products sold list nor subtract them from the inventory so the reorder feature doesn't work either. When it does send an email to the customer the oerder number is always "ser"

Can you tell us how you modified the PayPal IPN? Looking at your posts, you mentioned that you made changes to the way the IPN handles shipping and you've also had problems with tax and made PayPal calculate it. As the install instructions say - the IPN works best with AGGREGATE and MOVE TAX TO TOTAL. Please confirm if that are your setttings.

 

The order number should be correct with the PayPal IPN - I realise there's an issue with the updating if customers do not return, but once they do, all happens as usual - updating, order email etc. I'm running this IPN on several customer sites, no issues.

 

Please give more info on how you modified the IPN and your configuration settings, happy to take a look & help if I can. 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 **

Share this post


Link to post
Share on other sites
When it does send an email to the customer the oerder number is always "ser"

 

That should not happen - in your /includes/modules/payment/paypal_ipn.php this is the code which generates the email:

 

// lets start with the email confirmation
  $email_order = STORE_NAME . "\n" .
				 EMAIL_SEPARATOR . "\n" .
				 EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .

 

and just before that you have the code which pulls the ID number from the database:

 

	  $sql_data_array = array('orders_id' => $order_id,
						  'orders_status_id' => $order->info['order_status'],
						  'date_added' => 'now()',
						  'customer_notified' => (SEND_EMAILS == 'true') ? '1' : '0',
						  'comments' => $order->info['comments']);

  tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

As long as REGISTER GLOBALS is switched ON on your server and your database is okay, it should work ... Just can't understand where the "ser" is coming from. Have you got any more info on your configuration, modifications & hosting set-up? I hate bugs! 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 **

Share this post


Link to post
Share on other sites

Sorry - another post but just had an idea!

 

Have you checked in your database directly to see if it's only the email that displays the wrong order number or whether the entry in the database is incorrect?

 

If you have e.g. PHPMyAdmin, then you can check the data directly - would be good to understand whether it's an email problem or whether the wrong value (or no value) is entered into the database.

 

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

Share this post


Link to post
Share on other sites

Thanks to Terra,

 

for your help. Your assumtion was correct. I had an installation problem.I did not realise that "PayPal IPN" was a seperat item in the payments methods list so after the installation of the contribution nothing had changed. I did deinstall "PayPal" and installed "PayPal (Creditcard /Debit)" und all is working perfect.

 

peru

Share this post


Link to post
Share on other sites
Can you tell us how you modified the PayPal IPN? Looking at your posts, you mentioned that you made changes to the way the IPN handles shipping and you've also had problems with tax and made PayPal calculate it. As the install instructions say - the IPN works best with AGGREGATE and MOVE TAX TO TOTAL. Please confirm if that are your setttings.

 

The order number should be correct with the PayPal IPN - I realise there's an issue with the updating if customers do not return, but once they do, all happens as usual - updating, order email etc. I'm running this IPN on several customer sites, no issues.

 

Please give more info on how you modified the IPN and your configuration settings, happy to take a look & help if I can. Terra

 

First any email receipt sending problems I am having I can replicate with a clean install of the PayPal IPN module.

 

The order number sent to PayPal is correct. and it is correct in the database and on the order pages in the Admin section. It is only when the IPN module sends an email to the customer (less than 20% of the time) that the order number shows up as "ser"

 

As for what modifications I have made:

 

in /includes/modules/payment/paypal.ipn I added this code as per your recommendation:

$parameters['cbt'] = CONFIRMATION_BUTTON_TEXT;

 

I modified the line at or about 328 in catalog/includes/modules/payment/paypal_ipn.php from

 

$parameters['no_shipping'] = '1';

 

To

 

$parameters['no_shipping'] = '2';

 

This will force the buyer re-enter their shipping address at the PayPal website. With the parameter set at 1 it is optional. Some complain it's a pain for the customer to have to enter an address again, but it is another way to confirm they are who they claim to be and provides the needed shipping address information that unfortunately the osCommerce PayPal IPN Module does not send to PayPal in order to be able to use the shipping label section of PayPal.

 

Now since the osC ipn module didn't pass sales tax on to PayPal, I just let PayPal add it on. In my PayPal Preferences I set the tax rate for my state and PayPal does the rest. My tax charges always comes out correct after I forced the buyer to reenter his shipping address into the PayPal site(see above). As I said before this also always gives me the shipping address so I can use Paypal's shipping system. Some buyers complain they have to enter their address twice but I tell them it's for their own security and they say "oh... OK that's cool then"

 

If I set the PayPal IPN to AGGREGATE total the customer NEVER get an email confirming what they ordered just an email with a total. Also I see no items listed if I try and use the PayPal shipping/Packing slip, only a total.

 

IF I set MOVE TAX TO TOTAL then my customers are charged tax twice.

 

My assumption is if I can find where the order number is being corrupted and changed to "ser" it will most likely fix all the problems.

Share this post


Link to post
Share on other sites
That should not happen - in your /includes/modules/payment/paypal_ipn.php this is the code which generates the email:

 

// lets start with the email confirmation
  $email_order = STORE_NAME . "\n" .
				 EMAIL_SEPARATOR . "\n" .
				 EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .

 

and just before that you have the code which pulls the ID number from the database:

 

	  $sql_data_array = array('orders_id' => $order_id,
						  'orders_status_id' => $order->info['order_status'],
						  'date_added' => 'now()',
						  'customer_notified' => (SEND_EMAILS == 'true') ? '1' : '0',
						  'comments' => $order->info['comments']);

  tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

As long as REGISTER GLOBALS is switched ON on your server and your database is okay, it should work ... Just can't understand where the "ser" is coming from. Have you got any more info on your configuration, modifications & hosting set-up? I hate bugs! Terra

 

 

Everything I have matched what you have here.

Share this post


Link to post
Share on other sites

Well it's always the simplest of things. I may have found my problem. A missing semicolon way back up in the code. I'm not sure when or how it went missing but after fixing it 3 orders today have worked fine. We will see if that was it after a few more.

 

I got Ulta Compare and did a line by line, character by character compare with the original download files of the PayPal IPN and all I found other than the suggested edit from Terra and the shipping parameter change was a single missing comma in a section for a java script validation... arrgggggggg

Share this post


Link to post
Share on other sites
I got Ulta Compare and did a line by line, character by character compare with the original download files of the PayPal IPN and all I found other than the suggested edit from Terra and the shipping parameter change was a single missing comma in a section for a java script validation... arrgggggggg

Gary - that's life! Especially when coding in PHP :lol:

 

I'm just glad you might have found a solution - if the problem does pop up again, feel free to email me as I'll be trying to keep the PayPal IPN in working order, so if there are bugs, more than happy to investigate.

 

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

Share this post


Link to post
Share on other sites
Gary - that's life! Especially when coding in PHP :lol:

 

I'm just glad you might have found a solution - if the problem does pop up again, feel free to email me as I'll be trying to keep the PayPal IPN in working order, so if there are bugs, more than happy to investigate.

 

Terra

 

Well I spoke too soon. 3 orders were fine yesterday then the "ser" in place of the order number began appearing in the order confirmation emails . It seems to have now sent an order confirmation email for one out of 4 orders.

Share this post


Link to post
Share on other sites

guys - a little problem I have -

IPN doesn't want to work together with osCAfilliate --

simply transactions are not being registered in affiliate transactions/ sales

any thoughts to get me out of misery ?

---

HM tankman

Share this post


Link to post
Share on other sites

I've been testing this in my shop and have noticed that the shipping charges are not added to the total sent to Paypal. I can't see any settings where this can be set in Admin so I looked at the code and noted that it's subtracting the shipping costs from the amount sent to Paypal in the includes/modules/payment/paypal_ipn.php code (about line 340):

 

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

 

Is this a code error? I changed it in my test shop but I'm not sure if it's going to break something later.

 

Anyone got any ideas?

 

Thanks!

 

-al

Share this post


Link to post
Share on other sites
I've been testing this in my shop and have noticed that the shipping charges are not added to the total sent to Paypal. I can't see any settings where this can be set in Admin so I looked at the code and noted that it's subtracting the shipping costs from the amount sent to Paypal in the includes/modules/payment/paypal_ipn.php code (about line 340):

 

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

 

Is this a code error? I changed it in my test shop but I'm not sure if it's going to break something later.

 

Anyone got any ideas?

 

Thanks!

 

-al

The code you quote above is not from the official PayPal IPN v1.2 - I don't know which module you are using, but you are in the wrong support thread. The PayPal IPN 1.2 works just fine with shipping - might be worth giving it a go:

http://www.oscommerce.com/community/contributions,2679

 

all the best, Terra

 

PS: I did not check chiwawa's mod - if you are using the package from 23rd April, please confirm.

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

Share this post


Link to post
Share on other sites
IPN doesn't want to work together with osCAfilliate --

simply transactions are not being registered in affiliate transactions/ sales

any thoughts to get me out of misery ?

The PayPal IPN mirrors the functions of checkout_process.php so whenever you install a contribution which changes checkout_process.php you also need to alter paypal_ipn.php. Basically, with PayPal IPN the checkout_process is bypassed.

 

When altering paypal_ipn.php don't forget it's a series of functions which have a variable scope, so global variables need to be defined as such.

 

Please back up files first!

To combine the two, open /includes/modules/payment/paypal_ipn.ph.

 

Find this code around line 76:

	function confirmation() {
  global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $insert_id, $order, $order_total_modules;

 

directly under add this code: (let's define the globals)

	  global $affiliate_ref, $affiliate_clientdate, $affiliate_clientbrowser, $affiliate_clientip, $affiliate_clickthroughs_id, $HTTP_SESSION_VARS;

 

Find this code around line 245:

		  tep_session_register('cart_PayPal_IPN_ID');
	  $cart_PayPal_IPN_ID = $cartID . '-' . $insert_id;
	}
  }
  return false;
}

and change to: (let's add the osc affiliate code)

		  tep_session_register('cart_PayPal_IPN_ID');
	  $cart_PayPal_IPN_ID = $cartID . '-' . $insert_id;
	}
  }

 // Include OSC-AFFILIATE 
 require(DIR_WS_INCLUDES . 'affiliate_checkout_process.php');	  

  return false;
}

 

I have tested this code so far only in Sandbox - any feedback on live stores would be appreciated. In Sandbox it works fine, even if customers do not return from PayPal, the order is recorded correctly as soon as payment is made.

 

All the best, Terra :thumbsup:


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

Share this post


Link to post
Share on other sites

Okay, so I don't need to activate IPN in my Paypal account ... that eliminates one possibility as to why when a payment is processed I'm getting email that states "Paypal IPN: Invalid Process" with a bunch of info between $_POST and $_GET variables.

 

Any suggestions ?


Kickin' the darkness 'til it bleeds daylight ....

Share this post


Link to post
Share on other sites
Okay, so I don't need to activate IPN in my Paypal account ... that eliminates one possibility as to why when a payment is processed I'm getting email that states "Paypal IPN: Invalid Process" with a bunch of info between $_POST and $_GET variables.

 

Any suggestions ?

 

Please see this thread (post by Vger) & check whether it helps:

http://forums.oscommerce.com/index.php?sho...19entry839219

 

It's very likely your PayPal account settings, possibly a server/hosting issue, but I'd first double-check your PayPal account. The IPN they talk about on PayPal is totally different from the osCom IPN.

 

If it's still not working, can you post your configuration settings from the admin side (minus confidential data) and confirm if CURL support is enabled on your server?

 

There is also a school of thought about invalid characters (e.g. apostrophes in store name or characters in product names):

http://forums.oscommerce.com/index.php?s=&...indpost&p=67195

but I've never actually experienced any issue of that kind?

 

PS: please do not cross-post - it just duplicates the thread you started earlier.

 

all the best for your shop! 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 **

Share this post


Link to post
Share on other sites

Thanks Terra,

 

Went through the Paypal settings, only changed one as per the thread with Vger but the payment process still doesn't work, I get "Invalid Process" emails in triplicate.

 

My Webhost provider (GoDaddy.com) has responded with generic replies in which they say it's a problem with Paypal, and Paypal replies with a bunch of documentation, a lot of which I don't know is pertinent with regards to this module.

 

However the Paypal Module that came with the OSC installation seems to work okay, in fact for some reason it now carries the "Payment Amount" over to the Paypal page even though it didn't when I first tried it!

 

As for my config settings for the Paypal IPN mod:

 

Enable PayPal IPN Module

True

 

Move tax to total amount

True

 

Transaction Currency

Selected Currency

 

Payment Zone

--none--

 

Set Preparing Order Status

Processing

 

Set PayPal Acknowledged Order Status

Processing

 

Gateway Server

Live

 

Transaction Type

Aggregate

 

Page Style

 

 

Sort order of display.

0

 

Enable Encrypted Web Payments

False

 

Your Private Key

 

 

Your Public Certificate

 

 

PayPals Public Certificate

 

 

Your PayPal Public Certificate ID

 

 

Working Directory

 

 

OpenSSL Location

/usr/bin/openssl


Kickin' the darkness 'til it bleeds daylight ....

Share this post


Link to post
Share on other sites

Oh yes, and cURL support IS enabled on the Server ...


Kickin' the darkness 'til it bleeds daylight ....

Share this post


Link to post
Share on other sites
The code you quote above is not from the official PayPal IPN v1.2 - I don't know which module you are using, but you are in the wrong support thread. The PayPal IPN 1.2 works just fine with shipping - might be worth giving it a go:

http://www.oscommerce.com/community/contributions,2679

 

all the best, Terra

 

PS: I did not check chiwawa's mod - if you are using the package from 23rd April, please confirm.

 

Terra - I am using the official PayPal IPN v1.2a posted May 21 2006 - not Chiwawa's mod - and I downloaded it again just to make sure I hadn't mixed up my files. A quick compare shows they are the same.

 

If you download the package from the contributions page http://www.oscommerce.com/community/contributions,2679 you can check in /includes/modules/payments/paypal_ipn.php. Lines 337-341:

		   // PandA.nl move tax to total amount
	   $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
	   } else {
	   // default
	  $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

 

So I'm not sure what's up... Any comments are appreciated.

 

Thanks.

 

-al

Share this post


Link to post
Share on other sites
Terra - I am using the official PayPal IPN v1.2a posted May 21 2006 - not Chiwawa's mod - and I downloaded it again just to make sure I hadn't mixed up my files. A quick compare shows they are the same.

 

If you download the package from the contributions page http://www.oscommerce.com/community/contributions,2679 you can check in /includes/modules/payments/paypal_ipn.php. Lines 337-341:

		   // PandA.nl move tax to total amount
	   $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
	   } else {
	   // default
	  $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

 

So I'm not sure what's up... Any comments are appreciated.

 

Thanks.

 

-al

 

Halbert - I'm confused ... in your original post you quoted this code:

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

... which is NOT part of the official PayPal IPN

 

and now you quote this code:

		   // PandA.nl move tax to total amount
	   $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
	   } else {
	   // default
	  $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

which IS part of the PayPal IPN (the IPN passes shipping separately to PayPal, so it's calculated on its own).

 

Can you confirm where the first bit of code comes from and give more info about your set-up (what shipping module, tax set-up, your PayPal configuration in admin etc.). Basically, the PayPal IPN passess shipping correctly to PayPal as its own parameter, so something must have gone wonky in your shop.

 

Please post back & I'll help if I can.

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

Share this post


Link to post
Share on other sites

Recently many hosts have been upgrading to PHP 4.4.2 and this has been causing exactly the problem you describe. However, it must be host specific, because we use 4.4.2 and don't have that problem.

 

Vger

Okay, so I don't need to activate IPN in my Paypal account ... that eliminates one possibility as to why when a payment is processed I'm getting email that states "Paypal IPN: Invalid Process" with a bunch of info between $_POST and $_GET variables.

 

Any suggestions ?

Share this post


Link to post
Share on other sites

I have a couple of questions.

 

Could someone please tell me what the major differences are between the PayPal IPN payment method (as implemented by this contrib) and PayPal Express Checkout (Direct Payments). In both you are directed to the Paypal website for payment and are returned to the merchant site afterwards.

 

Also, is it possible when directed to the paypal webiste, to arrive at the credit card entry screen rather than the paypal login screen? I.e. as it is implemented, you are taken to the paypal login screen. If you don't have an account you need to click on ''don't have a paypal account''? Is it possible to go straight to the page you arrive at when clicking on ''don't have a paypal account'' without having to go through the paypal login screen?

 

Basically, as PayPal will be the only payment method to begin with, I want to assume the buy does not have a PayPal account rather than the other way round.

 

Many thanks, in advance.

 

Jody

Share this post


Link to post
Share on other sites
Also, is it possible when directed to the paypal webiste, to arrive at the credit card entry screen rather than the paypal login screen? I.e. as it is implemented, you are taken to the paypal login screen. If you don't have an account you need to click on ''don't have a paypal account''? Is it possible to go straight to the page you arrive at when clicking on ''don't have a paypal account'' without having to go through the paypal login screen?

 

Basically, as PayPal will be the only payment method to begin with, I want to assume the buy does not have a PayPal account rather than the other way round.

 

Many thanks, in advance.

 

Jody

 

I asked PayPal development support directly about this and the answer was an emphatic NO. They want to push the "you should have an account" feeling at every opportunity.

 

If anyone has found a solution I'd love to hear about it as well. 99% of my customers don't have PayPal accounts nor do they seem to want them.

Share this post


Link to post
Share on other sites
Recently many hosts have been upgrading to PHP 4.4.2 and this has been causing exactly the problem you describe. However, it must be host specific, because we use 4.4.2 and don't have that problem.

 

Vger

 

 

Hi VGER,

 

I ran phpinfo() because actually I wasn't sure what they were using, however it's 4.3.11

GoDaddy.com is a pretty big webhost provider, so I haven't really considered the problem to be with their server, but if it is, it's not likely any changes will occur to accomodate me.

I'm curious though, what is it about a particular server's php version that would cause the Invalid Process error ?

 

:(


Kickin' the darkness 'til it bleeds daylight ....

Share this post


Link to post
Share on other sites
Can you confirm where the first bit of code comes from and give more info about your set-up (what shipping module, tax set-up, your PayPal configuration in admin etc.). Basically, the PayPal IPN passess shipping correctly to PayPal as its own parameter, so something must have gone wonky in your shop.

Hi Terra - my bad, I cut the wrong code the first time... :-" I originally was using the Chiwawa mod by mistake which I corrected and I'm now using the PP IPN 1.2a code.. Either way, the same thing has been happening.

 

I'm using the Canada Post shipping module with Canadian taxes (7% GST for most of Canada except certain provinces where it's 15%; 7% PST for BC but not for any other provinces; no taxes for non-Canadian sales). I'm not using the Encrypted system and I'm passing the taxes to PayPal.

 

What happens is my totals are being sent to Paypal missing shipping - so say a $100 item with $15 s/h is being sent to PayPal as only $100... and since I don't let Paypal do my shipping calculations, the s/h gets lost.

 

But if I just cut out the code that subtracts the shipping it sends the proper values across... so I'm just going to run with that. I was worried it might break something else later but so far so good.

 

It could be that I don't have my PP account settings correct, but that's a whole other mess unto itself.

 

Thanks for the help.

 

-al

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×