Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Official PayPal IPN Support Thread


Mark Evans

Recommended Posts

That line has been moved to catalog/ext/modules/payment/paypal_ipn/ipn.php since v2.0(1.5) update.

Find in ipn.php (around line 225):

EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $_POST['invoice'], 'SSL', false) . "\n" .

and replace with:

// EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $_POST['invoice'], 'SSL', false) . "\n" .

 

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

Alex - you may want to have a look at the screenshots I uploaded with v2.1. It clearly states that with "force shipping" set to True you have 3 different addresses:

osCom Billing

osCom Shipping

Paypal Shipping

 

Only if PayPal Shipping matches osCom Shipping is the order eligible. All the IPN does, it allow the order to become eligible for seller protection. It doesn't guarantee it. The site owner will still have to check the addresses and also make sure to comply with the other requirements of the seller protection.

 

The PayPal shipping address is the confirmed customer address used when the customer set up their PayPal account. Terra

sorry Terra, but the billing information fix by gravyface dose not make sense, and the shipping address problem I found has nothing to do with the osComm Billing address.

 

To make this more clear:

 

1. The button code variables used in gravyface's 'fix' do not exist, and have no effect. They come from IPN/PDT variables, which require a different cmd=_notify-synch parameter to work with.

 

2. The address problem is not about eligible for seller protection. It is about PayPal's showing an address which is not sent by the button code, nor any other address registered in PayPal profile.

 

PayPal stated that the shipping address sent by the button code is treated as billing and shipping address. That means there is only ONE address allowed in the button code. It was not shown in the shipping info at PayPal page but an address came from no where instead.

 

3. Actually I fixed the pre-populating problem in my post. Just that I can't update shipping address with IPN response, because I don't even know how the non-existing address got there. This is absolutely a bug from PayPal.

 

I already posted in the PayPal developer center regarding this shipping address issue, hopefully I can get an answer very soon.

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 true that the variable information sent for the "force shipping" setting are irrelevant (I think it could be empty and still work). All that matters is that the variables are sent and then PayPal returns the variables fields with their own values. When returning the variables, PayPal overwrites the address with their own shipping information, regardless of what has been sent before.

 

To recap:

(1) osCom shop sends variables for force shipping - what they are doesn't matter, as long as the variable names are there

(2) PayPal returns variables with the shipping information they have from the customer's PayPal account

(3)Shop owner must check if PayPal shippping address matches osCom shipping address to be eligible for seller protection.

 

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

Version 2.2 Relase

 

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

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

 

3rd order status included on request of AlexStudio to make it better compatible with Download Controller

You can now select an order status for orders where PayPal sends back a "completed" status (i.e. when money has been sucessfully received into your PayPal account). For all other others (e.g. pending echecks etc.) it uses the acknowledged order status.

 

Minor fix to "customer's paypal address included in comment field of order". This now only shows if "force shipping" is set to True.

 

Bug fix in rounding error calc

 

Minor updates to documentation

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

 

NB: Okay this is it now - I think it's fairly stable and should not contain bugs. Any problems please post on this thread but please don't expect a new version within the next few months - this has been a big round of updates & I need to get back to work. :D

 

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

Version 2.2 Relase

 

NB: Okay this is it now - I think it's fairly stable and should not contain bugs. Any problems please post on this thread but please don't expect a new version within the next few months - this has been a big round of updates & I need to get back to work. :D

 

all the best - Terra

 

 

Terra, again a BIG thanks for all your work and effort!

Also AlexStudio for you help and effort the create you module and trubbleshoot on the IPN module!

 

I will install, test and translate the Dutch part of the IPN module and upload as soon a it is ready.

 

Again, THANKS!

Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Link to comment
Share on other sites

NB: Okay this is it now - I think it's fairly stable and should not contain bugs. Any problems please post on this thread but please don't expect a new version within the next few months - this has been a big round of updates & I need to get back to work. :D

 

all the best - Terra

 

 

Hi Terra

 

I ran a test - and all seems really nice. I really like the adress fields are being filled out - great! Also that I don't have to change the hole database - easy install....

Tried with both downloads - and with products with a weight

 

Thanks for all your work (and Alex too)

 

Helle :-)

Edited by HelleM
Link to comment
Share on other sites

Hmm, I'm getting the following error:

 

I've tested some more.

The error does not occur when using Firefox or IE 6 but using an add-on like Slimbrowser.

 

Another thing I see is that the

define('MODULE_PAYMENT_PAYPAL_IPN_TEXT_EMAIL_FOOTER', 'e-mail extra tekst');

does not get send.

 

Also in the adres part of the order confirmation the country is not send compleetly, all I'm getting is this:

Norman in 't Veldt

tlpnln 12

1731 wc winkel

N

 

As you see the Netherlands is showing as N :(

Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Link to comment
Share on other sites

Thanks for your help AlexStudio and Terra. I made changes accordingly and everything with my site is working perfectly.

 

Terra does your Version 2.2 Relase contain the AlexStudio fix(

 

http://www.oscommerce.com/forums/index.php?s=&...t&p=1005130

 

http://www.oscommerce.com/forums/index.php?s=&...&p=1005141)?

 

 

You all are the best!!!!!!!!!!

Link to comment
Share on other sites

Thanks for your help AlexStudio and Terra. I made changes accordingly and everything with my site is working perfectly.

 

Terra does your Version 2.2 Relase contain the AlexStudio fix(

 

http://www.oscommerce.com/forums/index.php?s=&...t&p=1005130

 

http://www.oscommerce.com/forums/index.php?s=&...&p=1005141)?

You all are the best!!!!!!!!!!

 

 

I am referring to above is Post #1918 and Post #1920

Link to comment
Share on other sites

sorry Terra, but the billing information fix by gravyface dose not make sense, and the shipping address problem I found has nothing to do with the osComm Billing address.

 

To make this more clear:

 

1. The button code variables used in gravyface's 'fix' do not exist, and have no effect. They come from IPN/PDT variables, which require a different cmd=_notify-synch parameter to work with.

 

...

 

Hi AlexStudio - I am still currently using PayPal IPN v1.4 with Gravyface's autofill implementation. Not sure if I'm understanding your comments properly, but I find that his autofill implementation code does work & it auto populates the billers name & address details into PayPal.

 

Was your comment that it doesn't work or doesn't work properly?

 

Thanks for all the great work.

Link to comment
Share on other sites

PayPal can't "talk" with the ipn.php file in the /ext/ directory. Make sure you copied the file over correctly and that there's not firewall in place which can stop communication. The problem is likely to be server configuration related. Terra

 

 

Terra,

Thanks for the response, I have found the solution, I had to have a copy of the php.ini file within the folder where ipn.php was!!!

 

Stock is now updating and order is showing as pending!!!

 

Thanks

 

Colin G.

Link to comment
Share on other sites

I use this "Order IP Recorder v1.0"

Is that possible to get the IP info through using "osCommerce PayPal IPN Module v1.0 For 2.2MS2" ??

 

All other payment types i have gets this - exept this new Paypal contrib??

 

Also there's talk about an .ini file ?? Is it a nessasary part??

 

Helle :-)

Link to comment
Share on other sites

Hi AlexStudio - I am still currently using PayPal IPN v1.4 with Gravyface's autofill implementation. Not sure if I'm understanding your comments properly, but I find that his autofill implementation code does work & it auto populates the billers name & address details into PayPal.

 

Was your comment that it doesn't work or doesn't work properly?

 

Thanks for all the great work.

His fix addressed himself that the prepopulating doesn't work with Force Shipping, and that's only because he used the wrong variables. Once replace those non-working variables, repopulating works with both Force shipping on an off.

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 true that the variable information sent for the "force shipping" setting are irrelevant (I think it could be empty and still work). All that matters is that the variables are sent and then PayPal returns the variables fields with their own values. When returning the variables, PayPal overwrites the address with their own shipping information, regardless of what has been sent before.

 

To recap:

(1) osCom shop sends variables for force shipping - what they are doesn't matter, as long as the variable names are there

(2) PayPal returns variables with the shipping information they have from the customer's PayPal account

(3)Shop owner must check if PayPal shippping address matches osCom shipping address to be eligible for seller protection.

 

Terra

Thanks Terra. Please check the Standard Variable Reference with address_override, the description says:

1: The address specified in prepopulation variables overrides the user's stored address. The customer is shown the passed-in address but cannot edit it. If the address is not valid such as missing any required fields, including country) or not included, no address is shown.

 

The passed-in address just not getting shown, no matter with or without address_override=1 given. I'm still waiting for an answer from PayPal developer center.

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've tested some more.

The error does not occur when using Firefox or IE 6 but using an add-on like Slimbrowser.

You didn't read through the user guide, please do so now. Your answer is in there.

 

Another thing I see is that the
define('MODULE_PAYMENT_PAYPAL_IPN_TEXT_EMAIL_FOOTER', 'e-mail extra tekst');

does not get send.

I will check with this later.

 

 

Also in the adres part of the order confirmation the country is not send compleetly, all I'm getting is this:

As you see the Netherlands is showing as N :(

There is a bug in osComm with tep_get_address_format(). If the address is queried from databse, the country name only shown with the first character. I can't fix this because this fuction called in too many places, and it works fine with the address in forms.

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 use this "Order IP Recorder v1.0"

Is that possible to get the IP info through using "osCommerce PayPal IPN Module v1.0 For 2.2MS2" ??

 

All other payment types i have gets this - exept this new Paypal contrib??

 

Also there's talk about an .ini file ?? Is it a nessasary part??

 

Helle :-)

The IP order recorder needs some extra modification to work with this module. I have posted an answer about this question in the IP Order Recoder support thread, please refer to it.

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 for your help AlexStudio and Terra. I made changes accordingly and everything with my site is working perfectly.

 

Terra does your Version 2.2 Relase contain the AlexStudio fix(

 

http://www.oscommerce.com/forums/index.php?s=&...t&p=1005130

 

http://www.oscommerce.com/forums/index.php?s=&...&p=1005141)?

You all are the best!!!!!!!!!!

Nope, it's not included. The address prepopulating still doesn't work if you set Force Shipping Adderss to TRUE. Terra didn't get my point probably because of my poor English.

 

I will not upload any fix to this one, if you want that fix in v2.2, here is the detail:

 

1. The variable 'no_shipping' = 2 DOSE NOT mean that the address you send out is fixed. It only tells paypal to show the shipping info.

 

2. The variable 'no_shipping' = 1 DOSE NOT mean that the address you send out can be altered. It only tells paypal NOT to show address info.

 

3. The variable 'address_override' = 1 variable is NOT in the v2.2 code. This variable tells paypal that the address you send to paypal is fixed, and customers will not be able to change it. Without it, there will be a link to 'Edit Address' in the Shipping Address section, which makes customer easily confused that they need to change the shipping address there. Because the shipping address shown there is not necessarily the one they have in the order, and actually the shipping address set in the order never shown there. This is a MAJOR BUG and currently there is no solution available, but we can get around it by telling paypal not to show the shipping address at all.

 

4. Why address prepopulating doesn't work with Force Shipping Address set to TRUE? Because the code in v2.1 and v2.2 set the variable 'no_shipping' = 2, and uses irrelevant variables 'trying' to send out the address but no luck. Leaving those nonsense in the code will only make trouble to developers and users. As mentioned above, the variable 'no_shipping' = 2 only tells paypal to show the address info. No address info can be send out with this code, there for the prepopulating is not working.

 

5. The best way to work around the shipping address issue I found is always set 'no_shipping' = 1, which tells paypal not to show shipping info at all as mentioned above.

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

Address Pre-Populating Issue Fix - for v2.2

 

This fix always set 'no_shipping' = 1, and leaves room for future upgrade once if the shipping address issue get resolved.

 

Find in catalog/includes/modules/payment/paypal_ipn.php line 372:

	  // let's check what has been defined in the shop admin for the shipping address
  if (MODULE_PAYMENT_PAYPAL_IPN_SHIPPING == 'True') {
  // all that matters is that we send the variables
  // what they contain is irrelevant as PayPal overwrites it with the customer's confirmed PayPal address
  // so what we send is probably not what we'll get back
  $parameters['no_shipping'] = '2';   
  $parameters['address_name'] 		= $name;
  $parameters['address_street'] 	= $order->delivery['street_address'];
  $parameters['address_city'] 		= $order->delivery['city'];
  $parameters['address_zip'] 		= $order->delivery['postcode'];
  $parameters['address_state'] 		= $state_abbr;
  $parameters['address_country_code']	= $order->delivery['country']['iso_code_2'];
  $parameters['address_country']	= $order->delivery['country']['title'];
  $parameters['payer_email'] 		= $order->customer['email_address'];		  
 } else {	  
  $parameters['no_shipping'] = '1'; 
  $parameters['H_PhoneNumber'] 		  = $order->customer['telephone'];	  
  $parameters['first_name'] 		= $order->delivery['firstname'];
  $parameters['last_name'] 		= $order->delivery['lastname'];		
  $parameters['address1'] 		= $order->delivery['street_address'];
  $parameters['address2'] 		= $order->delivery['suburb'];
  $parameters['city'] 			= $order->delivery['city'];
  $parameters['zip'] 			= $order->delivery['postcode'];
  $parameters['state'] 			= $state_abbr;
  $parameters['country'] 			= $order->delivery['country']['iso_code_2'];
  $parameters['email'] 			= $order->customer['email_address'];   
	  }

Replace with:

	  // let's check what has been defined in the shop admin for the shipping address
  if (MODULE_PAYMENT_PAYPAL_IPN_SHIPPING == 'True') {
	$parameters['address_override'] = '1';
  }
  if ($order->content_type != 'virtual') {
	$parameters['no_shipping'] = '1';
	$parameters['H_PhoneNumber'] = $order->customer['telephone'];
	$parameters['first_name'] = $order->delivery['firstname'];
	$parameters['last_name'] = $order->delivery['lastname'];
	$parameters['address1'] = $order->delivery['street_address'];
	$parameters['address2'] = $order->delivery['suburb'];
	$parameters['city'] = $order->delivery['city'];
	$parameters['zip'] = $order->delivery['postcode'];
	$parameters['state'] = $state_abbr;
	$parameters['country'] = $order->delivery['country']['iso_code_2'];
	$parameters['email'] = $order->customer['email_address'];
  } else {	  
	$parameters['no_shipping'] = '1'; 
	$parameters['H_PhoneNumber'] = $order->customer['telephone'];
	$parameters['first_name'] = $order->billing['firstname'];
	$parameters['last_name'] = $order->billing['lastname'];
	$parameters['address1'] = $order->billing['street_address'];
	$parameters['address2'] = $order->billing['suburb'];
	$parameters['city'] = $order->billing['city'];
	$parameters['zip'] = $order->billing['postcode'];
	$parameters['state'] = $state_abbr;
	$parameters['country'] = $order->billing['country']['iso_code_2'];
	$parameters['email'] = $order->customer['email_address'];
  }

With this fix, you will always get pre-populated forms, and not showing any shipping address info at PayPal pages.

 

That's it.

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

And the above fix also took out the problem with pre-populating UK county field for customers without PayPal account. If the UK country field still not getting prepopulated, it probably because the country code you set in database is not the ISO country code 2.

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

And the above fix also took out the problem with pre-populating UK county field for customers without PayPal account. If the UK country field still not getting prepopulated, it probably because the country code you set in database is not the ISO country code 2.

Ah...Sorry, it is county, not country code. My mistake. Well, there is no way to send that county info to PayPal, so it will not be prepopulated.

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 didn't read through the user guide, please do so now. Your answer is in there.

 

Thank you for pointing this out! I've read it but it did not ring a bell, now it does.

 

Duplicate order problem

The PayPal IPN sends a parameter "invoice" to PayPal. This parameter is equal to the order ID (1,2,3,4 etc). However, PayPal requires the invoice parameter to be unique so if you have already sent an order ID with the same number, then it will be refused. Sending the same order ID can e.g. happen if you have two osCom shops linked to one PayPal account - the PayPal account cannot distinguish between different shops / domains / databases, it just looks at the number and says "hey, that's already been paid!"

 

To disable the multiple order id checking to to your PayPal account - > "Profile" - > "Payment Receiving Preferences". In there you will have the option:

 

Block accidental payments:

You may prevent accidental payments by blocking duplicate invoice IDs

Yes, block multiple payments per invoice ID

No, allow multiple payments per invoice ID

Select "No".

 

PayPal will now allow all orders to be paid, even if the order ID has already been paid previously. A potential problem is if customers pay an invoice twice by mistake (e.g. refreshing browser, hitting button twice etc.).

 

I'm using a testshop and thus running into the same orderid's sometimes.

 

There is a bug in osComm with tep_get_address_format(). If the address is queried from databse, the country name only shown with the first character. I can't fix this because this fuction called in too many places, and it works fine with the address in forms.

 

Is there any other way of solving this problem as the 1.2 version does not have this issue.

 

Thanks again!

Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Link to comment
Share on other sites

Maybe I'm not getting this?

 

I get this annoying error warning in Paypal:

 

"You have entered unsupported characters for this field. Current available language character types are: European, Chinese, Korean, Japanese, and Thai. Please try again."

 

In Danish we have these special charaters: æøå

I think they need to be "translated" so that Paypal can understand them? Many Danes, including city names etc. have these charaters in their name??

 

Used Alex's Address Pre-Populating Issue Fix - for v2.2:

 

No matter whether I set Force shipping address to False or True - Paypal insert the shipping adress fields as the Billing Address? I thought the shipping adress fields would be hidden - and only the Billing Address fields would be sent??

 

Helle

Link to comment
Share on other sites

Also in the adres part of the order confirmation the country is not send compleetly, all I'm getting is this: As you see the Netherlands is showing as N :(

Regarding the country problem - I had this issue on one site and it was linked to the latest code release in osCommerce: http://www.oscommerce.com/ext/update-20060817.html

Reversing the change in /includes/functions/general.php got rid of the issue, although I haven't looked into the implications of whether this poses a problem elsewhere.

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

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