PaperTiger.Resources.Product (PaperTiger v1.0.2)

Copy Markdown View Source

Handles Product resource endpoints.

Endpoints

  • POST /v1/products - Create product
  • GET /v1/products/:id - Retrieve product
  • POST /v1/products/:id - Update product
  • DELETE /v1/products/:id - Delete product
  • GET /v1/products - List products

Product Object

%{
  id: "prod_...",
  object: "product",
  created: 1234567890,
  active: true,
  name: "Premium Plan",
  description: "A premium subscription plan",
  metadata: %{},
  # ... other fields
}

Summary

Functions

Creates a new product.

Deletes a product.

Lists all products with pagination.

Retrieves a product by ID.

Updates a product.

Functions

create(conn)

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

Creates a new product.

Required Parameters

  • name - Product name

Optional Parameters

  • id - Custom ID (must start with "prod_"). Useful for seeding deterministic data.
  • active - Whether product is active (default: true)
  • description - Product description
  • metadata - Key-value metadata
  • images - Product images URLs
  • statement_descriptor - Descriptor for bank statements

delete(conn, id)

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

Deletes a product.

Returns a deletion confirmation object.

list(conn)

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

Lists all products with pagination.

Parameters

  • limit - Number of items (default: 10, max: 100)
  • starting_after - Cursor for pagination
  • ending_before - Reverse cursor
  • active - Filter by active status

retrieve(conn, id)

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

Retrieves a product by ID.

update(conn, id)

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

Updates a product.

Updatable Fields

  • active
  • name
  • description
  • metadata
  • images
  • statement_descriptor