question

jms avatar image
jms asked wrcf answered

E-commerce item refund amounts

Hi, we use the /v1/orders/{orderId}/returns endpoint to do line item refunds for an order. We came across the following issues recently:

1. Clover refunding more that requested:

Request:
{"items":[{"parent":"34HG2Z9ASVP5A","amount":611,"quantity":1,"type":"sku"}]}

Response:
{"id":"K7T6MCF0GBSKR","amount":999,"tip_amount":45,"amount_returned":656,"currency":"USD","items":[{"type":"sku","parent":"34HG2Z9ASVP5A","quantity":1,"amount":611}],"status":"returned","status_transitions":{}}

Notice that, even though a refund was requested for $6.11, e-commerce basically has gone ahead and refunded $6.56. We presume this is including the tips (6.11 + 0.45 = 6.56)

2. Subsequent Refunds Fail

Request:
{"items":[{"parent":"20YJX9AH957RR","amount":388,"quantity":1,"type":"sku"}]}

Response:
{"message":"400 Bad Request","error":{"code":"processing_error","message":"This refund would make the order's total refunded amount greater than the original order's amount.\n\nConsider doing a refund on a payment instead."}}

However, this does not make sense due to the following reasons:

Order Total = 10.44 ($9.99 + $0.45tips)
Assuming our requested amounts:
6.11(refund1) + 3.88(refund2) = 9.99 is less than our order total
Assuming clover adjusted amounts:
6.56(refund1) + 3.88(refund2) = 10.44 is still equal to our order total

Only way to make sense of this is that it seems clover has brought in new functionality to refund tips along with line item refunds, but it tries to include these tips for each subsequent line item refunds.

This causes subsequent line item refunds to fail since tips are sneakily added to the refund amount for each request causes multiple tip refunds.

Some Context:

The order was paid for as follows:

Request:
{"amount":999,"currency":"USD","source":"clv_1TSTS7ZfePTPVx2fCpFqkDgJ","tip_amount":45,"stored_credentials":{"sequence":"SUBSEQUENT","initiator":"CARDHOLDER","is_scheduled":false}}

Response:
{"id":"K7T6MCF0GBSKR","object":"order","amount":999,"tip_amount":45,"tax_amount":18,"amount_paid":999,"tax_amount_paid":18,"currency":"USD","charge":"VR7CRV9R2XAZA","created":1637918921000,"ref_num":"133000503805","auth_code":"OK5596","items":[{"parent":"PA0VVTJZK0WV4","inventory_id":"PA0VVTJZK0WV4","amount":350,"description":"ButterCroissants","tax_rates":[{"name":"DefaultTaxof2%","rate":200000}]},{"parent":"WQGBWE1YMQGFR","inventory_id":"WQGBWE1YMQGFR","amount":550,"description":"ChestnutRoseCassisTart","tax_rates":[{"name":"DefaultTaxof2%","rate":200000}]}]}

Notice that the total for the order is $9.99 + $0.45(tips) = $10.44

e-commerce apiRefundLineItems
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered

Thank you for the detailed post. I will report this to the EComm team.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented

I know this isn't ideal, but the current behavior of the returns endpoint is to refund the entire tip amount per request. We are aware that this is a limiting factor and investigating improving the API.

3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jms avatar image jms commented ·

So this means, the 2nd refund request would be failing regardless as it is trying to add a tip that is no longer there. This wasn't the behavior before and we had no issues refunding these kinds of orders. Seems like it was introduced recently.

We are hoping the Ecomm team will be providing a fix for this.

0 Likes 0 ·
jms avatar image jms commented ·
Hi @ David, any update on this?
0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ jms commented ·

I wrote up two issues for this post. 1) The fact that we are always returning the full tip amount and that we don't provide developers with other options, this issue is still open. 2) Refunding a partial payment fails, this issue has been resolved and is scheduled to be deployed to US production ~ Jan 14. I am not sure if just fix 2 alone will help you but the fix should already be deployed in Sandbox if you want to check it out.

0 Likes 0 ·
wrcf avatar image
wrcf answered

Any update on this? We are experiencing the same issue. Tip is always refunded whether or not we want it to be (we do not).

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community