PaperTiger.Resources.Price (PaperTiger v0.9.20)
View SourceHandles Price resource endpoints.
Endpoints
- POST /v1/prices - Create price
- GET /v1/prices/:id - Retrieve price
- POST /v1/prices/:id - Update price
- GET /v1/prices - List prices
Note: Prices cannot be deleted (Stripe API limitation).
Price Object
%{
id: "price_...",
object: "price",
created: 1234567890,
active: true,
currency: "usd",
unit_amount: 2000, # $20.00
recurring: %{
interval: "month",
interval_count: 1
},
product: "prod_...",
# ... other fields
}
Summary
Functions
Creates a new price.
Lists all prices with pagination.
Retrieves a price by ID.
Updates a price.
Functions
@spec create(Plug.Conn.t()) :: Plug.Conn.t()
Creates a new price.
Required Parameters
- currency - Three-letter ISO currency code (e.g., "usd")
- product - Product ID this price belongs to
One of:
- unit_amount - Price in cents (e.g., 2000 for $20.00)
- unit_amount_decimal - Price as decimal string
Optional Parameters
- id - Custom ID (must start with "price_"). Useful for seeding deterministic data.
- active - Whether price is active (default: true)
- metadata - Key-value metadata
- recurring - Recurring billing config (interval, interval_count)
- billing_scheme - Pricing model (per_unit, tiered)
- tiers - Tiered pricing configuration
- tiers_mode - Tiering mode (graduated, volume)
@spec list(Plug.Conn.t()) :: Plug.Conn.t()
Lists all prices 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
- currency - Filter by currency
- product - Filter by product
- recurring - Filter recurring/one-time prices
@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Retrieves a price by ID.
@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Updates a price.
Note: Prices can only have limited fields updated.
Updatable Fields
- active
- metadata
- nickname