Ask for an invitation
Menu

Endpoint

Cancel a refund request

POST/v1/refunds/{id}/cancel

Allowed while awaiting_address, draft or awaiting_approval. Once signed, a refund cannot be cancelled.

Scope a restricted key needs
refunds:write
Publishable key
Not allowed: secret or restricted key only
Idempotency-Key
Recommended. It makes a retry safe.

Parameters

Parameters of Cancel a refund request
ParameterType and placeMeaning
idrequiredstringpathThe id of the refund.
Orrerie-VersionstringheaderAPI version date. Default: the version the key was created with. Example 2026-10-11.
Idempotency-KeystringheaderMakes a retry safe. Kept 24 hours. 1 to 255 characters.

Request body

A JSON object. The body may be left out. A field the call does not list is refused with parameter_unknown.

Example request

curl

curl https://api.orrerie.com/v1/refunds/rf_z20ve49yz5hve8f0xsdchj2v/cancel \
  -H "Authorization: Bearer $ORRERIE_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

JavaScript

const response = await fetch("https://api.orrerie.com/v1/refunds/rf_z20ve49yz5hve8f0xsdchj2v/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
const result = await response.json();
if (!response.ok) throw new Error(`${result.error.code}: ${result.error.message}`);
console.log(result);

Python

import os
import requests

response = requests.post(
    "https://api.orrerie.com/v1/refunds/rf_z20ve49yz5hve8f0xsdchj2v/cancel",
    headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}"},
    json={},
    timeout=30,
)
result = response.json()
if not response.ok:
    raise RuntimeError(f"{result['error']['code']}: {result['error']['message']}")
print(result)

PHP

<?php
$request = curl_init('https://api.orrerie.com/v1/refunds/rf_z20ve49yz5hve8f0xsdchj2v/cancel');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(new stdClass()),
]);
$body = curl_exec($request);
if ($body === false) {
    throw new RuntimeException(curl_error($request));
}
$result = json_decode($body, true);
if (curl_getinfo($request, CURLINFO_HTTP_CODE) >= 400) {
    throw new RuntimeException($result['error']['code'] . ': ' . $result['error']['message']);
}
print_r($result);

Responses

200 OK

The answer is the refund object. Headers: Orrerie-Request-Id.

Example response, 200

{
  "id": "rf_z20ve49yz5hve8f0xsdchj2v",
  "object": "refund",
  "livemode": true,
  "created": "2026-10-12T10:00:00.000Z",
  "updated": "2026-10-12T10:00:00.000Z",
  "status": "cancelled",
  "pending_reason": null,
  "order": "ord_0zymngngvf12b8b2cra7tb8e",
  "payment": "pay_2pe50hae6w2jk4sp1rcq5pae",
  "amount": "5.00",
  "currency": "USD",
  "reason": "requested_by_customer",
  "note": "One bag arrived damaged",
  "rate_basis": "order_rate",
  "deduct_network_fee": false,
  "source": {
    "wallet": "wal_bsfw07hymawmda7gg8jsyy3g",
    "asset": "base:usdc",
    "amount": "5.000000"
  },
  "destination": {
    "address": "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB",
    "asset": "ethereum:usdc",
    "network": "ethereum",
    "supplied_by": "payer_claim",
    "saved_address": null
  },
  "address_claim": {
    "sent_to": "jane@example.com",
    "sent_at": "2026-10-12T09:40:00.000Z",
    "claimed_at": "2026-10-12T10:00:00.000Z",
    "expires_at": "2026-10-26T09:40:00.000Z"
  },
  "approvable_at": null,
  "delivery": {
    "rail": "relay",
    "amount_estimated": "4.930000",
    "route_fee": {
      "amount": "0.07",
      "currency": "USD"
    },
    "fee_bearer": "recipient"
  },
  "network_fee": null,
  "requested_by": {
    "type": "api_key",
    "id": "key_6e3gg2c6ea176xxdek2nar6v"
  },
  "approved_by": null,
  "approval_url": null,
  "approval_expires_at": "2026-10-19T10:00:00.000Z",
  "transaction_hash": null,
  "failure_code": null,
  "cancellation_reason": "cancelled_by_api",
  "approved_at": null,
  "sent_at": null,
  "confirmed_at": null,
  "metadata": {}
}

Any other status: an error

A status of 400 or above answers with the error object. Branch on its code, never on its message.

Errors

Beside the errors every call can answer with (a bad key, a missing scope, the rate limit), this call answers with:

Errors of Cancel a refund request
CodeHTTPMeaning
money_out_not_cancellable409The request is signed or later. A signed transaction cannot be withdrawn.