## Get Refund

### cURL

```bash
curl --request GET \
  --url https://api.withflex.com/v1/refunds/{refund_id} \
  --header 'Authorization: Bearer <token>'
```

```python
import requests

url = "https://api.withflex.com/v1/refunds/{refund_id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

```javascript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.withflex.com/v1/refunds/{refund_id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

```php
<?php
$curl = curl_init();
curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.withflex.com/v1/refunds/{refund_id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>"]
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
```

```go
package main

import (
	"fmt"
	"net/http"	"io"
)

func main() {

url := "https://api.withflex.com/v1/refunds/{refund_id}"

req, _ := http.NewRequest("GET", url, nil)
	req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

```java
HttpResponse<String> response = Unirest.get("https://api.withflex.com/v1/refunds/{refund_id}")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.withflex.com/v1/refunds/{refund_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

### Status Codes

- 200
- 401
- 403
- 404
- 409
- 422
- 429

### Response

```json
{
  "refund": {
    "refund_id": "fre_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "payment_intent_id": "fpi_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "amount": 2500,
    "created_at": "2026-06-15T14:30:00Z",
    "reason": "duplicate",
    "status": "pending",
    "test_mode": false,
    "metadata": {
      "order_id": "8842",
      "channel": "shopify"
    },
    "reference_id": "obj_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "reference_type": "acquirer_reference_number",
    "reference_status": "available",
    "items": [{}],
    "subscription_id": "fsub_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "invoice_id": "fin_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
  }
}
```

```json
{
  "code": "string",
  "detail": "string"
}
```

### Authorizations

- **Authorization**: Use a Bearer token to access this API.

### Path Parameters

- **refund_id**: Required. Example: "fre_01J9XR8M3K7VZ8N2YB4WJ6T0RA"

### Response

200: application/json  
An envelope wrapping a single refund object.

```json
{
  "refund_id": "fre_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
  "payment_intent_id": "fpi_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
  "amount": 2500,
  "created_at": "2026-06-15T14:30:00Z",
  "reason": "duplicate",
  "status": "pending",
  "test_mode": false,
  "metadata": {"order_id": "8842", "channel": "shopify"},
  "reference_id": "obj_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
  "reference_type": "acquirer_reference_number",
  "reference_status": "available",
  "items": [{
    "amount_refunded": 2500,
    "payment_intent": "fpi_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "payment_method_id": "fpm_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "reference_id": "obj_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
  }],
  "subscription_id": "fsub_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
  "invoice_id": "fin_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
  "balance_transaction": "fbtxn_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
  "failure_balance_transaction": "fbtxn_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
}
```
