question

justanotherprogrammer avatar image
justanotherprogrammer asked zgreathouse Deactivated edited

API Refund amount reporting

When trying to see payment details about a refund, how do you get the correct refund amount back? In my test, I have an original payment of $100, and then a refund of $1. In the web UI, I correctly see those amounts. When using the api, I see the $100 for the payment, but the refund is also showing $100. I have tried using the expansions of payment and transactionInfo, but neither shows that $1. I am using the endpoint /v3/merchants/{mId}/refunds/{refundId}. In addition, is there a way to get the name and last 4 with the refund details, or are you forced to run a separate lookup on the original transaction to see that information?
REST API
10 |2000

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

zgreathouse avatar image
zgreathouse Deactivated answered zgreathouse Deactivated edited
Using the API to fetch a specific refund, the amount field's value (of the refund object given in the response) should be the refunded amount. Given the details you provided, the total field should have a value of 10000 ($100.00) and the amount field should have a value of 100 ($1.00).

You cannot get card's last 4 from the refund object (response). The payment is included in the refund object for reference, however you cannot expand nested fields. You would need to make an additional call to fetch the payment in order to extract the last 4 of the card.
10 |2000

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

justanotherprogrammer avatar image
justanotherprogrammer answered
Ah, that is something I had not noticed in the docs, that the decimal would be removed in the response. That information resolves that issue, thank you!

Not ideal to have to do two requests, but doable. Thanks.
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