Openfoodnetwork: Paypal % charged twice

Created on 29 Jun 2016  路  43Comments  路  Source: openfoodfoundation/openfoodnetwork

I have added a 4% charge onto our paypal method of payment and its being added onto the customer's invoice twice as below, which leaves a Balance Due on their account.
However, they are only charged this once when they get charged by Paypal.
screen shot 2016-06-29 at 15 36 35

Most helpful comment

Yep, we can do urgent dot releases whenever we like. Hopefully we'll do a spree-upgrade release this week (v1.9?), so I was thinking this will just go out as part of that.

All 43 comments

@mkllnk does this have something to do with the fees on payment types piece of work you did?

Yes. Somehow it got added twice here. It would be good to know how to reproduce that bug, since we didn't discover that while testing.

Come shop with us, happens all the time?! Maybe I've set it up wrong?

@sstead Can you reproduce this?

Hey Maikel, I couldn't reproduce this without a properly setup Paypal account. The error wasn't happening for other payment methods with fees. I had a look at the UK server and interestingly in the last month this error seemed to occur on 4 of the 5 orders that were paid with Paypal. I couldn't glean much else. Would you like me to contact Kirsten/Brenda to get details of the eaterprise paypal account for more thorough testing?

Sally, when I noticed this was happening I deleted one of the duplicate transactions to make the invoice correct, it was on Order #R757442004. So it may have happened to all of them but doesn't show on the invoice now? I'll leave the rest alone.

OK, this may be a clue? This was the payment screen which related to the order on my first post where I noticed this

screen shot 2016-07-01 at 13 57 43

@sstead Why did the sandbox not work? Or did the error not happen with the sandbox?

The last screenshot looks like someone tried to pay twice and only the second one worked. Maybe that's where the fee is processed twice.

This is another one with the same transaction twice:
screen shot 2016-07-02 at 10 12 33

screen shot 2016-07-02 at 10 09 00
This is how it came through the paypal account:
screen shot 2016-07-02 at 10 11 07
Hope that helps!

Hi @mkllnk I was unable to complete my paypal payment with the sandbox (I couldn't login with my usual customer login). So I couldn't see how the completed order went through and how the payment fee was put onto the order.

@mkllnk @sstead Hi folks, any updates on this one?

Rohan worked on getting the Paypal sandbox working so that we can reproduce the error. But I haven't heard from @sstead that she could reproduce it yet.

Hi there @Rocksj and @lin-d-hop, I've moved this issue into the 1.8.3 milestone and @mkllnk will be working on a fix now that @sstead has been able to replicate the issue. Stay tuned for updates :)

I am a little bit closer to what's happening here. The PayPal payment gateway creates two payments. Both add the fee as line item.

The first one is created when the user is redirected to PayPal. It is then in the checkout state.

Once the user comes back from PayPal, the payment state is set to invalid. A second payment is created when the user comes back from PayPal. It's final state depends on the outcome of the PayPal transaction.

I have a fix that removes the fee when a payment is set to invalid.

Great! Good detective work

It looks like we fixed it with #1097.

This one seems to have reared its head again? And we're a month ahead of ourselves, how did it get to April already?
@mkllnk @lin-d-hop @daniellemoorhead
screen shot 2017-03-17 at 12 22 48

We haven't made a release. Could you add more details @Rocksj.
When did you first notice it again? Did it definitely stop?
Can you confirm the price different is definitely due to the paypal fees being added on twice as before?

I only noticed it this week @lin-d-hop but have just checked back and it actually started happening again sometime between 20 December and 9 January. It definitely stopped and was OK until January. It seems like the paypal charges are being added on to the original amount and then added on again

screen shot 2017-03-17 at 13 30 52

@Rocksj Can you describe how you re-produce this issue? It would look like:

  • user is logged in (or user is logged out)
  • user adds x items to cart
  • user goes to checkout
  • ...
  • user hits back button in browser during payment?
  • transaction fee is shown twice

That is just a template. If you could add all the details, that would be great.

@lin-d-hop Which versions of OFN did you have deployed in this time?
@sstead Can you reproduce this issue? If you can't do it straight away, you can wait for the description.

@mkllnk

Can you describe how you re-produce this issue? It would look like:

user is logged in (or user is logged out) *I was logged in as me*
user adds x items to cart **I added item to my cart**
user goes to checkout **went to checkout and chose paypal as my payment option**
...
user hits back button in browser during payment? **No I get directed to paypal login screen, log into paypal and pay the correct amount so the 60p plus 2p transacgtion fee**
transaction fee is shown twice **order confirmation shows transaction fee twice as below**

screen shot 2017-03-28 at 11 25 24

So this is a problem with the invoice, customer balances on OFN rather than the customer being charged the transaction fee twice in paypal

Hope that helps?!

@mkllnk does the above help?

@sstead can you see if this is happening for you as well in your testing? Ta!

@mkllnk Yes, it's happening on Staging2, so probably Aus Production -
image
Paypal doesn't charge it twice...
image

@oeoeaio or @RohanM I'm a bit stuck here. When somebody pays with PayPal, a payment with fee is created. The payment is in "checkout" state. We need this before the payment is done to charge the fee. The user is redirected to PayPal and pays. When the payment is confirmed, BetterSpreePaypalExpress creates another payment, this time with state "completed". It has a fee as well. And that's why the fee appears twice on the order receipt even though it was charged only once and the order is "paid".

I think, the ideal solution would be to change BetterSpreePaypalExpress to change the payment to completed instead of creating a new one. But that could be a bigger dev task if we wanted to catch the case that there are more than two payments processed at the same time. Okay, unlikely.

Any other ideas?

@lin-d-hop @Rocksj @NickWeir63 this issue seems to be bigger than we thought, and already @mkllnk has spent a day trying to understand what's causing this. We just want to make sure that you're happy for us to continue on this, there'll probably be another couple of days required (@mklink can you please describe the next steps in a comment on here so they can see what you'll be doing), where Maikel will figure out options on how to fix this and then discuss with Rob and Rohan (at which point he'll know more or less how much time it'll take to implement).

Are you happy with us continuing with this?

this is a decision for @Rocksj and @lin-d-hop I will go with whatever they decide. thanks

@Rocksj and @lin-d-hop how would you like to proceed with this?

Removing the Aus Review label from this until we have confirmation to go ahead.

Hi @Rocksj,
Am I correct in thinking this messes up your records and reports in OFN? What would you say is the priority of this to you? On a scale of 1 to 10 where
1 = I can live with it, just a little ugly
10 = This causes me loads of extra work I wish I didn't have
If greater than 5 I would say we get this ticked off now. It'll be a fair whack of funds but if this is a real pain then sounds like funds well spent now.

Ok, its probably around a 5 at the mo. It's a nuisance and makes customer account management a pain but the worse thing is it looks a bit strange on customer invoices. It can probably wait to be part of a more comprehensive overhaul of customer accounts as it moves up the UK Dev priority list? Would that be a sensible move @lin-d-hop?

@mkllnk @stveep @oeoeaio Quick q. Do you think this issue will rear it's head with Stripe as payment method as well?

It depends on the implementation. The paypal module creates two payments and only the second one is completed. If stripe does the same, we have the same problem. I tried to find a general solution for this which makes it hard. If the stripe module creates only one payment, we don't have this problem there.

Can we test this for Stripe? @mkllnk @lin-d-hop

@oeoeaio and @stveep are working on the Stripe integration. Can you comment on the above?

If this is an issue with the stripe implementation I'm moving it up the priority list!

@daniellemoorhead I know both are super busy so if Rob misses this can you ping the question? Thanks!

Will do @lin-d-hop :)

Hi @lin-d-hop, sorry for the slow response. Head buried and all that.

To the best of my understanding/knowledge, this problem shouldn't affect Stripe as the processing of payments does not involve the creation of multiple payments. I will try to confirm this later today.

@lin-d-hop Pretty confident that Stripe is only creating a single payment, so this should be an issue, but it would be a good idea to have this issue as a specific focus of testing.

hello people. I have just had an Aus user report this. Can I confirm that it is still a problem and is not prioritised for fixing because:
a) it's hard and likely expensive
b) people are not actually being charged the wrong thing, so it just messes up the records
c) Stripe shouldn't have the same problem, and we anticipate more people moving to Stripe?

@lin-d-hop @oeoeaio @mkllnk @daniellemoorhead @sstead @Rocksj ?

Hi @kirstenalarsen yes this is still happening and not a priority because of the the reasons you have identified. I think some of my customers will continue to use paypal but I'll try to convert them to Stripe when it arrives!

Hey team, this should be fixed by #1842 which has been merged and will arrive with the next release.

Did we ever do a hotfix release @oeoeaio? I'm not sure this issue is worth it but something to keep in mind.

Yep, we can do urgent dot releases whenever we like. Hopefully we'll do a spree-upgrade release this week (v1.9?), so I was thinking this will just go out as part of that.

Was this page helpful?
0 / 5 - 0 ratings