Hi there Pengyi,
I’m sorry to hear that you’re seeing issues with Square refunds!
I did try it on my test site where I have Square configured in Sandbox mode and my refund went through just fine.
To determine why it’s happening, can you please follow these steps:
– Enable logging in WooCommerce > Settings > Payments > Square: https://d.pr/i/SwW3xc
– Place a test order on your site. You can create a test product with $1 price to do that.
– Refund this order.
– Check logs for this refund in WooCommerce > Status > Logs > choose square_credit_card
from the drop-down: https://d.pr/i/eNZDfM
Please remove all the personal and sensitive information from the logs and use https://pastebin.com/ to share them here.
Enjoy the rest of your day and stay safe!
Hi Elvira,
Thank you for your reply!
I followed your instructions, here is what I got:
https://pastebin.com/xj8SwyaC
It seems just a 500 error
Any advice?
Thank you very much!
Pengyi
Hi Elvira,
When I enable log, it doesn’t show “Could not find original transaction tender. Please refund this transaction from your Square dashboard” message anymore, but keep show a spin icon.
The problem is when I go back to check the order, it show ‘Refunded’.
But actually it’s not when I check it on our square dashboard.
I hope it help to troubleshoot the issue.
Thanks,
Pengyi
Hi there @rocwing,
Thank you for running the test for me and for the logs provided!
Indeed, I see 500 Internal Server Error
in Square response. Can you please try to re-connect Square in WooCommerce > Settings > Square and try again?
If it doesn’t help, please confirm that you see the same behaviour with all plugins except for WooCommerce and Square disabled and Storefront theme as active?
Let me know how that goes!
Hi @treibalen,
Thank you for your help!
Re-connect Square doesn’t work, I’ve done that before.
I disabled all other plugins on our staging site, it’s still the same issue. We don’t have issues to process the payment, just refund.
Do you mean 500 Internal Server Error
is from Square? Do you know if there is a way I can check on Square to see more details for this request, like logs, so we can know why it’s an error?
Pengyi
Hi there @rocwing,
Thanks for all the troubleshooting you did so far!
According to Square API docs, this error happens when Square encountered an unexpected error processing the request
– https://developer.squareup.com/docs/build-basics/handling-errors#http-protocol-status-codes
Can you please reach out to Square support to find why this response was sent? They might indeed have some logs on their end: https://squareup.com/help/us/en/
Please keep me posted on their response!
Hi @treibalen ,
Finally I figured it out!
Our orders are placed through WooCommerce APIs, there are three values we need put in meta_data, so Woocommmerce square plugin can use it to refund.
But I believe for the code below:
https://pastebin.com/jc2j0Y2B
If it can return the real error reason(for example, no trans_id or can’t find transactions etc..), it will be very helpful to troubleshot the issue.
Regards,
Pengyi
Hi there @rocwing,
Great sleuthing here!
From the code, I see that _wc_square_credit_card_square_location_id
and _wc_square_credit_card_authorization_code
are required. Which is the third meta_data that you had to add to process the refund?
I’ll submit an Enhancement request as soon as I can replicate the issue.
Looking forward to hearing back from you!
Hi @treibalen
It’s wc_square_credit_card_charge_captured
, or it will try to void the payment, but it will return an error, something like ‘…can’t find trans_id in this location_id…’
// if captures are supported and the order has an authorized, but not captured charge, void it instead
if ( $this->supports_voids() && ! $this->get_capture_handler()->is_order_captured( $order ) ) {
return $this->process_void( $order );
}
Pengyi
Hi there @rocwing ,
I cleared wc_square_credit_card_charge_captured
meta key for one of my orders paid with Square and received the following error instead:
Square Void Failed: BAD_REQUEST - Not a delay capture transaction.
Which makes sense since now it doesn’t see that the charge was captured.
Since I can’t replicate this issue with orders placed via site front-end (not API), I will close the thread.
Enjoy the rest of your day and stay safe!