# Stripe Shared

> Common Stripe types: metadata record and address structure.

- Name: `stripe-shared`
- Categories: stripe
- Detail page: https://open-types.dev/types/stripe-shared

## Install

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

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

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

## Types

```typescript
export type StripeMetadata = Record<string, string>;

export interface StripeAddress {
  line1: string | null;
  line2: string | null;
  city: string | null;
  state: string | null;
  postal_code: string | null;
  country: string | null;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type { StripeAddress, StripeMetadata } from "../types/stripe-shared";

export const stripeMetadataSchema = z.record(z.string(), z.string()) satisfies z.ZodType<StripeMetadata>;

export const stripeAddressSchema = z.object({
  line1: z.string().nullable(),
  line2: z.string().nullable(),
  city: z.string().nullable(),
  state: z.string().nullable(),
  postal_code: z.string().nullable(),
  country: z.string().nullable(),
}) satisfies z.ZodType<StripeAddress>;

export type { StripeAddress, StripeMetadata } from "../types/stripe-shared";
```

## Examples

```typescript
// Source: https://docs.stripe.com/api/metadata, https://docs.stripe.com/api/customers/object#customer_object-address
// Captured: 2026-05
import type { StripeAddress, StripeMetadata } from "../types/stripe-shared";
import { stripeAddressSF, stripeAddressEmpty } from "./shared/stripe.examples";

export const stripeMetadataExamples = {
  empty: {} satisfies StripeMetadata,
  orderTagging: { order_id: "ord_123", customer_tier: "gold" } satisfies StripeMetadata,
  crmLink: { crm_id: "crm_123", segment: "enterprise" } satisfies StripeMetadata,
} as const;

export const stripeAddressExamples = {
  full: stripeAddressSF,
  allNull: stripeAddressEmpty,
  international: {
    line1: "1 Infinite Loop",
    line2: null,
    city: "Cupertino",
    state: "CA",
    postal_code: "95014",
    country: "US",
  } satisfies StripeAddress,
} as const;
```
