• Resolved MrFent37

    (@mrfent37)


    My customer placed an order that charged $10.80 for shipping. After the order was placed, she changed her address to a place that qualified her for free shipping. So using the order screen, I refunded her the $10.80 that it charged for shipping. In stripe I verified that the order had a partial refund of $10.80.

    I thought all was well and good, but then I looked at the email that woocommerce sent her, letting her know that her order was partially refunded. The email showed that she was refunded twice, and then calculated that the total she paid after the refund was an additional $10.80 lower than it should have been. See the screenshot of the email:

    https://screencast.com/t/iEJqHF6Jyt2z

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter MrFent37

    (@mrfent37)

    I’m using the latest version of woocommerce and stripe plugin

    • This reply was modified 8 years, 4 months ago by MrFent37.
    Plugin Contributor royho

    (@royho)

    @mrfent37 – Is this only email visual issue or did Stripe actually refunded the customer a second time?

    Thread Starter MrFent37

    (@mrfent37)

    no extra refunds were given in stripe, and woocommerce only shows 1 refund. It’s just the actual customer email that was sent to her that showed a double refund.

    • This reply was modified 8 years, 4 months ago by MrFent37.
    Plugin Contributor royho

    (@royho)

    Hmmm, this is what I see in my test http://cld.wthms.co/4RZjF5 I know you said you’re using latest version but can you double check because we fixed something like this in 4.0.2

    Thread Starter MrFent37

    (@mrfent37)

    I can confirm that I am using version 4.0.3. This happened again with another order that I partially refunded, and I learned a little bit more.

    After I sent the refund, woocommerce actually sent the customer 2 emails one right after another. The first email was correct, no issues. The 2nd email was the one that showed the duplicate refund.

    The first email just shows:”Refund: $10.80

    The second email shows:

    Refunded via Stripe Dashboard -$10.80
    Refund: -$10.80

    So for some reason it’s adding an extra refund amount that says “Refunded via Stripe Dashboard”

    Plugin Contributor royho

    (@royho)

    In the order notes, it only shows 1 refund message you said?

    Thread Starter MrFent37

    (@mrfent37)

    Ok I finally had some time to test this some more, and I think I know what is going on. I was wrong before, it’s not JUST the email that is showing a double refund. The order in woocommerce is also being updated to show a double refund, which is why the 2nd email gets sent out showing a double refund. I was unable to replicate this issue on localhost, and I know why… the whole things has to do with the stripe webhook endpoint that I entered into my stripe account.

    https://screencast.com/t/BRULFr1YYtTP

    So I entered this into my stripe account (using my domain name) and that’s where the trouble started. I believe what is happening when I process a partial refund in woocommerce:

    • I enter refund amount in the order and hit the button “Refund $x.xx via Stripe.”
    • Woocommerce shows the partial refund in the order and also send out the email saying that the order has been partially refunded.
    • Stripe receives the instruction from Woocommerce to partially refund the order

    (Up until now, everything is running correctly. However, because I have that webhook endpoint in my stripe settings, the following now occurs)

    • Stripe then tells woocommerce that the refund occurred.
    • Woocommerce thinks that this is a new/different refund than the original
    • Woocommerce add this “new” refund to the order, saying that it was “Refunded via Stripe Dashboard”
    • Woocommerce send out a 2nd email showing both refunds
    • Depending on the refund amount and the order total, the order in woocommerce may get changed to “refunded” status. When I tested it, I had an order with a total of $0.50. I refunded $0.25. At first when everthing refreshes, it appears normal, but a few seconds later, after Stripe has had a chance to talk back to woocommerce, if you hit refresh in the woocommerce order, you’ll see the double refund. And in this case, since the first refund of $0.25 plus the 2nd false refund of $0.25 equaled the order total of $0.50, the order status changed to “Refunded”

      I did a 2nd test just to be sure. First I removed the webhook endpoint from my strip account, made an order for $0.50, and refunded $0.20. Everything worked fine. Even after a minute, nothing went wrong because the webhook didn’t allow stripe to talk back to woocommerce (and mistakenly add a 2nd refund) THEN, I added the webhook back into my strip account. I went into the order and added a 2nd refund of $0.05. Then the problem came back, and this time stripe saw both the $0.20 refund and the $0.05 refund, and added them up. So it then added a new $0.25 refund to my order.

      https://screencast.com/t/Fcnkjonm6Xq

      This of course brought the refund total to equal the order total, putting the order in Refunded status.

    Plugin Contributor royho

    (@royho)

    Thanks for the detail follow up however there is already in place checks to make sure a refund isn’t already given/processed. If you’re still having this issue with the latest version, I would suspect some race condition issue. Can you confirm?

    Thread Starter MrFent37

    (@mrfent37)

    I am using the latest version. I don’t know what you mean by race condition issue. How would I check that?

    Plugin Contributor royho

    (@royho)

    So when a refund happens we store the refund ID to the order. When webhook triggers, we check against this same ID and if it exists, we don’t process further to prevent double processing. So it is possible in the (race condition) I mentioned that before this ID is stored, webhook started processing at the same time causing that check to fail and thus continues. My assumption here of course.

    In your test, if you tested 10 refunds on 10 different orders, do all of them have same issue?

    Thread Starter MrFent37

    (@mrfent37)

    Well obviously this “check” system isn’t working for partial refunds. There doesn’t seem to be a problem with full refunds, only partial. Yes I’ve tested this many many times with different orders, and they all have the same issue with partial refunds if I have the webhook set in my stripe account.

    Thread Starter MrFent37

    (@mrfent37)

    Also, when you do a test, wait a few seconds after the refund processes, because at first it doesn’t look like there is a problem. But once you refresh the page, you should see the 2nd refund.

    Plugin Contributor royho

    (@royho)

    Ok thanks will try and replicate and look into it.

    Plugin Contributor royho

    (@royho)

    So far I have processed 6 partial refunds back to back over 3 different orders. I have yet to be able to replicate this. I have waited over a minute on each order before I refreshed it to see if it processed the refund again.

    Thread Starter MrFent37

    (@mrfent37)

    And you have the woocommerce web hook set in your stripe account?

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Shipping refund email.’ is closed to new replies.