# Refunds with the RefundTransactions API

Source: https://developer.avalara.com/avatax-dm-combined-erp/sales-tax-badge/transactions/refunds-with-refundtransactions-api/

# Refunds with the RefundTransactions API

As previously stated, the [RefundTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/RefundTransaction/) allows you to quickly and easily create a`ReturnInvoice` representing a refund for a previously created`SalesInvoice` transaction. You can choose to create a full or partial refund, and specify individual line items from the original sale for refund.

The RefundTransaction API ensures that the tax amount you refund to the customer exactly matches the tax that was calculated during the original transaction, regardless of any changes to your company's configuration, rules, taxing jurisdictions, or any other setting.

This API is intended to be a shortcut to allow you to quickly and accurately generate a refund for the following common refund scenarios:

-   A full refund of a previous sale using`refundType="Full"`
-   Refund the tax that was charged on a previous sale, when the customer provides an exemption certificate after the purchase using`refundType="TaxOnly"`
-   Refund one or more items (lines) from a previous sale using`refundType="Partial"`
-   Granting a customer a percentage refund of a previous sale using`refundType="Percentage"`

**Advice:**

-   The`RefundTransaction` API cannot be used to refund a partial dollar amount or partial quantity. Use the`CreateTransaction` API with a`ReturnInvoice` doc type and negative dollar value for these types of partial refunds.
-   The`RefundTransaction` API cannot be used to for multitax transactions (for example, transactions that resulted in both sales tax and landed cost. Use the`CreateTransaction` API with a`TaxOverride` for each tax type.

## Recommendations and requirements

-   Refunds can be made for documents that have been committed and where the tax has been remitted to the appropriate jurisdiction.
-   Refunds can be made for locked transactions.
-   The`refundTransactionCode` in the return invoice must match the transaction`code` of the original sale.
-   Set the`refundDate` to the date when the return is being processed. This will override the date used for tax calculation so that the same taxes are calculated as on the original order. Do not use the date of the original order.
-   If doing a partial transaction, pass only the line items being returned. Do not include the line items that will not be returned.

## Example request

Below is an example refund request using the RefundTransaction API. After successful completion, the refunded item will be reversed on your tax reporting and will appear essentially as a “credit” on the current month’s tax liability. In the request URL, the company code is DEFAULT, and the code for the original transaction is TestTransaction1.

```
curl    -X POST    -H 'Accept: application/json'    -H 'Authorization: Basic ${btoa(`:`)}'    -H 'Content-Type: application/json'    --data '{        "refundTransactionCode": "RefundTransaction1",        "refundDate": "2020-10-12",        "refundType": "Full",        "referenceCode": "Refund for a committed transaction"    }'    'https://sandbox-rest.avatax.com/api/v2/companies/DEFAULT/transactions/TestTransaction1/refund'
```

[Previous](/avatax-dm-combined-erp/sales-tax-badge/transactions/refund-methods)

[Next](/avatax-dm-combined-erp/sales-tax-badge/transactions/refunds-with-create-transactions)