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
@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
@spec delete(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Deletes a customer.
Returns a deletion confirmation object.
@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
@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Retrieves a customer by ID.
@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Updates a customer.
Updatable Fields
- name
- description
- metadata
- default_source
- default_payment_method