IPN Transaction Failed Verification

Project: 
Ubercart
Category: 
bug report
Version: 
Ubercart 1.x-dev
Priority: 
critical
Assigned: 
Unassigned
Status: 
active

I was hoping to go live with my site here for October 21 to coincide with an Expo Show where I could do a little marketing and thought that Ubercart would be the least of my worries.

I have it installed on Drupal 6.4 and I have tried the Paypal Sandbox Server and the Live server and cannot get the IPM working properly.

Everything seems to be looking fine except that when it comes down to the IPN and updating the order status it just stops working.

Receiving IPN at URL for order 16.
Array
(
    [mc_gross] => 0.10
    [invoice] => 16-1224045174
    [protection_eligibility] => Ineligible
    [item_number1] =>
    [payer_id] => B5YDQJUUGTBQY
    [tax] => 0.00
    [payment_date] => 21:33:39 Oct 14, 2008 PDT
    [option_selection1_1] => 1
    [payment_status] => Completed
    [charset] => windows-1252
    [mc_shipping] => 0.00
    [mc_handling] => 0.00
    [first_name] => Name
    [mc_fee] => 0.10
    [notify_version] => 2.5
    [custom] =>
    [payer_status] => unverified
    [business] => me@here.com
    [num_cart_items] => 1
    [mc_handling1] => 0.00
    [verify_sign] => An5ns1Kso7MWUdW4ErQKJJJ4qi4-ACkMZYraJgmda55AFcJCzVMBYqoJ
    [payer_email] => you@there.com
    [mc_shipping1] => 0.00
    [tax1] => 0.00
    [option_name1_1] => Product count
    [txn_id] => 5YJ868571U892731R
    [payment_type] => instant
    [last_name] => Name
    [item_name1] => Order #16 at My Web Site
    [receiver_email] => me@here.com
    [payment_fee] => 0.10
    [quantity1] => 1
    [receiver_id] => KBMEWMHLJEDKN
    [txn_type] => cart
    [mc_gross_1] => 0.10
    [mc_currency] => USD
    [residence_country] => MX
    [payment_gross] => 0.10
)

Anybody have any ideas on this one?

Re: IPN Transaction Failed Verification

I haven't even tested PayPal on Drupal 6 yet. We just recently got the conditional actions to a point where the UI could be tested on Drupal 6, so it's no surprise that it might not be working properly with the PayPal IPN. I'm not sure if you have any coding chops, but I don't have time to devote to that in the short term.

I Think I Have it Fixed.

Change this:

  foreach ($_POST as $key => $value) {
    $value = drupal_urlencode(stripslashes($value));
    $req .= '&'. $key .'='. $value;
  }

to this:

  foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= '&'. $key .'='. $value;
  }

Re: I Think I Have it Fixed.

Is there something about PayPal's IPN that requires urlencode() rather than rawurlencode()? That's the difference between the D5 and D6 versions of drupal_urlencode(). However, that change doesn't seem like it would affect the way PayPal would be interpreted by Ubercart.

I would want to try to keep drupal_urlencode() because it does some extra processing to get around some Apache weirdness with mod_rewrite.