Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Mark Evans

Official PayPal IPN Support Thread

Recommended Posts

The PayPal Verified status has been updated by paypal (verified with amount can only come from Paypal). Hardcoded into the file is a "no notify" for the completed status, so that is also correct. You have one more additional status than I do - shipped (you must change this yourself?)

 

If you always get "Processing" before your verified tag, then there is something wrong with that, unless it has been hardcoded into your file - check about line 111 in ipn.php for an array value of 'PayPal IPN Verified[' . $comment_status . ']'. If the word Processing is also there just remove it. If not then I don't have a guess.

 

All in all your ipn seems to be working. Well, as far as I can tell after combing these files for two days!!LOL

 

Sheri

P.S. you can check your error logs for anything strange around 6/23 at the time of the test for what might have happened there.

 

 

Ok I thought this was working properly, but possibly not. I receive all of the appropriate emails and so does the customer.

 

However, I have an order that was generated on 6/23 when I was testing. However, there is no order history. I am still in testing mode... However, all of the other orders had histories.

Share this post


Link to post
Share on other sites
The PayPal Verified status has been updated by paypal (verified with amount can only come from Paypal). Hardcoded into the file is a "no notify" for the completed status, so that is also correct. You have one more additional status than I do - shipped (you must change this yourself?)

 

If you always get "Processing" before your verified tag, then there is something wrong with that, unless it has been hardcoded into your file - check about line 111 in ipn.php for an array value of 'PayPal IPN Verified[' . $comment_status . ']'. If the word Processing is also there just remove it. If not then I don't have a guess.

 

All in all your ipn seems to be working. Well, as far as I can tell after combing these files for two days!!LOL

 

Sheri

P.S. you can check your error logs for anything strange around 6/23 at the time of the test for what might have happened there.

 

 

Yes ALL of my orders have "PROCESSING" before the verified tag. I will check the file. Thanks for your response...can you tell me where I can find the "error log."

Share this post


Link to post
Share on other sites
Yes ALL of my orders have "PROCESSING" before the verified tag. I will check the file. Thanks for your response...can you tell me where I can find the "error log."

 

Ok, duh I had it setup that way on the module. Instead of setting it to the IPN I set it to processing. So that status always showed up. In terms of the blank order, I just checked that out and that happened because I did not have my test account open in Paypal before trying to submit the order so it created an order. Then when I signed into Paypal development, I went back logged in again and the order was still sitting there. I completed the transaction and ANOTHER order was created, explaining why the previous order had no detail...

 

Interesting, anyway I deleted the order. I also noticed only received one notification because transaction was not completed on the prior order.

 

Terry

Share this post


Link to post
Share on other sites
Hi Steve,

 

As Terra explained it to me, the chdir is climbing out of the /ext/ folder structure towards the root in order to find app_top. So, my test site is in a folder in my root, so I needed to climb 4 (../../../../) levels to get to the "catalog" folder.

 

If you have your shop in the root, then I would guess it would be 3 levels.

 

HTH,

Sheri

 

 

Hi Sheri,

 

I'm not sure if that helps, but thanks. My latest hypothesis is that app_top IS found. In ipn.php, rather than do chdir('../../../../') I coded a little do-while loop with a counter, backing up one folder at a time chdir('../') until it found app_top, then I had it send me an email with the count. It correctly counted 4 levels back and indicated that it found app_top. Sadly, when app_top is called, app_top starts "require-ing" and cant find anything....I think. Duh.

 

 

Steve

Share this post


Link to post
Share on other sites
Sadly, when app_top is called, app_top starts "require-ing" and cant find anything....I think. Duh.

Steve

This is what I did, I hardcoded the address into the application top require: http://myaddress.com......

Then I put an email right after it. I got that email. Then I put an email inside EVERY if or else statement. I confirmed it was accessing the sandbox, cURL, that the parameters were verified and that the order number was correct. It was the call to the database that created the fatal error in app top because it cannot access configure.php properly from within the ext structure. The fatal error was located in an error log within the includes file where configure and application_top reside. After I fixed the chdir then all worked fine and I got the rest of the emails scattered throughout the file, and my order status was updated.

 

Have you checked the .htaccess in the includes folder?

 

I know that it is not supposed to make a difference, but do you have register globals On or Off? From PHP 4.2> register globals are automatically Off for security. I used to have the other IPN contrib installed but it "stopped" working for some reason and I couldn't figure it out why, so I installed this one that has greater support. But thinking back, there seems to be a correlation between the update of PHP offered by my host and IPN ceasing (I had stopped testing when I knew it worked!).

 

Not sure what else to suggest.

 

Sheri

Share this post


Link to post
Share on other sites
In terms of the blank order, I just checked that out and that happened because I did not have my test account open in Paypal before trying to submit the order so it created an order. Then when I signed into Paypal development, I went back logged in again and the order was still sitting there. I completed the transaction and ANOTHER order was created, explaining why the previous order had no detail...

Terry

 

Hi Terry,

I'm glad you sorted the processing problem out. Everytime you get to checkout_confirmation a order is "pre-registered" in the database. If you check the database there will actually be 2 rows for each order, one blank and one populated (if the order was attempted at paypal). They will have 2 different order_history_status_ids but the same order number. If there was a problem or the customer backed out and left, then only the blank order will remain.

 

Best,

Sheri

Share this post


Link to post
Share on other sites
This is what I did, I hardcoded the address into the application top require: http://myaddress.com......

Then I put an email right after it. I got that email. Then I put an email inside EVERY if or else statement. I confirmed it was accessing the sandbox, cURL, that the parameters were verified and that the order number was correct. It was the call to the database that created the fatal error in app top because it cannot access configure.php properly from within the ext structure. The fatal error was located in an error log within the includes file where configure and application_top reside. After I fixed the chdir then all worked fine and I got the rest of the emails scattered throughout the file, and my order status was updated.

 

Have you checked the .htaccess in the includes folder?

 

I know that it is not supposed to make a difference, but do you have register globals On or Off? From PHP 4.2> register globals are automatically Off for security. I used to have the other IPN contrib installed but it "stopped" working for some reason and I couldn't figure it out why, so I installed this one that has greater support. But thinking back, there seems to be a correlation between the update of PHP offered by my host and IPN ceasing (I had stopped testing when I knew it worked!).

 

Not sure what else to suggest.

 

Sheri

 

Hey Sheri, Thanks for your help. I do have it successfully finding app_top, either by hard-coding or my little loop I mentioned earlier. And now I am getting no errors in the cPanel error log, and I have none of the other error_logs you mentioned. But still, it does not get beyond loading app_top. Like you, I have scattered emails throughout ipn.php. Also, like you I noticed that configure.php wasnt being loaded properly. That was causing an error which showed up in the logs as app_top tried to require something, but I've worked around that, and as I mentioned, no more errors are logging anywhere that I can tell. Right now, I am stumped.

 

Steve

Share this post


Link to post
Share on other sites
This is what I did, I hardcoded the address into the application top require: http://myaddress.com......

Then I put an email right after it. I got that email. Then I put an email inside EVERY if or else statement. I confirmed it was accessing the sandbox, cURL, that the parameters were verified and that the order number was correct. It was the call to the database that created the fatal error in app top because it cannot access configure.php properly from within the ext structure. The fatal error was located in an error log within the includes file where configure and application_top reside. After I fixed the chdir then all worked fine and I got the rest of the emails scattered throughout the file, and my order status was updated.

 

Have you checked the .htaccess in the includes folder?

 

I know that it is not supposed to make a difference, but do you have register globals On or Off? From PHP 4.2> register globals are automatically Off for security. I used to have the other IPN contrib installed but it "stopped" working for some reason and I couldn't figure it out why, so I installed this one that has greater support. But thinking back, there seems to be a correlation between the update of PHP offered by my host and IPN ceasing (I had stopped testing when I knew it worked!).

 

Not sure what else to suggest.

 

Sheri

 

I'm thinking of bypassing app_top. Wondering if I can extract the necessary stuff out of app_top and put it in a file alongside ipn.php and call it instead of app_top. Hmmmm...

 

 

Steve

Share this post


Link to post
Share on other sites

Well I'm still on the thread :lol:

 

Now that I have IPN working I would like to harvest some of the other data available from paypal: names, addys, fees.

 

I have added the new fields to the db in the order_status_history table and tried the easiest route first by naming the $_POST variables from the paypal form and inserting them into the db. Whoops! Didn't work :blush:

 

Do I have to first declare these as parameters in paypal_ipn.php before I can get the values in ipn.php?

 

Thanks, any knowledge appreciated :thumbsup:

 

Sheri

Share this post


Link to post
Share on other sites
I'm thinking of bypassing app_top. Wondering if I can extract the necessary stuff out of app_top and put it in a file alongside ipn.php and call it instead of app_top. Hmmmm...

Steve

 

 

It worked. All the way to "Pending" on acknowledged order status.

 

To tell the truth, I hate low-level coding. Much prefer application design, integrating technology with the business model. But, when push comes to shove...God, I'm good.

;)

Steve

Share this post


Link to post
Share on other sites
But, when push comes to shove...God, I'm good.

;)

Steve

 

Self praise is better than none :lol: :lol: Glad you got it working...now to integrate wishlist :x

Share this post


Link to post
Share on other sites
Self praise is better than none :lol: :lol: Glad you got it working...now to integrate wishlist :x

 

I may have spoken to soon. I corrected one little error in my dummy app_top, and it stopped working. Put the error back, and it is now working.

 

The error was a simple include at the bottom of my dummy app_top that contained an invalid path: include('../../../../includes/includes/modules/autologon.php');

 

Now why in the world would having this error, which showed up in my cPanel error log, make a difference? More testing, I guess.

 

Damn.

Steve

Share this post


Link to post
Share on other sites
I may have spoken to soon. I corrected one little error in my dummy app_top, and it stopped working. Put the error back, and it is now working.

 

The error was a simple include at the bottom of my dummy app_top that contained an invalid path: include('../../../../includes/includes/modules/autologon.php');

 

Now why in the world would having this error, which showed up in my cPanel error log, make a difference? More testing, I guess.

 

Damn.

Steve

 

 

Got it working. Deleted some code at the bottom of my dummy app_top which was from an autologon contribution. Am wondering if this is the reason application_top misbehaved in the first place...?

 

Thanks for listening.

Steve

Share this post


Link to post
Share on other sites
I may have spoken to soon. I corrected one little error in my dummy app_top, and it stopped working. Put the error back, and it is now working.

 

The error was a simple include at the bottom of my dummy app_top that contained an invalid path: include('../../../../includes/includes/modules/autologon.php');

 

Now why in the world would having this error, which showed up in my cPanel error log, make a difference? More testing, I guess.

 

Damn.

Steve

 

 

Got it working. Deleted some code at the bottom of my dummy app_top which was from an autologon contribution. Am wondering if this is the reason application_top misbehaved in the first place...?

 

Thanks for listening.

Steve

Share this post


Link to post
Share on other sites
...now to integrate wishlist :x

 

To anyone else using or wanting to use Wishlist 3.5d, I successfully integrated it with Paypal IPN.

 

To make Wishlist work as intended in catalog/includes/modules/payment/paypal_ipn.php

 

Add the same line that you added to checkout_process.php:

 

// remove items from wishlist if customer purchased them

$wishList->clear();

 

here:

 

/ 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);
  }
  // remove items from wishlist if customer purchased them
 $wishList->clear();

// load the after_process function from the payment modules
  $this->after_process();

  $cart->reset(true);

 

And you must also add $wishList here:

 

/ Terra missing attribute fix start
function before_process() {
  global $customer_id, $order, $sendto, $billto, $payment, $languages_id, $currencies, $cart, $cart_PayPal_IPN_ID, $wishList;
  global $$payment;
// Terra missing attribute fix end

 

Keep in mind that I have the register globals patch installed.

 

Best,

Sheri

Edited by muskokee

Share this post


Link to post
Share on other sites

Yup, still a workin' on this contrib! If my test orders were real money I'd be rich! LOL

 

I accept echecks and my products are downloads...so any completed transaction through paypal was giving the purchaser immediate access. Great for paypal blanace transfers, credit cards etc but NO good for echecks which take a week to clear.

 

So I modified the code in ipn.php a little to only allow completed and verified ($ in your account kind of verified) to have immediate download access. Everything else stays at "Preparing" with the reason attached.

 

OLD CODE IN ipn.php:

$comment_status = $_POST['payment_status'] . ' (' . ucfirst($_POST['payer_status']) . '; ' . $currencies->format($_POST['mc_gross'], false, $_POST['mc_currency']) . ')';

	if ($_POST['payment_status'] == 'Pending') {
	  $comment_status .= '; ' . $_POST['pending_reason'];
	} elseif ( ($_POST['payment_status'] == 'Reversed') || ($_POST['payment_status'] == 'Refunded') ) {
	  $comment_status .= '; ' . $_POST['reason_code'];
	}

	$order_status_id = DEFAULT_ORDERS_STATUS_ID;

	if ($_POST['mc_gross'] == number_format($total['value'] * $order['currency_value'], $currencies->get_decimal_places($order['currency']))) {
	  if (MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0) {
		$order_status_id = MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID;
	  }
	}

	tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . $order_status_id . "', last_modified = now() where orders_id = '" . $_POST['invoice'] . "'");

 

NEW CODE IN ipn.php:

$comment_status = $_POST['payment_status'] . ' (' . ucfirst($_POST['payer_status']) . '; ' . $currencies->format($_POST['mc_gross'], false, $_POST['mc_currency']) . ')';

	$order_status_id = DEFAULT_ORDERS_STATUS_ID;

	if ($_POST['payment_status'] == 'Pending') {
	  $comment_status .= '; ' . $_POST['pending_reason'];
	} elseif ( ($_POST['payment_status'] == 'Reversed') || ($_POST['payment_status'] == 'Refunded') ) {
	  $comment_status .= '; ' . $_POST['reason_code'];
	} else {
	 if ($_POST['mc_gross'] == number_format($total['value'] * $order['currency_value'], $currencies->get_decimal_places($order['currency']))) {
	  if (MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0) {
		$order_status_id = MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID;
	  }
	}
	}

	tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . $order_status_id . "', last_modified = now() where orders_id = '" . $_POST['invoice'] . "'");

 

 

Best,

Sheri

Share this post


Link to post
Share on other sites

Hi all,

 

I'm relatively new to osCommerce.I've spent under 10 hours customizing and understanding all the features.

 

I installed the Paypal IPN support but it doesn't seem to be working for me.

I followed the exact instruction but I do have 2 questions.

 

1. Does the read/write/execute properties matter?

 

When I uploaded the necessary files it defaulted to the following:

Owner:Read/Write

Group:Read

World:Read

 

I'm just curious because the original paypal module that was included had different properties.

 

2. When I go to the checkout with my test account, there is no option under the payment method. I did enable the module through the admin panel as the instructions said. Since there is no payment method, I can go through the checkout process.

 

 

Thanks all, I hope it wasn't a stupid mistake on my part.

Edited by zenapparel.com

Share this post


Link to post
Share on other sites
2. When I go to the checkout with my test account, there is no option under the payment method. I did enable the module through the admin panel as the instructions said. Since there is no payment method, I can go through the checkout process.

Thanks all, I hope it wasn't a stupid mistake on my part.

 

What about shipping methode's?

 

Are there any or any other payment methode's your using?

 

If not, try to add one just for testing.


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites
When I uploaded the necessary files it defaulted to the following:

Owner:Read/Write

Group:Read

World:Read

 

When I go to the checkout with my test account, there is no option under the payment method. I did enable the module through the admin panel as the instructions said. Since there is no payment method, I can go through the checkout process.

I once had a problem where two payment modules were enabled and both had the same sort order - can't remember if only one or none displayed, but giving unique sort order numbers solved it.

 

As for file permissions - when you go through checkout, it's only the paypal_ipn.php file which is called and on my test server it has 644 - the same as you, so that's correct.

 

The most likely cause for the payment method not to show up in checkout is a wrong file in the wrong location (module level / language level - missing or mixed up), so I'd double-check that.

 

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

Getting dredded message 5302 from paypal and I don't know where to look.

 

Prototyping on windows xp with IIS, have register globals contribution, PayPal IPN v1.3 contribution, php5.14.

 

Established my private key, public certificate using OpenSsl. Uploaded my certificate and obtained my cert_id. Dowloaded paypals public certificate.

 

Using paypal sandbox. Unencrypted works fine. but when trying to encrypt get the 5302 error. Is this a total inability to communicate? Where to look?

 

DudePro

Share this post


Link to post
Share on other sites
Getting dredded message 5302 from paypal and I don't know where to look.

 

Prototyping on windows xp with IIS, have register globals contribution, PayPal IPN v1.3 contribution, php5.14.

 

Established my private key, public certificate using OpenSsl. Uploaded my certificate and obtained my cert_id. Dowloaded paypals public certificate.

 

Using paypal sandbox. Unencrypted works fine. but when trying to encrypt get the 5302 error. Is this a total inability to communicate? Where to look?

 

DudePro

 

Seems it is php file_get_contents on XP. file_get_contents('/paypal/paypal_cert_pem.txt'); doesn't work. file_get_contents('/paypal/paypalpub.txt'); does work.

 

What can I say?

 

DudePro

Edited by DudePro

Share this post


Link to post
Share on other sites

DudePro, did you ever try to rename the paypal's public cert to paypal_cert.pem? Once you renamed that file, you also need to change the file name in the IPN module settings.


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.

Share this post


Link to post
Share on other sites
Guest

Hi guys,

This is my first post. I've been reading a lot about the ipn.

I installed the IPN last night. I have a problem and would like to get advice from anyone on how to troubleshoot this.

My problem is: When an order is placed, IPN does it's job and I can see it's status as Preparing. If order is completed, then it goes into Pending. Then I get an email from Paypal confirming the payment was made etc.. I do not get any emails from my store.

In fact, I never got any emails from my store upon placing any order, I have it set to send 2 emails one is the usual confirmation the other is an additional confirmation email address. I installed ipn but this email issue has not changed a bit.

Anyone with the same issue? know a fix? any mods out there?

 

Thanks guys!! I'm glad I could belong to this community.

Share this post


Link to post
Share on other sites
Guest

Sorry for posting again. Wanted to mention the ipn I installed was osCommerce PayPal IPN Module v1.3 For 2.2MS2. Does this have a fix for the store confirmation email issue or should I use v1.2 ? Terra?

Share this post


Link to post
Share on other sites

Hi I have tested this contribution and everything appears okay, except for the fact that when I go into Adminstration it says PaypalIPN - 1, but when I click on the link and it takes me to orders there is nothing there. Can someone tell me what the problem might be?

 

Thanks,

 

Terry

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

×