# File generated from our OpenAPI spec # frozen_string_literal: true module Stripe # Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. # [Products](https://stripe.com/docs/api#products) help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme. # # For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once. # # Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription), [create an invoice](https://stripe.com/docs/billing/invoices/create), and more about [products and prices](https://stripe.com/docs/products-prices/overview). class Price < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List extend Stripe::APIOperations::Search include Stripe::APIOperations::Save OBJECT_NAME = "price" def self.object_name "price" end # Creates a new price for an existing product. The price can be recurring or one-time. def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/prices", params: params, opts: opts) end # Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing). For the list of inactive prices, set active to false. def self.list(filters = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/prices", params: filters, opts: opts) end def self.search(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/prices/search", params: params, opts: opts) end def self.search_auto_paging_each(params = {}, opts = {}, &blk) search(params, opts).auto_paging_each(&blk) end # Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged. def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/prices/%s", { id: CGI.escape(id) }), params: params, opts: opts ) end end end