| | | | | |

WP e-Commerce: FIX for PayPal/Credit Card Purchase Sending Incorrect “Order Pending: Payment Required” Emails

NOTICE! The example below is extremely old (from 2010). The solutions probably won’t work anymore.

WP e-Commerce v3.7.6.9 (the latest stable version available, downloaded Sept 18, 2010)
WordPress v3.0.1
Testing done in PayPal Sandbox & on live site (once Sandbox testing proved successful)
Themes tested: 1) WP Twenty Ten 1.1; 2) Thematic 0.9.6.2; 3) Thematic Feature Site 1.0.1 child theme

Problems: after making a PayPal or credit card purchase I get the wrong messages/emails notifications:

  • Incorrect Transaction Results page: shows “Order Pending: Payment Required” message after making a purchase with PayPal or credit card. The Transaction Results page should show “The Transaction was successful” text.
  • Incorrect email notification: After a PayPal or credit card purchase, the customer should receive a “Purchase Receipt” email confirmation. But instead, they incorrectly receive an “Order Pending: Payment Required” email.
  • Incorrect Sales status: shows “Order Received” in WP e-Commerce’s back-end. The Sales status should read “Accepted Payment,” because the customer paid with PayPal or a credit card.

WP e-Commerce settings: Store > Settings > Payment Options:

  • Payment Gateway: Paypal Payments Standard
  • IPN: Yes
  • Send shipping details: Off
  • Shipping override: Off

PayPal settings: Nothing changed; I kept all of the default settings: IPN is off, no return page.

Solution 1 of 3: Go to wp-e-commerce/merchants/paypal_multiple.php

Find the following lines:

  • Line 241: if(get_option('paypal_ipn') == 0) { // A setting of 0 ensures that digital downloads still work for people without IPN, but it's less secure.
  • Line 242: //$wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '2' WHERE `sessionid` = ".$sessionid." LIMIT 1");

Change to:

  • Line 241: if(get_option('paypal_ipn') == 1) { // Setting to 1 allows the Successful Transaction to be displayed on the Transaction Results page. A setting of 0 ensures that digital downloads still work for people without IPN, but it's less secure.
  • Line 242: $wpdb->query("UPDATE `".WPSC_TABLE_PURCHASE_LOGS."` SET `processed` = '2' WHERE `sessionid` = ".$sessionid." LIMIT 1");

What I did:

  • Changed get_option value from 0 to 1 at line 241
  • Deleted // at the beginning of line 242

Solution 2 of 3 (this step may no longer be necessary. Make a test PayPal Sandbox purchase with just Solution #1 above before making this 2nd Solution edit.): Go to wp-e-commerce/function_results.php

Find the following line:

Line 40: }elseif($sessionid == ''){

Change to:

Line 40: }if($sessionid == ''){

What I did:

  • Deleted “else” from the elseif statement

Solution 3 of 3 (this step may no longer be necessary. Make a test PayPal Sandbox purchase with just Solutions #1 & #2 above before making this 3rd Solution edit.): Go to wp-e-commerce/wpsc-admin/ajax-and-init.php

Find the following line:

Line 1337: transaction_results($log_data['sessionid'],false);

Change to:

Line 1337: transaction_results($log_data['sessionid'],true);

What I did:

  • Changed “false” to “true”

NOTE: These changes may affect digital purchases/downloads from working properly. Your setup may be different from mine.

TEST RESULTS (using PayPal Sandbox & live site):

PayPal payment results – GOOD:

  • Transaction Results page: The Transaction was successful – GOOD
  • Customer receives correct “Purchase Receipt” email notification – GOOD
  • Sales section in WP e-Commerce shows correctly as “Accepted Payment” – GOOD

Credit Card payment results – GOOD:

  • Transaction Results page: The Transaction was successful – GOOD
  • Customer receives correct “Purchase Receipt” email notification – GOOD
  • Sales section in WP e-Commerce shows correctly as “Accepted Payment” – GOOD

Manual payment results – GOOD:

  • Transaction Results page: Purchase is pending – GOOD
  • Customer receives correct “Order Pending” email notification – GOOD
  • Sales section in WP e-Commerce shows correctly as “Order Received” – GOOD

Similar Posts

14 Comments

    1. Glad it worked out. The final testing that I did was to make sure all 3 purchase methods worked smoothly: Manual payment, Credit Card payment and PayPal payment.

  1. I’m having a similar issue but with PayStation as the gateway. No matter what the transaction result (and I can see it returning the correct variables appended to the url), WPEC decides it’s “Order Pending: Payment Required”.

    I’m using WPEC 3.7.7 and Gold Cart 2.7

    I couldn’t try Solution 2, though, because my files don’t include wp-e-commerce/function_results.php. Is that definitely the right file? If so, it looks like they’ve changed the file structure.

    Cheers,
    Minty

  2. Hi, I tried your solution, and while it did work to set the status to 2, the status update is happening on the way TO paypal and not after it gets BACK.
    If you press make payment and then go look at the orders tab in the wpec sales page the status is already set to status ‘accepted payment’ before I have even entered any info into paypal.

    do you see this same result?

    1. Hi Daniel, Sorry it didn’t work out. it’s possible that the version of WPEC I was working on at the time and the version you’re working on are different. It’s possible that this solution doesn’t work anymore – WPEC is tricky that way. I didn’t see the result you’re seeing at the time I was working on my solution. This problem that WPEC has with sending the wrong email notifications is a nightmare.

  3. You wouldn’t happen to know how to set up Sandbox with PayPal Payments Standard in WP E-commerce would you?

    Unlike in PayPal Express Checkout, there’s no option to toggle between sandbox mode & production, and when I simply try and enter my Sandbox credentials into the Username field (in Store Settings > Payments > PayPal Payments Standard > Edit), PayPal throws out errors during the actual checkout process.

    1. Hi Nathan, It’s been a long time since I’ve played with PayPal’s Sandbox and WP e-Commerce together. I know that there’s a bunch of stuff you have to do at the PayPal Sandbox end of things, too. I remember the whole process being complicated.

      WordPress WP e-Commerce admin: Settings > Store > Payments > PayPal Payments Standard 2.0:
      – In the Username field, you’ll want to put your Sandbox “seller” email. My old one looked like this: seller_5677392020_per@mywebsite.com. You’ll have your own from your Sandbox account.
      – In the URL field, you’ll want to put: https://www.sandbox.paypal.com/cgi-bin/webscr.

      Hope that helps!

      1. Thanks Reid, that was actually very hepful.

        If anyone else would like a step-by-step walkthrough of how to do this, I’ve posted it to the WP E-commerce forum here: http://getshopped.org/forums/topic/how-to-put-paypal-payments-standard-into-sandbox-mode/

        If Reid doesn’t mind that link. 🙂

  4. One quick question: I can not see paypal_multiple.php file under appearance -> editor. I see the following files:

     wpsc-category-list.php wpsc-cart_widget.php wpsc-user-log.php wpsc-list_view.php wpsc-products_page.php wpsc-default.css wpsc-featured_product.php wpsc-category_widget.php wpsc-grid_view.php compatibility.css wpsc-shopping_cart_page.php wpsc-single_product.php wpsc-transaction_results.php
    I am trapped in same problem as you have mentioned above. I am using the current version of WP ecom: Version 3.8.7.6.2

    Need I check FTP rather? I am not good at all this and new but learning. Please make your reply elaborate. Thanks in Advance!

    1. Hi TUTE, you’ll definitely want to use FTP to locate the files on your host’s server, download them, edit them and re-upload them using FTP. I use FileZilla for all my FTP.

      It’s possible that the fixes I have above (for WP e-Commerce, v3.7.6.9) won’t work for any other version. WPEC was tricky that way.
      I stopped using WP e-Commerce over a year ago and haven’t kept up with all of the hacks for it. I won’t be able to provide any feedback or advice. I’ve since moved on to using WooCommerce and JigoShop for my WordPress e-commerce.

  5. This might be a long shot but I’ve just come across this post as I’m also now getting these payment pending messages on the transaction results, unfortunately a lot of the code above is out of date so I’m wondering if you might have a fix for this problem on the current version?

Leave a Reply

Your email address will not be published. Required fields are marked *