Skip to main content
POST
/
refunds
cURL
curl  https://api.goshippo.com/refunds/ \
-H "Authorization: ShippoToken <API_TOKEN>" \
-d transaction="4503427478ea45a899e9b54abc4c5803"
import shippo
from shippo.models import components

s = shippo.Shippo(
api_key_header='ShippoToken <API_TOKEN>',
shippo_api_version='2018-02-08',
)


res = s.refunds.create(request=components.RefundRequestBody(
async_=False,
transaction='915d94940ea54c3a80cbfa328722f5a1',
))

if res is not None:
# handle response
pass
import { Shippo } from "shippo";

const shippo = new Shippo({
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08",
});

async function run() {
const result = await shippo.refunds.create({
async: false,
transaction: "915d94940ea54c3a80cbfa328722f5a1",
});

// Handle the result
console.log(result);
}

run();
declare(strict_types=1);

require 'vendor/autoload.php';

use Shippo\API;
use Shippo\API\Models\Components;

$sdk = API\Shippo::builder()
->setSecurity(
'ShippoToken <API_TOKEN>'
)
->setShippoApiVersion('2018-02-08')
->build();

$refundRequestBody = new Components\RefundRequestBody(
async: false,
transaction: '915d94940ea54c3a80cbfa328722f5a1',
);

$response = $sdk->refunds->create(
refundRequestBody: $refundRequestBody,
shippoApiVersion: '2018-02-08'

);

if ($response->refund !== null) {
// handle response
}
using Shippo;
using Shippo.Models.Components;

var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08"
);

var res = await sdk.Refunds.CreateAsync(
refundRequestBody: new RefundRequestBody() {
Async = false,
Transaction = "915d94940ea54c3a80cbfa328722f5a1",
},
shippoApiVersion: "2018-02-08"
);

// handle response
package hello.world;

import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.RefundRequestBody;
import com.goshippo.shippo_sdk.models.operations.CreateRefundResponse;
import java.lang.Exception;

public class Application {

public static void main(String[] args) throws Exception {

Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken <API_TOKEN>")
.shippoApiVersion("2018-02-08")
.build();

CreateRefundResponse res = sdk.refunds().create()
.shippoApiVersion("2018-02-08")
.refundRequestBody(RefundRequestBody.builder()
.transaction("915d94940ea54c3a80cbfa328722f5a1")
.async(false)
.build())
.call();

if (res.refund().isPresent()) {
// handle response
}
}
}
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({transaction: '915d94940ea54c3a80cbfa328722f5a1', async: false})
};

fetch('https://api.goshippo.com/refunds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

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

func main() {

url := "https://api.goshippo.com/refunds"

payload := strings.NewReader("{\n \"transaction\": \"915d94940ea54c3a80cbfa328722f5a1\",\n \"async\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://api.goshippo.com/refunds")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transaction\": \"915d94940ea54c3a80cbfa328722f5a1\",\n \"async\": false\n}"

response = http.request(request)
puts response.read_body
{
  "object_created": "2023-11-07T05:31:56Z",
  "object_id": "adcfdddf8ec64b84ad22772bce3ea37a",
  "object_owner": "shippotle@shippo.com",
  "object_updated": "2023-11-07T05:31:56Z",
  "status": "SUCCESS",
  "test": true,
  "transaction": "915d94940ea54c3a80cbfa328722f5a1"
}
{}

Authorizations

Authorization
string
header
default:ShippoToken
required

API key authentication using the ShippoToken scheme. Format: Authorization: ShippoToken <API_TOKEN> Example: Authorization: ShippoToken shippo_live_abc123

Headers

SHIPPO-API-VERSION
string
default:2018-02-08

Optional string used to pick a non-default API version to use. See our API version guide.

Example:

"2018-02-08"

Body

application/json

Refund details

transaction
string
required
Example:

"915d94940ea54c3a80cbfa328722f5a1"

async
boolean
Example:

false

Response

Refund

object_created
string<date-time>

Date and time of object creation.

object_id
string

Unique identifier of the given object.

Example:

"adcfdddf8ec64b84ad22772bce3ea37a"

object_owner
string

Username of the user who created the object.

Example:

"shippotle@shippo.com"

object_updated
string<date-time>

Date and time of last object update.

status
enum<string>

Indicates the status of the Refund.

Available options:
QUEUED,
PENDING,
SUCCESS,
ERROR
Example:

"SUCCESS"

test
boolean

Indicates whether the object has been created in test mode.

transaction
string

Object ID of the Transaction to be refunded.

Example:

"915d94940ea54c3a80cbfa328722f5a1"