Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Paypal Order Emails Not Being Sent


JunkMumbles

Recommended Posts

Hi All.

 

My Orders thru paypal are showing up in the Admin Panel. But I do not get an email. Just started happening. Does anyone have ideas or that can give me a link to a thread. Ive searched and searched this forum, I know its right under my nose.

Link to comment
Share on other sites

Hi Guys,

 

I am having the same issue (ever since we have recently set up our store).

 

 

The buyer is directed to paypal & makes the payment - at this point paypal sends out an email, and the IPN is registered successfully in the osCommerce Admin panel.

 

However, the email from the oscommerce store is NOT sent out on receiving the IPN. How can i make the store send out an email as soon as it successfully receives the IPN from paypal?

 

The store email is only sent if/when the buyer clicks the button to return to store (can't use auto-return all the time as we do not require our buyers to have paypal accounts).

 

 

We're using Online Merchant v2.2 RC2 and the Paypal Website Payments Standard module (v1.0) (/includes/modules/paypal_standard.php)

 

 

Any help would be appreciated!

Thanks,

R

Link to comment
Share on other sites

  • 4 weeks later...

I'm having the same problem! :angry:

 

When I tested the module, using my own e-mail address, it worked perfectly. But since adding the store owners e-mail address, it hasn't worked on any orders at all! It's very frustrating & as yet, it appears no-one seems to have any answer? :huh:

 

Anyone managed to fix this problem? Or anyone else have any idea what's going on?

 

Has anyone tried uninstalling & re-installing the module?

Link to comment
Share on other sites

I'm using PayPal Website Payments Standard. Assuming the order e-mail is sent when the buyer returns to the site from Paypal using auto return the problem could be that I've just noticed that I don't have an ipn.php page in my store!! Is this where the issue lies?

 

So should I be redirecting to checkout_success.php instead? Or to http://www.website.co.uk/ext/payment/paypal/standard_ipn.php which does exist?

 

I followed the instructions from a tutorial to the letter, but obviously something isn't working right!

Link to comment
Share on other sites

Few random notes that might be relevant :

 

1) Paypal "autoreturn" only works for users with paypal accounts - NOT for users who just directly pay with their credit card without logging in.

 

2) I think checkout_success.php is the page customers need to be returned to.

 

3) Not sure what the IPN url needs to be - i've seen a bunch of different ones on the forum. I think most of them work -- but none of them seemed to send out the STORE email when the IPN was received (the email was only sent when the customer returned to checkout_success.php.

 

4) We got a company to modify our code so that a new order confirmation email was sent as soon as the IPN was received. We turned off the store emails. This works for well us at the moment.

 

cheers,

R

Link to comment
Share on other sites

  • 3 months later...

Hi,

 

I am still havign trouble with this it seems that only some emails are being sent - and it is actually affecting my stock count - has any one figured this out?

Link to comment
Share on other sites

Provide following details :

Which Paypal version in use.

If emails not received dross check Your spam filter.

Also make sure IPN are recd.

 

Stock deduction is handled thru IPN so make sure IPN is recd.

 

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.

Link to comment
Share on other sites

  • 3 weeks later...

Few random notes that might be relevant :

 

....

 

3) Not sure what the IPN url needs to be - i've seen a bunch of different ones on the forum. I think most of them work -- but none of them seemed to send out the STORE email when the IPN was received (the email was only sent when the customer returned to checkout_success.php.

 

....

 

cheers,

R

 

Wow, a company?

what's the solution they gave you?

:P

Link to comment
Share on other sites

Explanation and note that might help:

 

Paypal uses IPN(Instant Payment notification a backend system).

 

When a Payment is made to Your account.An IPN is posted to notify url path(If IPN is enabled on Your Paypal profile).

(This backend system all because some previous Paypal modules were hacked by some smart purchasers and got there order thru without payment done).

 

Now the IPN.php file will apply its logic over the IPN post recd.

It checks for the order amount to the payment amount recd plus some more issues that hackers trick in to get thru.

If it fails in any of the cases then order status is not updated but a debug email is sent to the shop owner(if configured).

 

 

Conclusion : If order status not getting updated check that IPNs are coming.

If they are coming make sure that if payment fails then an email is generated and sent to the amdin email.

 

 

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.

Link to comment
Share on other sites

  • 1 month later...

I also am having this problem, no email sent but Paypal emailing me telling me that I have a payment, but what for?? I am having to email customers for their orders.

Very frustrating.

 

Which Paypal module You are using.

 

First and foremost make sure IPN is set on in Your Paypal profile and IPNs are reaching Your site.

 

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.

Link to comment
Share on other sites

Which Paypal module You are using.

 

First and foremost make sure IPN is set on in Your Paypal profile and IPNs are reaching Your site.

 

Satish

 

I am using Paypal Website Payments Standard.

The orders are in my admin site and I do get an email from Paypal with payment details and address of customer etc.

Link to comment
Share on other sites

  • 2 months later...

This is the exact problem we are having.

 

The Certified PayPal Website Payments Standard works great for us if our customers login to their PayPal account. If they pay with a credit card without logging in, we are alerted with an note from PayPal, but then need to login to the osCommerce Admin area to find out what they ordered.

 

Is there a PayPal Website Payments Standard version 2 in the making?

Link to comment
Share on other sites

  • 3 years later...

Explanation and note that might help:

 

Paypal uses IPN(Instant Payment notification a backend system).

 

When a Payment is made to Your account.An IPN is posted to notify url path(If IPN is enabled on Your Paypal profile).

(This backend system all because some previous Paypal modules were hacked by some smart purchasers and got there order thru without payment done).

 

Now the IPN.php file will apply its logic over the IPN post recd.

It checks for the order amount to the payment amount recd plus some more issues that hackers trick in to get thru.

If it fails in any of the cases then order status is not updated but a debug email is sent to the shop owner(if configured).

 

 

Conclusion : If order status not getting updated check that IPNs are coming.

If they are coming make sure that if payment fails then an email is generated and sent to the amdin email.

 

 

Satish

 

Hi

 

I too am now having problems using Paypal Website Payments Standard. My stock is not decremented nor is OSC sending me the order emails. I am receiving the PayPal IPN Verified (in the order history), however it seems it comes through as: "PayPal IPN Verified [Completed (Unverified; $17.85)]" for example. I'm assuming the "Unverified" part is because this was a non-Paypal account (ie credit card) order.

 

It's a good thing Paypal send me the money received email, otherwise I wouldn't know if anybody ordered anything.

 

Any solution on this? Is this problem unique to Paypal Website Payments Standard? Or are other payment modules having similar issues?

 

Some items I found while researching a solution to this:

 

Auto Return for Website Payments (Profile>My Selling Tools>Selling online(+/-)>Website preferences):

This one is to set Auto Return for people who have a Paypal account. Customers without a Paypal account and pay with credit card are given the option to return to your site.

 

from Paypal website:

 

Auto Return shortens the checkout flow and immediately brings your buyers back to your website upon payment completion. To set up Auto Return, you need to turn it on and enter the return URL that will be used to redirect your buyers back to your site.

Note: If you have turned on Auto Return and have chosen to turn on PayPal Account Optional for new users, a new user will not be automatically directed back to your website, but will be given the option to return.

 

It looks like even though the return variable is set to checkout_confirmation.php in the paypal standard payment module, you need to set your Auto Return for Website Payments to ON and enter in www.yourwebsite.com/checkout_confirmation.php in the Return URL field. The Return URL value is then overridden by the return variable that is sent for each individual transaction.

 

- from the Paypal Website Payments Standard Integration Guide.pdf (under Using Your PayPal Account Profile>Tailoring the Checkout Experience>Setting Return URL on Individual Transactions)

With Auto Return turned on in your account profile, you can set the value of the return

HTML variable on individual transactions, which overrides the value of the return URL that

you stored on PayPal as part of the Auto Return feature.

 

 

Regarding the IPN setting:

I actually see that I have the Receive IPN setting turned to OFF, but I still receive transactions and the Paypal IPN Verified notices in my order histories so I don't know if setting this preference to ON is actually the correct solution.

 

-from the Paypal Instant Payment Notification Guide (under Identifying Your IPN Listener to PayPal>Dynamically Setting the Notification URL):

Even though you have not enabled receiving IPN messages in your Profile or you have reset your preference by turning off IPN messages, PayPal still sends IPN messages to the notification URL you specify for a specific payment

 

 

There is also the Payment Data Transfer (optional) [mine is set to OFF], but I'm not sure exactly how that option differs from the regular IPN notifications.

 

 

Solution (?):

It seems to me that the best way to address this problem (customers who paid with credit card not coming back to checkout_process.php) is to move the stock decrement and order email code into the Paypal IPN file (ext/modules/payment/paypal/standard_ipn.php) since this file is always called whenever a Paypal transaction (successful or not) has occurred. Right now, the stock decrement and order email code resides both in includes/modules/payment/paypal_standard.php [in before_process()] and also again on checkout_process.php -which I still don't understand why it's in both places; none of the other payment modules have this code duplicated, only the paypal standard module.

 

If Paypal does not automatically redirect users back to your site (setting your Auto Return to ON will redirect Paypal users, but not credit card, non-Paypal transactions), checkout_process.php will never be called and thus, the stock will not be decremented nor the order email sent out (since these happen on that page).

 

 

 

I've changed my Auto Return for Website Payments setting to ON (it is off by default) and I'll post again later if this was indeed a (partial solution) to this issue. This should handle my Paypal customers at least getting redirected back. The non-Paypal customers would need the above standard_ipn.php solution???

 

-Art

Link to comment
Share on other sites

  • 1 month later...

Hi

I've written the equivalent of an oSC PayPal Standard module for a different cart - to handle the IPN there I had an extra flag against the order in the database - the IPN file and the equivalent of checkout_process both look to that flag and, if found, will send emails, decrement stock levels etc etc and update the flag so the other file won't do the same - that way either a return or IPN call will do the job

Link to comment
Share on other sites

@@burt I've got a rough version ported over for osC.

 

My original (non osC) code worked in a different manner but I've had to bin it because the PayPal IPN did not lend itself to what I already had. So what I have here now is the function install() creates a new table plus adds a new field to the existing orders table.

 

When the order is initially saved this new table gets populated with the contents of the email, the email title and the order/customer numbers. The new field in the orders table is set to a Boolean 0

 

When order is placed the first past the post of customer return or IPN notification will look at that new field and if it finds a 0 change it immediately to 1

It then sends the email and adjusts the stock - deletes the data from the new table so as not to waste space.

The slower file will find the field set to 1 so will skip any of the email/stock stuff.

 

The best way to use the zip is to uninstall PP, upload the changed files then reinstall - that way the new table will be created - all the admin fields are the same as the original.

 

It's as rough as the badger's proverbial and even typing here I can think of some other options on it (best one was that should not have used the stock files but created a new set - also the IPN file will not send the emails if the IPN appears invalid or dodgy - that should be changed so that at least the store manager gets some sort of warning )

 

It would be better if the code could be set into functions as suggested

 

update_store_stock($order_id)

send_order_emails($order_id)

 

come to mind straight away

 

Like I said this is a bets code but I'm away for a bit so not really able to properly test - it has gone OK for me using PayPal Sandbox today but that's just for USD and English language

 

(also see the comments in the IPN file re mismatch in the order/paypal totals due to a comma - that's been mentioned a lot on the forums but I didn't have time to debug that)

 

 

Edited by Bob Terveuren
Link to comment
Share on other sites

  • 5 months later...

@@burt I've got a rough version ported over for osC.

 

My original (non osC) code worked in a different manner but I've had to bin it because the PayPal IPN did not lend itself to what I already had. So what I have here now is the function install() creates a new table plus adds a new field to the existing orders table.

 

When the order is initially saved this new table gets populated with the contents of the email, the email title and the order/customer numbers. The new field in the orders table is set to a Boolean 0

 

I'm wondering why you would create the new table. Seems to me you could just add the new boolean field to the orders table. The customer email, order id etc can all be gleamed from the orders table when you check the boolean before running the decrement and outgoing emails, correct?

Link to comment
Share on other sites

@@Bob Terveuren

 

Hey just wanted to let you know I've started re-working your new standard_ipn.php code. I've also written your suggested update_store_stock($order_id) and send_order_emails($order_id) functions (to be put in functions/general.php I would assume).

 

Let me know if this works for you so we're not both reinventing the wheel at the same time :)

 

functions:

*** Please note: I've used the original code from the stock OSC2.2rc2a checkout_process.php page.

 

***Also please forgive the tabulation in this code. The forum reply form keeps screwing with it :)

 

function update_store_stock($order) {
if (is_object($order) && tep_not_null($order->products)) {
 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
 // Stock Update - Joao Correia
 if (STOCK_LIMITED == 'true') {
	 if (DOWNLOAD_ENABLED == 'true') {
	 $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename
						 FROM " . TABLE_PRODUCTS . " p
						 LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
							 ON p.products_id=pa.products_id
						 LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
							 ON pa.products_attributes_id=pad.products_attributes_id
						 WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
	 // Will work with only one option for downloadable products
	 // otherwise, we have to build the query dynamically with a loop
	 $products_attributes = $order->products[$i]['attributes'];
	 if (is_array($products_attributes)) {
		 $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
	 }
	 $stock_query = tep_db_query($stock_query_raw);
	 } else {
	 $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	 }
	 if (tep_db_num_rows($stock_query) > 0) {
	 $stock_values = tep_db_fetch_array($stock_query);
	 // do not decrement quantities if products_attributes_filename exists
	 if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		 $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
	 } else {
		 $stock_left = $stock_values['products_quantity'];
	 }
	 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	 if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		 tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	 }
	 }
 }
 }
 return $order;
}
}
function send_order_emails($order, $insert_id) {
// lets start with the email confirmation
$email_order = STORE_NAME . "\n" .
			 EMAIL_SEPARATOR . "\n" .
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
if ($order->info['comments']) {
 $email_order .= tep_db_output($order->info['comments']) . "\n\n";
}
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
			 EMAIL_SEPARATOR . "\n" .
			 $products_ordered .
			 EMAIL_SEPARATOR . "\n";
for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
 $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}
if ($order->content_type != 'virtual') {
 $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
				 EMAIL_SEPARATOR . "\n" .
				 tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
			 EMAIL_SEPARATOR . "\n" .
			 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
if (is_object($$payment)) {
 $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
				 EMAIL_SEPARATOR . "\n";
 $payment_class = $$payment;
 $email_order .= $order->info['payment_method'] . "\n\n";
 if ($payment_class->email_footer) {
 $email_order .= $payment_class->email_footer . "\n\n";
 }
}
tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $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);
}
}

Link to comment
Share on other sites

  • 7 months later...

Not sure if you guys are still working on this, but I have the same trouble with it.  Something I thought I'd toss in the mix:  if IPN handles stock deductions, what happens when you make a full or partial refund, and paypal tosses another IPN your way?  Does it deduct twice?  I only ask because I just recently figured out that refunds actually do create status updates on the site's invoice for the affected order.  And since IPN doesn't currently handle stock decriment...we're more often faced with a need to refund, due to stock numbers' inaccuracies.

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