We're experiencing two issues which are likely related.

When a user checks out using a credit card through Paypal Website Payments Pro http://o7.no/uSZPA5 , if the payment triggers one of our fraud filters (which puts the payment into "pending" status) when the order is placed the status in ubercart is set to "payment received". In the order comments I see the IPN response from paypal, and it says something like:

Authorize and capture immediately
Success: 249.13 USD
Address: Postal code matched; address did not
CVV2: Match

So this is a clear indication (in our setup) that the payment is pending in PayPal. Updating the order status seems to be a logical step.

Another issue, likely related, is when a payment's status is changed (marked as denied/canceled etc) in PayPal, the order status is not updated in ubercart.

From what I've read, it seems like the ubercarts support for IPN is limited and needs to be re-written to allow more flexibility and functionality etc.

Is there an existing workaround or fix for this issue? I haven't been able to pinpoint anyone else having this exact problem.

I'm looking into creating a patch myself, but would like to make sure my work is warranted and that it hasn't already been addressed elsewhere.

Any thoughts or suggestions on this issue is greatly appreciated.

Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Any help with improving the PayPal module would be appreciated. There's a patch in the queue to improve IPN support so other modules can react, but nothing like you describe. There's also an open issue about the fraud filters but I don't think that's quite the same thing.

TR’s picture

Priority: Major » Normal
Issue tags: +paypal, +Paypal WPP, +payment paypal, +order status

I haven't tried it myself, but from what you're describing the problem seems to be that PayPal reports "Success" and Ubercart takes that to mean the payment is completed. Related issues are #657544: Paypal fraud filters incorrectly displayed in Ubercart, #781720: Refactor the Paypal WPS IPN code, and #1307954: Store more response data in uc_payment_paypal_ipn.

If you're able to supply a patch that would be greatly appreciated. We're willing to step you through creation of a patch if need be.

TR’s picture

Crosspost. Removing tags that were accidentally restored.

tseven’s picture

Gotcha.

"There's a patch in the queue to improve IPN support so other modules can react, but nothing like you describe" Are you referring to the patch in #781720: Refactor the Paypal WPS IPN code? If so, I could use that patch as a basis for the work I do, which would help maintain consistency etc.

Ok, so in order to properly contribute the code/patch would I need to create the patch against the dev release?
Ideally I'd like to patch 2.7 since we're using that on a live site and is known to work with all other module/features we have setup.

Thanks

longwave’s picture

Yes I was referring to #781720. It would be good to get that in separately as it's quite a big patch, but I think it needs more testing and reviewing first - if you can help out on that it would also be appreciated.

You should be able to patch against 2.7 as it's not that different from 6.x-2.x-dev, although -dev is best and easiest for us to deal with as maintainers.

tseven’s picture

The attached patch simply adds the PayPal fraud message as an admin comment and updates the order statys to "PayPal pending".
This fixes the issue of the order being marked as "Payment received" when in fact the payment is pending due to the fraud filters setup on the PayPal account.

tseven’s picture

I have also modified the uc_paypal.pages.inc file to updated the order status based on the incoming IPN requests sent from PayPal.
I realize that this functionality might be specific to our needs, and would be nice to allow the end user to choose the order status to paypal payment status mapping.

Also, there is an IPN transaction duplicate check being done before the main switch($paypment_status) statement which terminates the script.

I'm not quite sure why we don't want to process multiple IPN request from paypal. Each transaction has a unique id, and I can think of many scenarios where there may be several IPN requests on the same transaction.

Example:
User submits payment wich triggers a fraud filter, placing the order in "PayPal pending" status.
Store admin accepts the payment which triggers an IPN to Ubercart, setting the order status to "Payment received".
Store admin later issues a refund to the customer through PayPal, which sends another IPN to Ubercart marking the order as canceled and refunded.

With the dupe check running on the IPN transaction id, it blocks all future changes to the payment.

If duplicated IPN request are an issue, I'd suggest filtering by more criteria than just the transaction id.

Ultimately, the IPN requests handled by the module should allow conditional action hooks. I believe this is what the patch in #781720 is moving towards.

I've attached the patch we're using to allow the changing of the Ubercart order status to match the incoming IPN PayPal payment status changes.
Keep in mind this may not be exactly what your store needs. The modifications this patch provides are very simple and straightforward.

longwave’s picture

Version: 6.x-2.7 » 6.x-2.x-dev
Status: Active » Needs review

Testbot only works on -dev releases, let's see how this holds up.

Status: Needs review » Needs work

The last submitted patch, uc_paypal_change_order_status_on_ipn_updates-1363158.patch, failed testing.

TR’s picture

Status: Needs work » Needs review
FileSize
3.7 KB

I re-rolled the patch from #7 and put it in the correct format. I don't use PayPal, so I didn't test it, but let's see what the testbot thinks.

bisonbleu’s picture

I'm testing WPP (Website Payment Pro) on a PayPal sandbox. I have applied/tested #10 patch to ubercart-6.x-2.9+12-dev. Order status is now being properly updated. But a gremlin has crept in.

@ admin/store/orders/[order number], Balance appears as -$[order amount], e.g. -$400 (should be zero I guess when paid in full). A fix for this would be great.

Other than that, it looks pretty good.

bisonbleu’s picture

Priority: Major » Normal
Status: Active » Needs review

Update & call for help.

The reason why the balance in #11 appears as the exact negative of the order amount is because Ubercart is recording 2 separate instances of the same payment. Here is an example of what the "Admin comments" pane looks like for a $400 order.

Date	User	Comment
10 Jun 2012 9:43:27 PM	713	Authorize and capture immediately Success: 400.00 CAD
10 Jun 2012 9:43:27 PM	-	The stock level for ins-ahmsl-saireg1213-pee has been decreased to 51.
10 Jun 2012 9:43:28 PM	-	Order created through site.
10 Jun 2012 9:43:32 PM	-	PayPal IPN reported a payment of 400.00 CAD.

The first line records a $400 payment; the balance is now 0. On the 4th line, PayPal IPN records yet another $400 payment; the balance is now -$400.

I'm using Website Payment Pro.
*** On my PayPal account, IPN settings are set to: "Do not receive IPN messages (Disabled)".

Help would be greatly appreciated as the site is live and payments are coming in.

Thanks.

bisonbleu’s picture

Priority: Normal » Major
Status: Needs review » Active

I'm now running WPP on a live Ubercart store (6.x-2.9+12-dev). For every completed order in this store (75 in the last week), Ubercart is recording the customer's payment twice. Recent log entries show the same pair of messages for every order:

 - uc_paypal	06/18/2012 - 21:00	IPN transaction verified. 	Anonymous
 - uc_paypal	06/18/2012 - 21:00	Receiving IPN at URL for order 1255. 	Anonymous

Because of this, all orders display a negative balance equal to the total amount of the order.

Again, on my PayPal account, IPN settings are set to: "Do not receive IPN messages (Disabled)".
PayPal WPP integration support confirms that my account is properly configured.

As this issue undermines store accounting (store balance is no longer meaningful) and, more importantly, leads users to believe that they've just received a credit equal to the total amount of their order, I'm setting this issue back to 'major' and 'active'.

deardagny’s picture

Priority: Major » Normal
Status: Needs work » Needs review

I'm seeing the same issue mentioned in #12 after applying the patch in #10 - same config.

longwave’s picture

Priority: Normal » Major
Status: Needs review » Needs work

So with the patch in #10, the payment is recorded twice, but without the patch in #10, the order status does not update at all? In which case, "needs work" is the right status here.

deardagny’s picture

Status: Needs work » Active

Sorry - accidentally hijacked your status changes @bisonbleu

I should also mention that I have IPN's set to Enabled in my account. If I remember correctly it was the only way I could get anything sent to the site during testing.

longwave’s picture

Status: Active » Needs work

Ubercart should override the IPN setting in your PayPal account, as it needs to be enabled to ensure payments are processed correctly.

Can someone confirm whether my summary in #15 is correct?

deardagny’s picture

Priority: Normal » Major
Status: Needs review » Needs work

Sorry longwave - our posts just crossed in the mail. I think your status makes sense considering there is a patch being worked on.

I also just realized that my other issues belong in the uc recurring queue. My mistake.

bisonbleu’s picture

Can someone confirm whether my summary in #15 is correct?

@ longwave: You are correct.

bisonbleu’s picture

Update.

I get the exact same behavior with my PayPal sandbox.

Admin comments (admin/store/orders/195):

06/23/2012 1:47:27 PM
  - Authorize and capture immediately
  - Success: 290.00 CAD
  - Address: Address and postal code matched
  - CVV2: Match
06/23/2012 1:47:28 PM
  - Order created through website.
06/23/2012 1:47:33 PM
  - PayPal IPN reported a payment of 290.00 CAD.
bisonbleu’s picture

FileSize
39.31 KB

Also, see attached screen capture of Payments for order #195.

bisonbleu’s picture

FileSize
39.31 KB

Take 2...

Also, see screen capture of Payments for order #195. This order went through the PayPal sandbox.

Payments for order 195

TR’s picture

Version: 6.x-2.x-dev » 8.x-4.x-dev
Issue summary: View changes