News:

Support the VirtueMart project and become a member

Main Menu

Payment remains Pending

Started by atomicbanzai, March 12, 2009, 10:45:07 AM

Previous topic - Next topic

atomicbanzai

Hi, I have tried to follow the sticky thread "PayPal Set Up for VirtueMart 1.1" but am having some trouble.  I am working in Sandbox mode with a Seller and Buyer account.  I am able to process the payment and PayPal sends me back to my website saying that the payment was successful, however in the VirtueMart Order History, my users payment is still 'Pending' and not sure why this is.

Thanks!

ajredding

In my many hours in developing custom code for the paypal module I found that the "notify.php" code will reject the IPN from the sandbox because it's not from an approved paypal server. 

Now it's been awhile since I've done this but in the code of the "notify.php" this is how I changed it (approx line 219)

    if( PAYPAL_DEBUG != "1" ) {
    // Get the list of IP addresses for www.paypal.com and notify.paypal.com
        $paypal_iplist = gethostbynamel('www.paypal.com');
$paypal_iplist2 = gethostbynamel('notify.paypal.com');
        $paypal_iplist = array_merge( $paypal_iplist, $paypal_iplist2 );

        $paypal_sandbox_hostname = 'ipn.sandbox.paypal.com';
        $remote_hostname = gethostbyaddr( $_SERVER['REMOTE_ADDR'] );
       
        $valid_ip = false;
       
        if( $paypal_sandbox_hostname == $remote_hostname ) {
            $valid_ip = true;
            $hostname = 'www.sandbox.paypal.com';
        }
        else {
            $ips = "";
            // Loop through all allowed IPs and test if the remote IP connected here
            // is a valid IP address
            foreach( $paypal_iplist as $ip ) {
                $ips .= "$ip,\n";
                $parts = explode( ".", $ip );
                $first_three = $parts[0].".".$parts[1].".".$parts[2];
                if( preg_match("/^$first_three/", $_SERVER['REMOTE_ADDR']) ) {
                    $valid_ip = true;
                }
            }
            $hostname = 'www.paypal.com';
        }


Now I think it worked it with the code changed.

Let me know if that works for you
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

razor7

nope, your code does not solve the problem...
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

ajredding

Can you post your paypal config? 

If you are using my code from another post then there is an additional change that needs to be made to another file.  But if you are using the default config then I'm not sure what is going on.
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

razor7

The problem was the debug mode on!

Disabled it and worked ok!
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

danboarder

I checked my notify.php and it is correct.  ajredding, what is the other change you mention? 

I've been getting these messages:
"The right order_id wasn't found during a PayPal transaction on your website.
                    The Order ID received was: 21"


I'm in the same boat; can't get from Pending to Confirmed.

ajredding

Looks like you are using the modified code I've been working on from another post...

Approx line 341 you will need to change the 'order_number' to 'order_id' in the "WHERE" statement (last line of the code below).

     
// Get the Order Details from the database     
      $qv = "SELECT `order_id`, `order_number`, `user_id`, `order_subtotal`,
                    `order_total`, `order_currency`, `order_tax`,
                    `order_shipping_tax`, `coupon_discount`, `order_discount`
                FROM `#__{vm}_orders`
                WHERE `order_id`='".$invoice."'";
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

danboarder

Thanks!  I'll try that and report back with the results.

danboarder

ajredding, THANKS! That was it. Everything is working now. :)

http://www.x-zylo.com  now to sort out some CSS and make things look pretty.

ajredding

Good to hear that worked out for you.  Gotta love the constant battle with CSS, Good luck!
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

mark75to

Hi to all,
sorry for my bad english. I'm itilian and I'm new on this forum.
I'm disperatly trying to use VM 1.1.3 and J1.5.9 with paypal.
All works fine in sandbox and also in paypal normal account. All are processed correctly and money are transfered correct but order status remaing in pending.
This is my paypal cfg (I have only insert xxxxxxxxx instead of my paypal account)
define ('PAYPAL_DEBUG', '0');
define ('PAYPAL_EMAIL', 'xxxxxxxxxxxxx');
define ('PAYPAL_VERIFIED_ONLY', '0');
define ('PAYPAL_VERIFIED_STATUS', 'C');
define ('PAYPAL_PENDING_STATUS', 'P');
define ('PAYPAL_INVALID_STATUS', 'X');
?>

I have tried to use default notify.php and I have applied all suggested change but in any case my order remain in pending.
Please help!!!

Thanks a lot in advance!!!

Falco Stellare

Quote from: ajredding on April 15, 2009, 06:08:24 AMApprox line 341 you will need to change the 'order_number' to 'order_id' in the "WHERE" statement

IT WORKS!!! FANTASTIC!!!

My PayPal Sandbox was reaching the supernova temperature after so many unsuccessful attempts, but now... IT WORKS!!!

I don't have words to thank you, you really saved my head from exploding  :D

Remember, you have a good beer paid, whenever you decide to come to Rome, Italy  ;D

fire2

Hi there,
  I am running a live website, with the real Paypal mode, not the Test Mode, and my orders remain "Pending" even when they are paid succesfully through PayPal. If I apply these changes to notify.php, will it help or is it only for the sandbox? Does anyone have any other idea of how can I fix this? What code should I change? I searched through many forums and posts and wasn't able to find a solution to it. I found out a few people have this problem, and as this topic is called "Orders remain Pending" I thought it was the right topic to post my question.

Thanks in advance.
currently using:
Joomla 2.5.8
VM 2.0.14