Jump to content
Mark Evans

Official PayPal IPN Support Thread

Recommended Posts

Hi,

 

I have installed version 2.1.0.0 and I have an issue with languages.

 

The contribution works like a charm except that all purchase confirmations are sent in French (default language) instead of the language used by the customer (i.e. English or Spanish).

 

How can I solve this issue?

 

Also, I can see that the data in /shop/includes\languages/english\modules/payment/paypal_ipn.php is not used for the message sent to the customer.

 

Sincerely,

 

Amar

Share this post


Link to post
Share on other sites
I have installed version 2.1.0.0 and I have an issue with languages. The contribution works like a charm except that all purchase confirmations are sent in French (default language) instead of the language used by the customer (i.e. English or Spanish).

Amar - the PayPal IPN chooses the language based on the country of the customer (i.e. primary address in address book). The code is:

 $parameters['lc'] = $order->customer['country']['iso_code_2'];

To test this, you must change the primary address to e.g. UK. Just changing the shop language won't work.

 

This has been done based on PayPal's developer guide which states that the localisation (lc) is done based on country, not language. The variable transmitted must be in the format ISO Code 2.

 

It's not an ideal solution in my view as the customer's language & country are two different things (prime example: Switzerland with 3 official languages within 1 country) but that's how PayPal works.

 

all the best - Terra

Edited by Terra

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

and how to solve the invoice already paid error

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

Share this post


Link to post
Share on other sites

Hi Terra,

 

Thanks for your reply.

 

I have seen this part of the code inside paypal_ipn.php

$parameters['lc'] = $order->customer['country']['iso_code_2'];

and I've replaced it with:

  
  if ( $languages_id ==1 ) // français
  {
	  $languages_idcode = 'fr';
  }

  if ( $languages_id ==2 ) // english
  {
	  $languages_idcode = 'en';
  }

  if ( $languages_id ==3 ) // español
  {
	  $languages_idcode = 'es';
  }

  if ( $languages_id > 1 ) // if not French which is my default language
  {
 $parameters['lc'] =  $languages_idcode;
  }

But, tell me if I'm wrong, it's used only for displaying PayPal's interface in the user's language. This is not the issue I'm talking about.

 

My issue is that, even if both osCommerce shop and PayPal interfaces are in English or Spanish, the message sent automatically to the customer after a purchase is in French. This is not good.

 

I believe the problem occurs when the script returns back from PayPal to the shop, it loses the current user's language.

 

I can see that in the new version of: ext\modules\payment\paypal_ipn\ipn.php there is no more:

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

 

Sincerely,

 

Amar

Share this post


Link to post
Share on other sites
It is not another paypal module it's the regular module. You buy and click pay and brings you to the paypal website to pay. It just to work a long time ago. Something is not working correct because the only info that Paypal gets without me doing anything is the email. Any ideas?

Anyone Please

Share this post


Link to post
Share on other sites

when using this mod as the payment option, i notice that the buyer doesnt have to put in his address and informaiton as to where he might want it shipped.

 

if they dispute the sale with paypal, wont paypal rule in their favor even with a tracking number provided since they arent putting a ship to address?

 

also, i have the paypal fee option installed on my site, and when i have the paypal ipn transaction type set to per item, and they get to the last page before they goto paypal to pay, the paypal fee is there, then when they goto paypal, the fee is gone. when i have then set it to Aggregate, the paypal fee is given to paypal and the order total is correct. how can i fix this to work as per item option? id like to have the sale fully recorded with paypal.

 

thanks

Share this post


Link to post
Share on other sites
Hi Terra,

 

Thanks for your reply.

 

I have seen this part of the code inside paypal_ipn.php

$parameters['lc'] = $order->customer['country']['iso_code_2'];

and I've replaced it with:

  
  if ( $languages_id ==1 ) // français
  {
	  $languages_idcode = 'fr';
  }

  if ( $languages_id ==2 ) // english
  {
	  $languages_idcode = 'en';
  }

  if ( $languages_id ==3 ) // español
  {
	  $languages_idcode = 'es';
  }

  if ( $languages_id > 1 ) // if not French which is my default language
  {
 $parameters['lc'] =  $languages_idcode;
  }

But, tell me if I'm wrong, it's used only for displaying PayPal's interface in the user's language. This is not the issue I'm talking about.

 

My issue is that, even if both osCommerce shop and PayPal interfaces are in English or Spanish, the message sent automatically to the customer after a purchase is in French. This is not good.

 

I believe the problem occurs when the script returns back from PayPal to the shop, it loses the current user's language.

 

I can see that in the new version of: ext\modules\payment\paypal_ipn\ipn.php there is no more:

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

 

Sincerely,

 

Amar

Regarding email - yes, I can see the problem, will need to look into this.

 

Regarding your changed code - as far as I know PayPal needs the country iso code 2. "ES" is the correct iso code 2 for Spain, "FR" for France, but "EN" does not exist. It's either "GB" for England or "US" for the USA. You will need to make a call whether you want to direct customers to the British or US PayPal portal. A full list of ISO codes is here: http://userpage.chemie.fu-berlin.de/divers...c/ISO_3166.html

 

all the best - Terra

Edited by Terra

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

and how to solve the invoice already paid error

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

Share this post


Link to post
Share on other sites

Update on Country Codes - Currently PayPal only supports: AU, DE, FR, IT, GB, ES, US. Anything else defaults to US. Please see PayPal's Website Payments Standard for more information (page 122). The country code with variable name "lc" defines the language of the log in page. 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

BUG FIX - MULTI LANGUAGE SHOPS

PayPal IPN v2.2

 

Symptoms: order emails are sent out in wrong language as reported in post below:

My issue is that, even if both osCommerce shop and PayPal interfaces are in English or Spanish, the message sent automatically to the customer after a purchase is in French. This is not good.

Fix:

In /includes/modules/payment/paypal_ipn.php find this line:

$parameters['notify_url'] = tep_href_link('ext/modules/payment/paypal_ipn/ipn.php', '', 'SSL', false, false);

and replace with this:

$parameters['notify_url'] = tep_href_link('ext/modules/payment/paypal_ipn/ipn.php', 'language=' . $_SESSION['language'], 'SSL', false, false);

 

In /ext/modules/payment/paypal/ipn.php find this line:

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

and replace with this:

include(DIR_WS_LANGUAGES . $_GET['language'] . '/' . FILENAME_CHECKOUT_PROCESS);

 

Developer information: the amended code appends the customer's language as a GET variable to the notify url, ensuring that the ipn file selects the correct language file. Code assumes that PHP version is 4.1.0 or higher.

 

Keywords: PayPal, PayPal IPN, language, order email, wrong language, language error.

 

This fix will be incorporated into the next release (v2.3) but until then, multi-language shops should apply the above fix. Tested on standard osCom shop with English & German orders.

 

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

Hi Terra,

 

Thanks for being so responsive.

 

I don't know if I'm right, but in /ext/modules/payment/paypal_ipn/ipn.php this line was missing:

CODEinclude(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

 

I've added the new code just below line 15

  require('includes/application_top.php');

 

Thanks again.

 

Amar

Share this post


Link to post
Share on other sites
I don't know if I'm right, but in /ext/modules/payment/paypal_ipn/ipn.php this line was missing:

CODEinclude(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

I've checked my files and the line has been included in all 3 packages sine version 2.0 ... if you used one of my uploaded 2.x packages, then it definitely should have been there (line was introduced in v2.0 for the first time). But like you pointed out, the session language was lost (as the ipn.php operates outside the customer's session id), so it went to default language. All the best - Terra

PS: the line where you included the code is correct.


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

Hi,

 

I can see, line 147, that there's nothing below this line:

// If the order is pending, then we want to send a notification email to the customer

 

Is this the reason why the email isn't sent to the customer for a pending order?

 

Suincerely,

Amar

Share this post


Link to post
Share on other sites
Is this the reason why the email isn't sent to the customer for a pending order?

upsadaisy - looks like some code didn't make it into the final contrib package ... will be added in 2.3. 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
I can see, line 147, that there's nothing below this line:

// If the order is pending, then we want to send a notification email to the customer

Is this the reason why the email isn't sent to the customer for a pending order?

upsadaisy - looks like some code didn't make it into the final contrib package ... will be added in 2.3. Terra

No - ignore - it's all there. From line 280 or thereabouts onwards:

 if ($_POST['payment_status'] == 'Pending') { // START STATUS == PENDING LOOP

 $email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $_POST['invoice'] . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $_POST['invoice'], 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n" . 
			 EMAIL_SEPARATOR . "\n" .
			 EMAIL_PAYPAL_PENDING_NOTICE . "\n\n"; 

 tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);


// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 } 
} // END STATUS == PENDING LOOP

That's what gets sent out if the status is pending. I'll change the comment for v2.3 but the actual code is correct. 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

Hello, i just downloaded the 2.2 module and placed all the files inside my ftp, but the module still does not show up inside the administrator panel. Could i have done something wrong? If so, does anyone know why this is happening?

 

Thank you,

Uri

Share this post


Link to post
Share on other sites

Check the folder where the payment modules are to be placed(includes/modules/payment) if A file is found ther withextension .php then in admin it is displayed as ana available option.

 

 

Satish


Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Share this post


Link to post
Share on other sites

Using the recently installed v2.2 we have the problem that osC-order status remains Preparing [PayPal IPN] and (probably) therefore no confirmation emails are send. The Paypal transaction is completed however, since we receive payment in our PayPal-account. No changes in default PayPal-profile settings are made. Does anyone have an idea?

Share this post


Link to post
Share on other sites

there are a few files, inside Catalog/ext/modules/payment

aswell as inside catalog/includes/modules/payment.

 

They are authorizenet, cc, cod, ipayment, ipn, moneyorder, nochex, paypal, paypal_ipn, pm2chekout, psigate, and secpay.

 

Are these the wrong ones? the instructions said to just drop the whole folder into the directory. which added those files to the payment folder, and added the catalog/ext folder with the file.

Share this post


Link to post
Share on other sites
Generic Guide - if ipn.php is not updating the order
Using the recently installed v2.2 we have the problem that osC-order status remains Preparing [PayPal IPN] and (probably) therefore no confirmation emails are send.

Please check post 2033 on page 102. 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

I'm running PayPal IPN 2.1 and have a problem:

 

When orders are placed, the products_ordered field isn't updating, which means the best sellers list isn't working; nor is the admin report on products purchased (I don't know if there are other ramifications but would like to avoid them too!).

 

I don't know if it's related, but all orders are staying as "Preparing [PayPal IPN]" even after clicking the confirmation in the Sandbox pages and returning to the store. This isn't really a problem, as the store owner (I'm just developing the site) will be able to update that after payment confirmation has been received from PayPal.

 

I can only find five files that use the products_ordered field, but don't know the detail of how it's supposed to work or what's wrong. I'm happy to copy in code if you can tell me what's needed.

 

Any suggestions gratefully received, as this seems to be the only thing stopping the store going live now.

 

Many thanks,

 

 

 

Adam

Share this post


Link to post
Share on other sites

We've had PayPal_Shopping_Cart_IPN_v3.0a MS2-2.2OverWriteAndRun working for some time now (several month's) but it never transferred the item name or any information on to PayPal, only the total amount osc calculated and our store name as the item. (I skipped the sandbox & tested it live ~ it was quick!)

I started investigating and found I had done a pretty poor install - several files were missing or wrong, and the whole (IPN) PayPal admin module was missing.

 

During the manual re-install I noticed some odd behavior about this file /includes/modules/payment/paypal.php (it's got some kind of invisible connection that I don't understand).

 

Everything works now except this:

error results when clicking Paypal IPN under customers in admin

 

Fatal error: Cannot use object of type PayPal_Page as array in /.../includes/modules/payment/paypal/templates/osC_Admin.tpl.php on line 27

 

line 27 reads:

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="<?php echo $page['onLoad']; ?>">

:blink: I know I know, only an idiot could screw this up. But I sure would like to hear some ideas. Thank You!

Share this post


Link to post
Share on other sites
We've had PayPal_Shopping_Cart_IPN_v3.0a MS2-2.2OverWriteAndRun working for some time now

This is the wrong support thread - you are using a different module. Please don't post in this thread as it only confuses the 100+ page thread. Please either use the support thread of the module you have installed or start a new thread. This thread is ONLY for this contribution: http://www.oscommerce.com/community/contributions,2679 Many thanks for your co-operation. 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
I'm running PayPal IPN 2.1 and have a problem:

 

When orders are placed, the products_ordered field isn't updating, which means the best sellers list isn't working; nor is the admin report on products purchased (I don't know if there are other ramifications but would like to avoid them too!).

 

I don't know if it's related, but all orders are staying as "Preparing [PayPal IPN]" even after clicking the confirmation in the Sandbox pages and returning to the store. This isn't really a problem, as the store owner (I'm just developing the site) will be able to update that after payment confirmation has been received from PayPal.

 

I can only find five files that use the products_ordered field, but don't know the detail of how it's supposed to work or what's wrong. I'm happy to copy in code if you can tell me what's needed.

 

Any suggestions gratefully received, as this seems to be the only thing stopping the store going live now.

 

Many thanks,

 

 

 

Adam

 

 

 

Just upgraded to 2.2 and read the readme - it looks as though the IPN reply is failing, which is why the order status and products_ordered aren't being updated. Any ideas on why this can happen?

Share this post


Link to post
Share on other sites

Upgraded to 2.2 today and all seems well.

 

Just a cosmetic query... I want to have a graphic on the payment page beside "PayPal" and have done so via the language file.

 

 define('MODULE_PAYMENT_PAYPAL_IPN_TEXT_TITLE', 'PayPal   <img src=images/ccards/paypal.gif>');

 

But this also gives me the (broken) image on the admin side which I don't want. I don't want an image on the admin side at all so fixing the path is not my goal.

 

Purely a cosmetic thing, but is there an easy way to define the title separately for admin?

Share this post


Link to post
Share on other sites
Thanks for this great contribution. I just installed and run a test. it give me this error when I tried to check out.

Warning: fopen(/570732-2-data.txt) [function.fopen]: failed to open stream: Permission denied in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 426

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 427

Warning: fclose(): supplied argument is not a valid stream resource in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 428

Warning: file_get_contents(xxxx) [function.file-get-contents]: failed to open stream: No such file or directory in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 433

Warning: openssl_pkcs7_sign() [function.openssl-pkcs7-sign]: error getting private key in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 433

Warning: unlink(/570732-2-data.txt) [function.unlink]: No such file or directory in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 435

Warning: file_get_contents(/570732-2-signed.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 438

Warning: fopen(/570732-2-signed.txt) [function.fopen]: failed to open stream: Permission denied in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 442

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 443

Warning: fclose(): supplied argument is not a valid stream resource in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 444

Warning: unlink(/570732-2-signed.txt) [function.unlink]: No such file or directory in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 450

Warning: file_get_contents(/570732-2-encrypted.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 453

Warning: unlink(/570732-2-encrypted.txt) [function.unlink]: No such file or directory in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 457

 

What have I done wrong?

I know there are some settings I really don't know what should I put in and it might created this error.

 

I don't know much about PHP, Anybody can help me out?

 

Thanks in advanced!

 

 

The problem here is that expected files are not there when called. Looks like u have a number of such instances such as:

 

Warning: fopen(/570732-2-data.txt)

Warning: file_get_contents(/570732-2-signed.txt)

Warning: file_get_contents(/570732-2-encrypted.txt)

 

One possible reason for this is the permissions set on the directories, set them all to 777 will fix the problem.

 

However looking at your error messages I think the files in your case are not being found as you have not set the directories up in the first place. Here is what I would try:

 

Step One

ftp your site and create some directories to hold the files, any will do, such as for example:

 

in the public_html directory create: keys

then in the keys directory create: public_cert, private_key, paypal_pub_key and temp.

 

Step Two

Now copy your public certificate into the public_cert directory, your private key into your private_key directory, the paypal public key into the paypal_pub_key directory, and leave the temp directory empty.

 

Step Three

Set the permissions on all the directories you have just made to 777

 

Step Four

Now go to admin->modules and click the Credit/Debit Card (via PayPal) module and enter the following:

 

under "your private key" enter:

/home/sites/xxxx.co.uk/public_html/keys/private_key/whatever_u_have_called_yr_key.pem

 

under "Your Public Certificate" enter:

/home/sites/xxxx.co.uk/public_html/keys/public_cert/whatever_u_have_called_yr_pub_cert.pem

 

under "PayPals Public Certificate" enter

/home/sites/xxxx.co.uk/public_html/keys/paypal_pub_key/paypal_cert_pem.txt

 

under "Your PayPal Public Certificate ID" enter

code given to you by paypal

 

under "Working Directory" enter

/home/sites/xxxx.co.uk/public_html/keys/temp/

 

under "OpenSSL Location" enter

/usr/bin/openssl

 

 

That should fix yr problem. For anyone else wondering exactly the correct path to reference the directories you make then look at the error message and it is the same as the start of the path for the paypal_ipn.php file ie higlighted in red for this case here

 

Warning: fopen(/570732-2-data.txt) [function.fopen]: failed to open stream: Permission denied in /home/sites/xxxx.co.uk/public_html/catalog/includes/modules/payment/paypal_ipn.php on line 426

 

Hope this helps you

Edited by D_W

Share this post


Link to post
Share on other sites

Also the minimum permissions for the above directories are as follows:

 

temp 300

public_cert 100

private_key 100

paypal_pub_key 100

 

which are better than 777 for security reasons, but 777 is handy while you are testing.

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

×