# Automatic refund tracking

Devtodev allows you to collect refund data automatically for purchases made through the Google Play and App Store platforms. Refunds are recorded as transactions with negative amounts and matched to original purchases whenever possible.

The automatic refund tracking system helps you monitor actual revenue more accurately and analyze refund patterns without manual event configuration.

{% hint style="warning" %}
Automatic refund tracking is available only for the **Google Play** and **App Store** platforms, and only for purchases made using their native payment systems.\
If you are using a third-party payment system, you need to send refunds manually using the **Real Payment** event with a negative amount.
{% endhint %}

{% hint style="info" %}
If you're using **Unity** and sending `Real Payment` events manually, refunds may not be processed correctly. This is because the purchase token is partially truncated in the SDK, which prevents it from being matched with store refunds.

We strongly recommend enabling [**automatic payment tracking**](https://docs.devtodev.com/integration/autocapture/automatic-payment-tracking) to ensure correct refund matching on Unity for Android.
{% endhint %}

## How it works

Refunds are collected via store APIs or postbacks and processed on the server side. For each refund:

* devtodev attempts to match it to an original transaction by transaction ID.
* The refund is saved as a transaction with a negative amount.
* The event is dated using the refund processing date (not the original payment date).

{% hint style="info" %}
**Note**: Refund tracking works automatically — **no changes in the SDK** are required.
{% endhint %}

## Setup

{% hint style="success" %}
We recommend using automatic refund tracking **together with** [**automatic payment tracking**](https://docs.devtodev.com/integration/autocapture/automatic-payment-tracking) to ensure accurate matching and avoid inconsistencies in reports.
{% endhint %}

To enable refund tracking:

* Set up integration with the App Store or Google Play.
* Go to: `Settings → Payments integration → IA refunds tracking`.
* Click the ✎ icon next to IA refunds tracking and fill in the fields related to the platform.
* Refund tracking starts working automatically on supported platforms after you enable it in the devtodev interface.
* No SDK-side changes are required.

For details on how to set up integration with app stores, see:

{% columns %}
{% column %}
{% content-ref url="automatic-refund-tracking/app-store" %}
[app-store](https://docs.devtodev.com/integration/autocapture/automatic-refund-tracking/app-store)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
{% content-ref url="automatic-refund-tracking/google-play" %}
[google-play](https://docs.devtodev.com/integration/autocapture/automatic-refund-tracking/google-play)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devtodev.com/integration/autocapture/automatic-refund-tracking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
