PaperTiger.Resources.Customer (PaperTiger v1.0.2)

Copy Markdown View Source

Handles Customer resource endpoints.

Endpoints

  • POST /v1/customers - Create customer
  • GET /v1/customers/:id - Retrieve customer
  • POST /v1/customers/:id - Update customer
  • DELETE /v1/customers/:id - Delete customer
  • GET /v1/customers - List customers

Customer Object

%{
  id: "cus_...",
  object: "customer",
  created: 1234567890,
  email: "user@example.com",
  name: "John Doe",
  description: nil,
  metadata: %{},
  default_source: nil,
  default_payment_method: nil,
  # ... other fields
}

Summary

Functions

Creates a new customer.

Deletes a customer.

Lists customers with pagination and optional email filtering.

Retrieves a customer by ID.

Updates a customer.

Functions

create(conn)

@spec create(Plug.Conn.t()) :: Plug.Conn.t()

Creates a new customer.

Required Parameters

None (all optional for Customer creation)

Optional Parameters

  • id - Custom ID (must start with "cus_"). Useful for seeding deterministic data.
  • email - Customer email
  • name - Customer name
  • description - Customer description
  • metadata - Key-value metadata
  • default_source - Default payment source
  • default_payment_method - Default payment method

delete(conn, id)

@spec delete(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Deletes a customer.

Returns a deletion confirmation object.

list(conn)

@spec list(Plug.Conn.t()) :: Plug.Conn.t()

Lists customers with pagination and optional email filtering.

Parameters

  • email - Filter by exact email address (Stripe API behavior)
  • limit - Number of items (default: 10, max: 100)
  • starting_after - Cursor for pagination
  • ending_before - Reverse cursor

retrieve(conn, id)

@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Retrieves a customer by ID.

update(conn, id)

@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Updates a customer.

Updatable Fields

  • email
  • name
  • description
  • metadata
  • default_source
  • default_payment_method