> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fintoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Return a Transfer

> Automatically return a transfer based on your business logic.

<Note>
  **Only available in Mexico**
</Note>

By the end of this guide, you can return an inbound transfer and handle the webhook events that report the result.

Fintoc lets you return an inbound transfer up to 90 days after the original transfer using the [return transfer endpoint](/reference/transfers-api/transfers/transfers-return). Return a transfer based on your own business logic, for example when you expect a specific amount but receive a different one.

<img src="https://mintcdn.com/fintoc-49b8bee8/SkvJJ-DZ5D4yC6tQ/images/e981759580e31e9b1bd63de2c1d7b25900ca1eab7dd8c749518d1024c7526241-image.png?fit=max&auto=format&n=SkvJJ-DZ5D4yC6tQ&q=85&s=75842010be852d338adab065c90b86f3" alt="" width="2182" height="1254" data-path="images/e981759580e31e9b1bd63de2c1d7b25900ca1eab7dd8c749518d1024c7526241-image.png" />

<br />

## Trigger the return

Using the `transfer_id` and the [`Fintoc-JWS-Signature`](/docs/transfers/transfers-setup/setting-up-jws-keys) header for the request, call the [return transfer endpoint](/reference/transfers-api/transfers/transfers-return):

```curl curl theme={null}
curl --request POST \
     --url https://api.fintoc.com/v2/transfers/return \
     --header 'Authorization: sk_test_9c8d8CeyBTx1VcJzuDgpm4H-bywJCeSx' \
     --header 'Fintoc-JWS-Signature: CNMaYaDGU3ZhFV1ve6p3sAdYXhEklej8DVIAMqIWCkpNmT6Jp7iigcndXwH5q3WQFHiswgIQU5-_-4rV3jKGptCROmEyWPW8_elhYH1apzAyjOjyZ55ygv37xKHzIFhixzAwmXlAv4pfD4lVelYWVNOSN7REA0QJeCy2vKdqZ5cjqCXQ1lkQUlzOE7dpuNoAkhAhAJJ8HaamFKy7Gl7uwmqbIr-dVYv21d_9O7mO26n0gy3zWXD2nJDxU5Mzl2pZd8-sFvUr9Kmp_YkeRMh4bSe0fr1Uc_YgkjpmYUyu7kaxRWTbAdJ3GwqWFMUDiyfhHdzvZPZyU4VkWreimoydMA' \
     --header 'Idempotency-Key: 1ebfd86c-a75b-4606-872f-9f1cdd9724ca' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "transfer_id": "tr_2wlt3xRBaEstTGPezqIGXy6JUU8"
}
'
```

```node Node theme={null}
const transfer = await fintoc.v2.transfers.returnTransfer({
  transfer_id: "tr_2wlt3xRBaEstTGPezqIGXy6JUU8",
});
```

```python Python theme={null}
transfer = client.v2.transfers.return_transfer(
  transfer_id="tr_2wlt3xRBaEstTGPezqIGXy6JUU8"
)
```

```json Response theme={null}
{
  "id": "tr_2wlt3xRBaEstTGPezqIGXy6JUU8",
  "object": "transfer",
  "direction": "inbound",
  "status": "return_pending",
  "amount": 100000,
  "currency": "mxn",
  "mode": "test",
  "post_date": "2020-04-17T00:00:00.000Z",
  "transaction_date": "2020-04-17T05:12:41.462Z",
  "comment": "Electricity bill",
  "reference_id": "130824",
  "receipt_url": "https://api.fintoc.com/v2/transfers/tr_2wlt3xRBaEstTGPezqIGXy6JUU8/receipt",
  "tracking_key": "s2123423423324334",
  "return_reason": null,
  "account_number": {
    "id": "acno_Kasf91034gj1AD",
    "object": "account_number",
    "account_id": "acc_Lq7dP901xZgA2B",
    "description": "My payins",
    "number": "111111111111111111",
    "created_at": "2024-03-01T20:09:42.949787176Z",
    "mode": "test",
    "metadata": {
      "id_cliente": "12343212"
    }
  },
  "counterparty": {
    "holder_id": "AAA010101AAA",
    "holder_name": "Test Customer 1",
    "account_number": "000000000000000000",
    "type": "clabe",
    "institution": {
      "id": "40012",
      "name": "BBVA Mexico",
      "country": "mx"
    }
  }
}
```

On success, the API returns a transfer object with `return_pending` status. After Fintoc processes the return, the status changes to `returned`.

## Handle the result of the return

Handle the following webhook events to track the outcome of a return:

| Event                            | Description                                                                                                                    |
| :------------------------------- | :----------------------------------------------------------------------------------------------------------------------------- |
| `transfer.inbound.returned`      | Fintoc returned the transfer. The `receipt_url` shows the original Comprobante Electrónico de Pago with the status "Devuelta". |
| `transfer.inbound.return_failed` | Fintoc could not return the transfer, so the transfer returns to its original `succeeded` status.                              |

## Test the integration

Confirm your integration in `test` mode before going live. Trigger a return against a simulated inbound transfer and check that your webhook handler receives the expected event:

* For a successful return, expect the `transfer.inbound.returned` event and a transfer with `returned` status.
* For a failed return, expect the `transfer.inbound.return_failed` event and a transfer back in `succeeded` status.

See [Test your integration](/docs/transfers/transfers-setup/test-your-integration) for the steps to simulate both scenarios.
