# Record a full refund action

Apply the supported full-refund action to an owned SUCCESS transaction. The amount must equal creditedAmount, falling back to the legacy amount.

Canonical: https://docs-firehorsepay.powerwebhub.com/api/refund
Updated: 2026-11-22; API v1

## Request






## Example response






## Integration notes

This action updates Firehorse transaction state. Do not assume a separate provider refund HTTP call unless the specific provider workflow supports and confirms it.

Verify the amount/currency and authorization before issuing the action. Repeated actions are restricted by transaction state.




## Endpoint

POST /api/v1/transactions/{id}/refund

- id (path): Numeric owned transaction ID.
- amount (required): Exactly the refundable credited amount. Partial refunds are rejected.
- reason (required): Reason for the action.

### Node.js server example

```javascript
// Node.js 18+ · server only. No browser API key.
import { createHash, createHmac, randomUUID } from 'node:crypto';

const key = process.env.FIREHORSE_API_KEY;
if (!key) throw new Error('Set FIREHORSE_API_KEY on the server');
const path = '/api/v1/transactions/100123/refund';
const method = 'POST';
const body = JSON.stringify({
  "amount": "10.00",
  "reason": "Customer requested refund"
});
const timestamp = String(Math.floor(Date.now() / 1000));
const nonce = randomUUID();
const hash = createHash('sha256').update(body, 'utf8').digest('hex');
const canonical = [method, path.split('?')[0], timestamp, nonce, hash].join('\n');
const signature = createHmac('sha256', key).update(canonical).digest('hex');
const response = await fetch('https://firehorsepay.powerwebhub.com/transaction' + path, {
  method, redirect: 'error',
  headers: {
    'X-API-KEY': key, 'X-TIMESTAMP': timestamp,
    'X-NONCE': nonce, 'X-SIGNATURE': signature,
    'Content-Type': 'application/json'
  },
  body
});
const result = await response.json();
if (!response.ok) {
  // Reconcile uncertain results and 409; do not blindly create another order.
  throw new Error('Firehorse HTTP ' + response.status);
}
// Store result securely. A 201/CREATED is not a confirmed payment.
```

### Example response (200)

```json
{
  "id": 100123,
  "uuid": "6f1c0c8e-0d62-4a0f-a913-57c6e45d7c21",
  "type": "DEPOSIT",
  "status": "REFUNDED",
  "amount": 10,
  "currency": "EUR",
  "merchantReference": "order-example-001",
  "redirectUrl": null
}
```
