class Stripe::SubscriptionItemsApi

Defined in:

stripe/api/subscription_items_api.cr

Constant Summary

DELETE_SUBSCRIPTION_ITEMS_ITEM_MAX_LENGTH_FOR_ITEM = 5000
DELETE_SUBSCRIPTION_ITEMS_ITEM_VALID_VALUES_FOR_PRORATION_BEHAVIOR = String.static_array("always_invoice", "create_prorations", "none")
GET_SUBSCRIPTION_ITEMS_ITEM_MAX_LENGTH_FOR_ITEM = 5000
GET_SUBSCRIPTION_ITEMS_MAX_LENGTH_FOR_SUBSCRIPTION = 5000
GET_SUBSCRIPTION_ITEMS_SUBSCRIPTION_ITEM_USAGE_RECORD_SUMMARIES_MAX_LENGTH_FOR_ENDING_BEFORE = 5000
GET_SUBSCRIPTION_ITEMS_SUBSCRIPTION_ITEM_USAGE_RECORD_SUMMARIES_MAX_LENGTH_FOR_STARTING_AFTER = 5000
POST_SUBSCRIPTION_ITEMS_ITEM_MAX_LENGTH_FOR_ITEM = 5000
POST_SUBSCRIPTION_ITEMS_ITEM_MAX_LENGTH_FOR_PLAN = 5000
POST_SUBSCRIPTION_ITEMS_ITEM_MAX_LENGTH_FOR_PRICE = 5000
POST_SUBSCRIPTION_ITEMS_ITEM_VALID_VALUES_FOR_PAYMENT_BEHAVIOR = String.static_array("allow_incomplete", "default_incomplete", "error_if_incomplete", "pending_if_incomplete")
POST_SUBSCRIPTION_ITEMS_ITEM_VALID_VALUES_FOR_PRORATION_BEHAVIOR = String.static_array("always_invoice", "create_prorations", "none")
POST_SUBSCRIPTION_ITEMS_MAX_LENGTH_FOR_PLAN = 5000
POST_SUBSCRIPTION_ITEMS_MAX_LENGTH_FOR_PRICE = 5000
POST_SUBSCRIPTION_ITEMS_MAX_LENGTH_FOR_SUBSCRIPTION = 5000
POST_SUBSCRIPTION_ITEMS_SUBSCRIPTION_ITEM_USAGE_RECORDS_VALID_VALUES_FOR_ACTION = String.static_array("increment", "set")
POST_SUBSCRIPTION_ITEMS_VALID_VALUES_FOR_PAYMENT_BEHAVIOR = String.static_array("allow_incomplete", "default_incomplete", "error_if_incomplete", "pending_if_incomplete")
POST_SUBSCRIPTION_ITEMS_VALID_VALUES_FOR_PRORATION_BEHAVIOR = String.static_array("always_invoice", "create_prorations", "none")

Constructors

Instance Method Summary

Constructor Detail

def self.new(api_client : Stripe::ApiClient = ApiClient.default) #

[View source]

Instance Method Detail

def api_client : ApiClient #

[View source]
def api_client=(api_client : ApiClient) #

[View source]
def build_api_request_for_delete_subscription_items_item(*, item : String | Nil = nil, clear_usage : Bool | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_get_subscription_items(*, subscription : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_get_subscription_items_item(*, item : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_get_subscription_items_subscription_item_usage_record_summaries(*, subscription_item : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_post_subscription_items(*, subscription : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Hash(String, String) | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_post_subscription_items_item(*, item : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, off_session : Bool | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def build_api_request_for_post_subscription_items_subscription_item_usage_records(*, subscription_item : String | Nil = nil, quantity : Int64 | Nil = nil, action : String | Nil = nil, expand : Array(String) | Nil = nil, timestamp : Stripe::PostSubscriptionItemsSubscriptionItemUsageRecordsRequestTimestamp | Nil = nil) : Crest::Request #

@return Crest::Request


[View source]
def client_side_validation?(*args, **options) #

[View source]
def client_side_validation?(*args, **options, &) #

[View source]
def debugging?(*args, **options) #

[View source]
def debugging?(*args, **options, &) #

[View source]
def delete_subscription_items_item(*, item : String | Nil = nil, clear_usage : Bool | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil) : Stripe::DeletedSubscriptionItem #

Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.

@required @param item [String?] @optional @param clear_usage [Bool?] Delete all usage for the given subscription item. Allowed only when the current plan's `usage_type` is `metered`. @optional @param proration_behavior [String?] Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. @return [Stripe::DeletedSubscriptionItem]

[View source]
def delete_subscription_items_item(*, item : String | Nil = nil, clear_usage : Bool | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.</p> @required @param item [String?] @optional @param clear_usage [Bool?] Delete all usage for the given subscription item. Allowed only when the current plan's usage_type is metered. @optional @param proration_behavior [String?] Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now, or starting a trial), or if an item's quantity changes. The default value is create_prorations. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the upcoming invoice endpoint. @return nil


[View source]
def delete_subscription_items_item_with_http_info(*, item : String | Nil = nil, clear_usage : Bool | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil) : Tuple(Stripe::DeletedSubscriptionItem, Int32, Hash(String, Array(String) | String)) #

<p>Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.</p> @required @param item [String?] @optional @param clear_usage [Bool?] Delete all usage for the given subscription item. Allowed only when the current plan's usage_type is metered. @optional @param proration_behavior [String?] Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now, or starting a trial), or if an item's quantity changes. The default value is create_prorations. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the upcoming invoice endpoint. @return [Tuple(Stripe::DeletedSubscriptionItem, Integer, Hash)] Stripe::DeletedSubscriptionItem, response status code and response headers


[View source]
def get_subscription_items(*, subscription : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Stripe::SubscriptionsItemsSubscriptionItemList #

Returns a list of your subscription items for a given subscription.

@required @param subscription [String?] The ID of the subscription whose items will be retrieved. @optional @param ending_before [String?] A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @optional @param starting_after [String?] A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Stripe::SubscriptionsItemsSubscriptionItemList]

[View source]
def get_subscription_items(*, subscription : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Returns a list of your subscription items for a given subscription.</p> @required @param subscription [String?] The ID of the subscription whose items will be retrieved. @optional @param ending_before [String?] A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list. @optional @param starting_after [String?] A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list. @optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return nil


[View source]
def get_subscription_items_item(*, item : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Stripe::SubscriptionItem #

Retrieves the subscription item with the given ID.

@required @param item [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Stripe::SubscriptionItem]

[View source]
def get_subscription_items_item(*, item : String | Nil = nil, expand : Array(Array(String)) | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Retrieves the subscription item with the given ID.</p> @required @param item [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return nil


[View source]
def get_subscription_items_item_with_http_info(*, item : String | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Tuple(Stripe::SubscriptionItem, Int32, Hash(String, Array(String) | String)) #

<p>Retrieves the subscription item with the given ID.</p> @required @param item [String?] @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Tuple(Stripe::SubscriptionItem, Integer, Hash)] Stripe::SubscriptionItem, response status code and response headers


[View source]
def get_subscription_items_subscription_item_usage_record_summaries(*, subscription_item : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Stripe::UsageEventsResourceUsageRecordSummaryList #

For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).

The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.

@required @param subscription_item [String?] @optional @param ending_before [String?] A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @optional @param starting_after [String?] A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Stripe::UsageEventsResourceUsageRecordSummaryList]

[View source]
def get_subscription_items_subscription_item_usage_record_summaries(*, subscription_item : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).</p> <p>The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.</p> @required @param subscription_item [String?] @optional @param ending_before [String?] A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list. @optional @param starting_after [String?] A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list. @optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return nil


[View source]
def get_subscription_items_subscription_item_usage_record_summaries_with_http_info(*, subscription_item : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Tuple(Stripe::UsageEventsResourceUsageRecordSummaryList, Int32, Hash(String, Array(String) | String)) #

<p>For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).</p> <p>The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.</p> @required @param subscription_item [String?] @optional @param ending_before [String?] A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list. @optional @param starting_after [String?] A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list. @optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Tuple(Stripe::UsageEventsResourceUsageRecordSummaryList, Integer, Hash)] Stripe::UsageEventsResourceUsageRecordSummaryList, response status code and response headers


[View source]
def get_subscription_items_with_http_info(*, subscription : String | Nil = nil, ending_before : String | Nil = nil, starting_after : String | Nil = nil, limit : Int64 | Nil = nil, expand : Array(Array(String)) | Nil = nil) : Tuple(Stripe::SubscriptionsItemsSubscriptionItemList, Int32, Hash(String, Array(String) | String)) #

<p>Returns a list of your subscription items for a given subscription.</p> @required @param subscription [String?] The ID of the subscription whose items will be retrieved. @optional @param ending_before [String?] A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list. @optional @param starting_after [String?] A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list. @optional @param limit [Int32?] A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. @optional @param expand [Array(Array(String))?] Specifies which fields in the response should be expanded. @return [Tuple(Stripe::SubscriptionsItemsSubscriptionItemList, Integer, Hash)] Stripe::SubscriptionsItemsSubscriptionItemList, response status code and response headers


[View source]
def post_subscription_items(*, subscription : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Hash(String, String) | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil) : Stripe::SubscriptionItem #

Adds a new item to an existing subscription. No existing items will be changed or replaced.

@required @param subscription [String?] The identifier of the subscription to modify. @optional @param billing_thresholds [Stripe::PostSubscriptionItemsRequestBillingThresholds?] @optional @param discounts [Stripe::PostSubscriptionItemsRequestDiscounts?] @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Hash(String, String)?] @optional @param payment_behavior [String?] Use `allow_incomplete` to transition the subscription to `status=past_due` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. Use `default_incomplete` to transition the subscription to `status=past_due` when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. @optional @param plan [String?] The identifier of the plan to add to the subscription. @optional @param price [String?] The ID of the price object. @optional @param price_data [Stripe::RecurringPriceData?] @optional @param proration_behavior [String?] Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. @optional @param quantity [Int32?] The quantity you'd like to apply to the subscription item you're creating. @optional @param tax_rates [Stripe::PostSubscriptionItemsRequestTaxRates?] @return [Stripe::SubscriptionItem]

[View source]
def post_subscription_items(*, subscription : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Hash(String, String) | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Adds a new item to an existing subscription. No existing items will be changed or replaced.</p> @required @param subscription [String?] The identifier of the subscription to modify. @optional @param billing_thresholds [Stripe::PostSubscriptionItemsRequestBillingThresholds?] @optional @param discounts [Stripe::PostSubscriptionItemsRequestDiscounts?] @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Hash(String, String)?] @optional @param payment_behavior [String?] Use allow_incomplete to transition the subscription to status=past_due if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the SCA Migration Guide for Billing to learn more. This is the default behavior. Use default_incomplete to transition the subscription to status=past_due when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, SCA regulation, or collecting a mandate for a bank debit payment method. Use pending_if_incomplete to update the subscription using pending updates. When you use pending_if_incomplete you can only pass the parameters supported by pending updates. Use error_if_incomplete if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the changelog to learn more. @optional @param plan [String?] The identifier of the plan to add to the subscription. @optional @param price [String?] The ID of the price object. @optional @param price_data [Stripe::RecurringPriceData?] @optional @param proration_behavior [String?] Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now, or starting a trial), or if an item's quantity changes. The default value is create_prorations. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the upcoming invoice endpoint. @optional @param quantity [Int32?] The quantity you'd like to apply to the subscription item you're creating. @optional @param tax_rates [Stripe::PostSubscriptionItemsRequestTaxRates?] @return nil


[View source]
def post_subscription_items_item(*, item : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, off_session : Bool | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil) : Stripe::SubscriptionItem #

Updates the plan or quantity of an item on a current subscription.

@required @param item [String?] @optional @param billing_thresholds [Stripe::PostSubscriptionItemsRequestBillingThresholds?] @optional @param discounts [Stripe::PostSubscriptionItemsRequestDiscounts?] @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Stripe::PostAccountsRequestMetadata?] @optional @param off_session [Bool?] Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `false` (on-session). @optional @param payment_behavior [String?] Use `allow_incomplete` to transition the subscription to `status=past_due` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. Use `default_incomplete` to transition the subscription to `status=past_due` when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. @optional @param plan [String?] The identifier of the new plan for this subscription item. @optional @param price [String?] The ID of the price object. One of `price` or `price_data` is required. When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided. @optional @param price_data [Stripe::RecurringPriceData?] @optional @param proration_behavior [String?] Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. @optional @param quantity [Int32?] The quantity you'd like to apply to the subscription item you're creating. @optional @param tax_rates [Stripe::PostSubscriptionItemsRequestTaxRates?] @return [Stripe::SubscriptionItem]

[View source]
def post_subscription_items_item(*, item : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, off_session : Bool | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Updates the plan or quantity of an item on a current subscription.</p> @required @param item [String?] @optional @param billing_thresholds [Stripe::PostSubscriptionItemsRequestBillingThresholds?] @optional @param discounts [Stripe::PostSubscriptionItemsRequestDiscounts?] @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Stripe::PostAccountsRequestMetadata?] @optional @param off_session [Bool?] Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to false (on-session). @optional @param payment_behavior [String?] Use allow_incomplete to transition the subscription to status=past_due if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the SCA Migration Guide for Billing to learn more. This is the default behavior. Use default_incomplete to transition the subscription to status=past_due when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, SCA regulation, or collecting a mandate for a bank debit payment method. Use pending_if_incomplete to update the subscription using pending updates. When you use pending_if_incomplete you can only pass the parameters supported by pending updates. Use error_if_incomplete if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the changelog to learn more. @optional @param plan [String?] The identifier of the new plan for this subscription item. @optional @param price [String?] The ID of the price object. One of price or price_data is required. When changing a subscription item's price, quantity is set to 1 unless a quantity parameter is provided. @optional @param price_data [Stripe::RecurringPriceData?] @optional @param proration_behavior [String?] Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now, or starting a trial), or if an item's quantity changes. The default value is create_prorations. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the upcoming invoice endpoint. @optional @param quantity [Int32?] The quantity you'd like to apply to the subscription item you're creating. @optional @param tax_rates [Stripe::PostSubscriptionItemsRequestTaxRates?] @return nil


[View source]
def post_subscription_items_item_with_http_info(*, item : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Stripe::PostAccountsRequestMetadata | Nil = nil, off_session : Bool | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil) : Tuple(Stripe::SubscriptionItem, Int32, Hash(String, Array(String) | String)) #

<p>Updates the plan or quantity of an item on a current subscription.</p> @required @param item [String?] @optional @param billing_thresholds [Stripe::PostSubscriptionItemsRequestBillingThresholds?] @optional @param discounts [Stripe::PostSubscriptionItemsRequestDiscounts?] @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Stripe::PostAccountsRequestMetadata?] @optional @param off_session [Bool?] Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to false (on-session). @optional @param payment_behavior [String?] Use allow_incomplete to transition the subscription to status=past_due if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the SCA Migration Guide for Billing to learn more. This is the default behavior. Use default_incomplete to transition the subscription to status=past_due when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, SCA regulation, or collecting a mandate for a bank debit payment method. Use pending_if_incomplete to update the subscription using pending updates. When you use pending_if_incomplete you can only pass the parameters supported by pending updates. Use error_if_incomplete if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the changelog to learn more. @optional @param plan [String?] The identifier of the new plan for this subscription item. @optional @param price [String?] The ID of the price object. One of price or price_data is required. When changing a subscription item's price, quantity is set to 1 unless a quantity parameter is provided. @optional @param price_data [Stripe::RecurringPriceData?] @optional @param proration_behavior [String?] Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now, or starting a trial), or if an item's quantity changes. The default value is create_prorations. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the upcoming invoice endpoint. @optional @param quantity [Int32?] The quantity you'd like to apply to the subscription item you're creating. @optional @param tax_rates [Stripe::PostSubscriptionItemsRequestTaxRates?] @return [Tuple(Stripe::SubscriptionItem, Integer, Hash)] Stripe::SubscriptionItem, response status code and response headers


[View source]
def post_subscription_items_subscription_item_usage_records(*, subscription_item : String | Nil = nil, quantity : Int64 | Nil = nil, action : String | Nil = nil, expand : Array(String) | Nil = nil, timestamp : Stripe::PostSubscriptionItemsSubscriptionItemUsageRecordsRequestTimestamp | Nil = nil) : Stripe::UsageRecord #

Creates a usage record for a specified subscription item and date, and fills it with a quantity.

Usage records provide quantity information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the metered billing plan, Stripe helps you send accurate invoices to your customers.

The default calculation for usage is to add up all the quantity values of the usage records within a billing period. You can change this default behavior with the billing plan’s aggregate_usage parameter. When there is more than one usage record with the same timestamp, Stripe adds the quantity values together. In most cases, this is the desired resolution, however, you can change this behavior with the action parameter.

The default pricing model for metered billing is per-unit pricing. For finer granularity, you can configure metered billing to have a tiered pricing model.

@required @param subscription_item [String?] @required @param quantity [Int32?] The usage quantity for the specified timestamp. @optional @param action [String?] Valid values are `increment` (default) or `set`. When using `increment` the specified `quantity` will be added to the usage at the specified timestamp. The `set` action will overwrite the usage quantity at that timestamp. If the subscription has [billing thresholds](https://stripe.com/docs/api/subscriptions/object#subscription_object-billing_thresholds), `increment` is the only allowed value. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param timestamp [Stripe::PostSubscriptionItemsSubscriptionItemUsageRecordsRequestTimestamp?] @return [Stripe::UsageRecord]

[View source]
def post_subscription_items_subscription_item_usage_records(*, subscription_item : String | Nil = nil, quantity : Int64 | Nil = nil, action : String | Nil = nil, expand : Array(String) | Nil = nil, timestamp : Stripe::PostSubscriptionItemsSubscriptionItemUsageRecordsRequestTimestamp | Nil = nil, &block : Crest::Response -> ) : Nil #

<p>Creates a usage record for a specified subscription item and date, and fills it with a quantity.</p> <p>Usage records provide <code>quantity</code> information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the <a href=&quot;https://stripe.com/docs/billing/subscriptions/metered-billing&quot;>metered billing</a> plan, Stripe helps you send accurate invoices to your customers.</p> <p>The default calculation for usage is to add up all the <code>quantity</code> values of the usage records within a billing period. You can change this default behavior with the billing plan’s <code>aggregate_usage</code> <a href=&quot;/docs/api/plans/create#create_plan-aggregate_usage&quot;>parameter</a>. When there is more than one usage record with the same timestamp, Stripe adds the <code>quantity</code> values together. In most cases, this is the desired resolution, however, you can change this behavior with the <code>action</code> parameter.</p> <p>The default pricing model for metered billing is <a href=&quot;/docs/api/plans/object#plan_object-billing_scheme&quot;>per-unit pricing</a>. For finer granularity, you can configure metered billing to have a <a href=&quot;https://stripe.com/docs/billing/subscriptions/tiers&quot;>tiered pricing</a> model.</p> @required @param subscription_item [String?] @required @param quantity [Int32?] The usage quantity for the specified timestamp. @optional @param action [String?] Valid values are increment (default) or set. When using increment the specified quantity will be added to the usage at the specified timestamp. The set action will overwrite the usage quantity at that timestamp. If the subscription has billing thresholds, increment is the only allowed value. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param timestamp [Stripe::PostSubscriptionItemsSubscriptionItemUsageRecordsRequestTimestamp?] @return nil


[View source]
def post_subscription_items_subscription_item_usage_records_with_http_info(*, subscription_item : String | Nil = nil, quantity : Int64 | Nil = nil, action : String | Nil = nil, expand : Array(String) | Nil = nil, timestamp : Stripe::PostSubscriptionItemsSubscriptionItemUsageRecordsRequestTimestamp | Nil = nil) : Tuple(Stripe::UsageRecord, Int32, Hash(String, Array(String) | String)) #

<p>Creates a usage record for a specified subscription item and date, and fills it with a quantity.</p> <p>Usage records provide <code>quantity</code> information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the <a href=&quot;https://stripe.com/docs/billing/subscriptions/metered-billing&quot;>metered billing</a> plan, Stripe helps you send accurate invoices to your customers.</p> <p>The default calculation for usage is to add up all the <code>quantity</code> values of the usage records within a billing period. You can change this default behavior with the billing plan’s <code>aggregate_usage</code> <a href=&quot;/docs/api/plans/create#create_plan-aggregate_usage&quot;>parameter</a>. When there is more than one usage record with the same timestamp, Stripe adds the <code>quantity</code> values together. In most cases, this is the desired resolution, however, you can change this behavior with the <code>action</code> parameter.</p> <p>The default pricing model for metered billing is <a href=&quot;/docs/api/plans/object#plan_object-billing_scheme&quot;>per-unit pricing</a>. For finer granularity, you can configure metered billing to have a <a href=&quot;https://stripe.com/docs/billing/subscriptions/tiers&quot;>tiered pricing</a> model.</p> @required @param subscription_item [String?] @required @param quantity [Int32?] The usage quantity for the specified timestamp. @optional @param action [String?] Valid values are increment (default) or set. When using increment the specified quantity will be added to the usage at the specified timestamp. The set action will overwrite the usage quantity at that timestamp. If the subscription has billing thresholds, increment is the only allowed value. @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param timestamp [Stripe::PostSubscriptionItemsSubscriptionItemUsageRecordsRequestTimestamp?] @return [Tuple(Stripe::UsageRecord, Integer, Hash)] Stripe::UsageRecord, response status code and response headers


[View source]
def post_subscription_items_with_http_info(*, subscription : String | Nil = nil, billing_thresholds : Stripe::PostSubscriptionItemsRequestBillingThresholds | Nil = nil, discounts : Stripe::PostSubscriptionItemsRequestDiscounts | Nil = nil, expand : Array(String) | Nil = nil, metadata : Hash(String, String) | Nil = nil, payment_behavior : String | Nil = nil, plan : String | Nil = nil, price : String | Nil = nil, price_data : Stripe::RecurringPriceData | Nil = nil, proration_behavior : String | Nil = nil, proration_date : Int64 | Nil = nil, quantity : Int64 | Nil = nil, tax_rates : Stripe::PostSubscriptionItemsRequestTaxRates | Nil = nil) : Tuple(Stripe::SubscriptionItem, Int32, Hash(String, Array(String) | String)) #

<p>Adds a new item to an existing subscription. No existing items will be changed or replaced.</p> @required @param subscription [String?] The identifier of the subscription to modify. @optional @param billing_thresholds [Stripe::PostSubscriptionItemsRequestBillingThresholds?] @optional @param discounts [Stripe::PostSubscriptionItemsRequestDiscounts?] @optional @param expand [Array(String)?] Specifies which fields in the response should be expanded. @optional @param metadata [Hash(String, String)?] @optional @param payment_behavior [String?] Use allow_incomplete to transition the subscription to status=past_due if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the SCA Migration Guide for Billing to learn more. This is the default behavior. Use default_incomplete to transition the subscription to status=past_due when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, SCA regulation, or collecting a mandate for a bank debit payment method. Use pending_if_incomplete to update the subscription using pending updates. When you use pending_if_incomplete you can only pass the parameters supported by pending updates. Use error_if_incomplete if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the changelog to learn more. @optional @param plan [String?] The identifier of the plan to add to the subscription. @optional @param price [String?] The ID of the price object. @optional @param price_data [Stripe::RecurringPriceData?] @optional @param proration_behavior [String?] Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now, or starting a trial), or if an item's quantity changes. The default value is create_prorations. @optional @param proration_date [Int32?] If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the upcoming invoice endpoint. @optional @param quantity [Int32?] The quantity you'd like to apply to the subscription item you're creating. @optional @param tax_rates [Stripe::PostSubscriptionItemsRequestTaxRates?] @return [Tuple(Stripe::SubscriptionItem, Integer, Hash)] Stripe::SubscriptionItem, response status code and response headers


[View source]