<!-- ZenPays documentation · https://docs.zenpayz.com/docs/reference/objects/refund -->

# The Refund object

Represents a refund for a previously completed transaction. Refunds allow merchants to return funds to customers for completed payments. A refund can be for the full amount or a partial amount of the original transaction.

## Fields

<ParamTable
  label="Field"
  rows={[
    { name: "id", type: "string", required: true, desc: "Unique identifier for the refund" },
    { name: "merchantId", type: "string", required: true, desc: "ID of the merchant that issued the refund" },
    { name: "transactionId", type: "string", required: true, desc: "ID of the original transaction being refunded" },
    { name: "customerId", type: "string", required: false, desc: "ID of the customer receiving the refund (if registered)" },
    { name: "customerName", type: "string", required: false, desc: "Name of the customer receiving the refund" },
    { name: "customerEmail", type: "string", required: false, desc: "Email of the customer receiving the refund" },
    { name: "amount", type: "number", required: true, desc: "Refund amount in the smallest currency unit (e.g., cents for USD)" },
    { name: "currency", type: "string", required: true, desc: "Three-letter ISO currency code" },
    { name: "status", type: "RefundStatus", required: true, desc: "Current status of the refund [RefundStatus](/docs/reference/enums/refund-status)" },
    { name: "reason", type: "string", required: false, desc: "Reason provided for the refund" },
    { name: "failureReason", type: "string", required: false, desc: "Reason for failure if the refund failed" },
    { name: "tspRefundId", type: "string", required: false, desc: "External refund ID from the payment provider" },
    { name: "processedAt", type: "string", required: false, desc: "ISO 8601 timestamp when the refund was processed" },
    { name: "metadata", type: "Record<string, unknown>", required: false, desc: "Custom key-value data attached to the refund" },
    { name: "createdAt", type: "string", required: true, desc: "ISO 8601 timestamp when the refund was created" },
    { name: "updatedAt", type: "string", required: true, desc: "ISO 8601 timestamp when the refund was last updated" },
  ]}
/>

## Example

```json
{
  "id": "obj_1a2b3c",
  "merchantId": "merchant_1a2b3c",
  "transactionId": "transaction_1a2b3c",
  "customerId": "customer_1a2b3c",
  "customerName": "string",
  "customerEmail": "customer@example.com",
  "amount": 5000,
  "currency": "USD",
  "status": "pending_approval",
  "createdAt": "2026-01-15T09:30:00Z",
  "updatedAt": "2026-01-15T09:30:00Z"
}
```

## Usage

```typescript
const refund = await client.refunds.get('ref_123');
if (refund.status === 'completed') {
  console.log(`Refund of ${refund.amount} ${refund.currency} completed`);
}
```
