# POST:: Criar devolução (estorno) de um Pix recebido

## Endpoint de request

```
https://sandbox.agilspotpay.financehub.com.br/pix/v1/reverse/{transactionId}
```

## Exemplo com as principais linguagem

Retorno em JSON com os dados do cadastro.

{% tabs %}
{% tab title="cPHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sandbox.agilspotpay.financehub.com.br/pix/v1/reverse/{transactionId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"reason\":\"BE08\"}",
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl --request POST \
     --url https://sandbox.agilspotpay.financehub.com.br/pix/v1/reverse/{transactionId} \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"reason":"BE08"}'
```

{% endtab %}

{% tab title="NodeJs Axios" %}

```jsx
const axios = require('axios');

const options = {
  method: 'POST',
  url: 'https://sandbox.agilspotpay.financehub.com.br/pix/v1/reverse/{transactionId}',
  headers: {accept: 'application/json', 'content-type': 'application/json'},
  data: {reason: 'BE08'}
};

axios
  .request(options)
  .then(function (response) {
    console.log(response.data);
  })
  .catch(function (error) {
    console.error(error);
  });
```

{% endtab %}
{% endtabs %}

## **Modelo de retorno&#x20;**<mark style="color:green;">**200 OK**</mark>

```json
{
  "paymentDevolutionId": 856478,
  "transactionId": 45854857,
  "clientRequestId": 0,
  "amount": 10.55,
  "reason": "NARR",
  "originalPactualId": "UPAY",
  "returnIdentification": "D3030629420200808185300887639654",
  "entity": "PixReversal",
  "pactualId": "45fe6866-21a5-4f6d-84c2-950a2a1df8e7",
  "status": "PROCESSING"
}
```
