# Stripe Refund

> Stripe Refund with amount, status, reason, and linked charge/payment intent.

- Name: `stripe-refund`
- Categories: stripe
- Depends on: `@open-types/stripe-shared`
- Detail page: https://open-types.dev/types/stripe-refund

## Install

```bash
# Types only
npx shadcn add @open-types/stripe-refund

# Types + Zod v4 validators
npx shadcn add @open-types/stripe-refund-zod

# Types + real-world examples
npx shadcn add @open-types/stripe-refund-examples
```

## Types

```typescript
import type { StripeMetadata } from "./stripe-shared";

export type StripeRefundStatus = "succeeded" | "pending" | "failed" | "canceled";

export interface StripeRefund {
  id: string;
  object: "refund";
  amount: number;
  charge: string | null;
  currency: string;
  payment_intent: string | null;
  reason: string | null;
  status: StripeRefundStatus;
  metadata: StripeMetadata;
  created: number;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type { StripeRefund, StripeRefundStatus } from "../types/stripe-refund";
import { stripeMetadataSchema } from "./stripe-shared";

export const stripeRefundStatusSchema = z.enum([
  "succeeded",
  "pending",
  "failed",
  "canceled",
]) satisfies z.ZodType<StripeRefundStatus>;

export const stripeRefundSchema = z.object({
  id: z.string(),
  object: z.literal("refund"),
  amount: z.number(),
  charge: z.string().nullable(),
  currency: z.string(),
  payment_intent: z.string().nullable(),
  reason: z.string().nullable(),
  status: stripeRefundStatusSchema,
  metadata: stripeMetadataSchema,
  created: z.number(),
}) satisfies z.ZodType<StripeRefund>;

export type { StripeRefund, StripeRefundStatus } from "../types/stripe-refund";
```

## Examples

```typescript
// Source: https://docs.stripe.com/api/refunds/object
// Captured: 2026-05
import type {
  StripeRefund,
  StripeRefundStatus,
} from "../types/stripe-refund";
import { stripeIds } from "./shared/stripe.examples";

const succeeded = {
  id: stripeIds.refund,
  object: "refund",
  amount: 2000,
  charge: stripeIds.charge,
  currency: "usd",
  payment_intent: stripeIds.paymentIntent,
  reason: "requested_by_customer",
  status: "succeeded",
  metadata: { return_id: "ret_789" },
  created: 1712948400,
} as const satisfies StripeRefund;

export const stripeRefundStatusExamples = {
  succeeded: "succeeded",
  pending: "pending",
  failed: "failed",
  canceled: "canceled",
} as const satisfies Record<string, StripeRefundStatus>;

export const stripeRefundExamples = {
  succeeded,
  pending: {
    ...succeeded,
    id: "re_3Ot93K2eZvKYlo2Cpending01",
    status: "pending",
  } satisfies StripeRefund,
  failed: {
    ...succeeded,
    id: "re_3Ot93K2eZvKYlo2Cfailed001",
    status: "failed",
  } satisfies StripeRefund,
  fraudulent: {
    ...succeeded,
    id: "re_3Ot93K2eZvKYlo2Cfraud0001",
    reason: "fraudulent",
  } satisfies StripeRefund,
  duplicate: {
    ...succeeded,
    id: "re_3Ot93K2eZvKYlo2Cdup000001",
    reason: "duplicate",
  } satisfies StripeRefund,
  detached: {
    ...succeeded,
    id: "re_3Ot93K2eZvKYlo2Cdetach001",
    charge: null,
    payment_intent: null,
    reason: null,
  } satisfies StripeRefund,
} as const;
```
