# Shipping Refund

USPS shipping labels can be refunded if requested within 30 days of
generation. The processing time is at least 15 days, after which the
funds will return to your EasyPost balance. EasyPost fees will also be
refunded. To qualify, a shipment must not have been scanned by the USPS.

UPS and FedEx shipping labels may be refunded within 90 days of
creation.

---

## Refund a Shipment

### Example: POST /shipments/:id/refund

#### cURL

```shell
curl -X POST https://api.easypost.com/v2/shipments/shp_.../refund \
  -u "EASYPOST_API_KEY":
```

#### Go

```go
package shipping_refund

import (
	"fmt"

	"github.com/EasyPost/easypost-go/v5"
)

func refund() {
	client := easypost.New("EASYPOST_API_KEY")

	shipment, _ := client.RefundShipment("shp_...")

	fmt.Println(shipment)
}
```

#### Java

```java
package shipments;

import com.easypost.exception.EasyPostException;
import com.easypost.model.Shipment;
import com.easypost.service.EasyPostClient;

public class Create {
    public static void main(String[] args) throws EasyPostException {
        EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY");

        Shipment shipment = client.shipment.refund("shp_...");

        System.out.println(shipment);
    }
}
```

#### C#

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyPost;
using Newtonsoft.Json;

namespace EasyPostExamples
{
    public class Examples
    {
        public static async Task Main()
        {
            var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY"));

            EasyPost.Models.API.Shipment shipment = await client.Shipment.Refund("shp_...");

            Console.WriteLine(JsonConvert.SerializeObject(shipment, Formatting.Indented));
        }
    }
}
```

#### Node.js

```javascript
const EasyPostClient = require('@easypost/api');

const client = new EasyPostClient('EASYPOST_API_KEY');

(async () => {
  const shipment = await client.Shipment.refund('shp_...');

  console.log(shipment);
})();
```

#### PHP

```php
<?php

$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY');

$shipment = $client->shipment->refund('shp_...');

echo $shipment;
```

#### Python

```python
import easypost

client = easypost.EasyPostClient("EASYPOST_API_KEY")

shipment = client.shipment.refund("shp_...")

print(shipment)
```

#### Ruby

```ruby
require 'easypost'

client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')

shipment = client.shipment.refund('shp_...')

puts shipment
```

Refunding a `Shipment` is available for many carriers
supported by EasyPost.

Once the refund has been submitted, `refund_status` attribute of the `Shipment` will be populated with one of the possible values:

<ul>
  <li>"submitted"</li>
  <li>"refunded"</li>
  <li>"rejected"</li>
  <li>"not_applicable"</li>
</ul>
The most common initial status is "submitted".

Many carriers require that the refund be processed before the `refund_status` will move to "refunded".
The length of this process depends on the carrier, but no greater than 30 days.