question

cm-brilliant avatar image
cm-brilliant asked rachel Deactivated answered

Refund lineitem isn't working as expected

I'm attempting to create an Order using the REST API and include a returned line item.

The endpoint I'm using for the returned line item is: line_items {"taxRates": [ {"id":"CCR20APTXPHBE","rate":"600000","isDefault": true,"name":"Michigan" } ],"alternateName":"9781250019806","refunded":true,"price":"-2599","name":"[9781250019806] Lost Lake","itemCode":"9781250019806"}

The Order itself appears correctly on the Orders list (ie: the Order Total is correct)

However, when viewing the Receipt the Total is incorrect. The refunded line item appears as a negative number on the receipt, but it is not reducing the Order Total on the receipt. So the Receipt total is different from the Order total.

Also, when I view the Line Items list the refunded item does not appear have been created correctly as the Line Item Details box lists Refunded: No.

My aim is to refund an item not included/sold in this Order and without having to reference an existing Order/Line Item.

Thank you for any assistance.

Refund
10 |2000

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

1 Answer

rachel avatar image
rachel Deactivated answered

Hi @cm_brilliant,

What you're trying to achieve is not a supported behavior.

First and foremost, you can't mark a line item as refunded using the REST API (see this post for more). When you POST a line item with {"refunded": true}, the response object has the field marked false.

Secondly, while you can create a line item with a negative price, that price is treated as a zero by OrderCalc.

Best,

Rachel

10 |2000

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