class Stripe::Subscription

Overview

Subscriptions allow you to charge a customer on a recurring basis. Related guide: Creating subscriptions

Included Modules

Defined in:

stripe/models/subscription.cr

Constant Summary

ERROR_MESSAGE_FOR_COLLECTION_METHOD = "invalid value for \"collection_method\", must be one of [charge_automatically, send_invoice]."
ERROR_MESSAGE_FOR_OBJECT = "invalid value for \"object\", must be one of [subscription]."
ERROR_MESSAGE_FOR_STATUS = "invalid value for \"status\", must be one of [active, canceled, incomplete, incomplete_expired, past_due, paused, trialing, unpaid]."
MAX_LENGTH_FOR_DESCRIPTION = 500
MAX_LENGTH_FOR_ID = 5000
VALID_VALUES_FOR_COLLECTION_METHOD = String.static_array("charge_automatically", "send_invoice")
VALID_VALUES_FOR_OBJECT = String.static_array("subscription")
VALID_VALUES_FOR_STATUS = String.static_array("active", "canceled", "incomplete", "incomplete_expired", "past_due", "paused", "trialing", "unpaid")

Constructors

Instance Method Summary

Instance methods inherited from module OpenApi::Json

after_initialize after_initialize, clone clone, eql?(o : self) eql?, to_hash : Hash(String, JSON::Any) to_hash, to_json_any : JSON::Any to_json_any

Class methods inherited from module OpenApi::Json

build_from_hash(hash : Hash) build_from_hash, build_from_json_any(json_any : JSON::Any) build_from_json_any

Instance methods inherited from module OpenApi::Validatable

list_invalid_properties : Array(String) list_invalid_properties, list_invalid_properties_for(key : String) : Array(String) list_invalid_properties_for, valid? : Bool valid?, validate : Nil validate

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]
def self.new(*, application : Stripe::SubscriptionApplication | Nil = nil, application_fee_percent : Float64 | Nil = nil, automatic_tax : Stripe::SubscriptionAutomaticTax | Nil = nil, billing_cycle_anchor : Int64 | Nil = nil, billing_cycle_anchor_config : Stripe::SubscriptionBillingCycleAnchorConfig | Nil = nil, billing_thresholds : Stripe::SubscriptionBillingThresholds1 | Nil = nil, cancel_at : Int64 | Nil = nil, cancel_at_period_end : Bool | Nil = nil, canceled_at : Int64 | Nil = nil, cancellation_details : Stripe::SubscriptionCancellationDetails | Nil = nil, collection_method : String | Nil = nil, created : Int64 | Nil = nil, currency : String | Nil = nil, current_period_end : Int64 | Nil = nil, current_period_start : Int64 | Nil = nil, customer : Stripe::SubscriptionCustomer | Nil = nil, days_until_due : Int64 | Nil = nil, default_payment_method : Stripe::SubscriptionDefaultPaymentMethod | Nil = nil, default_source : Stripe::SubscriptionDefaultSource | Nil = nil, description : String | Nil = nil, discount : Stripe::SubscriptionDiscount | Nil = nil, discounts : Array(Stripe::InvoiceitemDiscountsInner) | Nil = nil, ended_at : Int64 | Nil = nil, id : String | Nil = nil, invoice_settings : Stripe::SubscriptionsResourceSubscriptionInvoiceSettings | Nil = nil, items : Stripe::SubscriptionItemList | Nil = nil, latest_invoice : Stripe::SubscriptionLatestInvoice | Nil = nil, livemode : Bool | Nil = nil, metadata : Hash(String, String) | Nil = nil, next_pending_invoice_item_invoice : Int64 | Nil = nil, object : String | Nil = nil, on_behalf_of : Stripe::SubscriptionOnBehalfOf | Nil = nil, pause_collection : Stripe::SubscriptionPauseCollection | Nil = nil, payment_settings : Stripe::SubscriptionPaymentSettings | Nil = nil, pending_invoice_item_interval : Stripe::SubscriptionPendingInvoiceItemInterval1 | Nil = nil, pending_setup_intent : Stripe::SubscriptionPendingSetupIntent | Nil = nil, pending_update : Stripe::SubscriptionPendingUpdate | Nil = nil, schedule : Stripe::SubscriptionSchedule1 | Nil = nil, start_date : Int64 | Nil = nil, status : String | Nil = nil, test_clock : Stripe::SubscriptionTestClock | Nil = nil, transfer_data : Stripe::SubscriptionTransferData1 | Nil = nil, trial_end : Int64 | Nil = nil, trial_settings : Stripe::PaymentLinksResourceSubscriptionDataTrialSettings | Nil = nil, trial_start : Int64 | Nil = nil, default_tax_rates : Array(Stripe::TaxRate) | Nil = nil) #

Initializes the object @param [Hash] attributes Model attributes in the form of hash


[View source]

Instance Method Detail

def ==(other : self) #

Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code


def application : Stripe::SubscriptionApplication | Nil #

[View source]
def application=(new_value : Stripe::SubscriptionApplication | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] application Object to be assigned


[View source]
def application_fee_percent : Float64 | Nil #

[View source]
def application_fee_percent=(new_value : Float64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] application_fee_percent Object to be assigned


[View source]
def automatic_tax : Stripe::SubscriptionAutomaticTax | Nil #

[View source]
def automatic_tax=(new_value : Stripe::SubscriptionAutomaticTax | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] automatic_tax Object to be assigned


[View source]
def billing_cycle_anchor : Int64 | Nil #

[View source]
def billing_cycle_anchor=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] billing_cycle_anchor Object to be assigned


[View source]
def billing_cycle_anchor_config : Stripe::SubscriptionBillingCycleAnchorConfig | Nil #

[View source]
def billing_cycle_anchor_config=(new_value : Stripe::SubscriptionBillingCycleAnchorConfig | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] billing_cycle_anchor_config Object to be assigned


[View source]
def billing_thresholds : Stripe::SubscriptionBillingThresholds1 | Nil #

[View source]
def billing_thresholds=(new_value : Stripe::SubscriptionBillingThresholds1 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] billing_thresholds Object to be assigned


[View source]
def cancel_at : Int64 | Nil #

[View source]
def cancel_at=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] cancel_at Object to be assigned


[View source]
def cancel_at_period_end : Bool | Nil #

[View source]
def cancel_at_period_end=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] cancel_at_period_end Object to be assigned


[View source]
def canceled_at : Int64 | Nil #

[View source]
def canceled_at=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] canceled_at Object to be assigned


[View source]
def cancellation_details : Stripe::SubscriptionCancellationDetails | Nil #

[View source]
def cancellation_details=(new_value : Stripe::SubscriptionCancellationDetails | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] cancellation_details Object to be assigned


[View source]
def collection_method : String | Nil #

[View source]
def collection_method=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] collection_method Object to be assigned


[View source]
def created : Int64 | Nil #

[View source]
def created=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] created Object to be assigned


[View source]
def currency : String | Nil #

[View source]
def currency=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] currency Object to be assigned


[View source]
def current_period_end : Int64 | Nil #

[View source]
def current_period_end=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] current_period_end Object to be assigned


[View source]
def current_period_start : Int64 | Nil #

[View source]
def current_period_start=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] current_period_start Object to be assigned


[View source]
def customer : Stripe::SubscriptionCustomer | Nil #

[View source]
def customer=(new_value : Stripe::SubscriptionCustomer | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] customer Object to be assigned


[View source]
def days_until_due : Int64 | Nil #

[View source]
def days_until_due=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] days_until_due Object to be assigned


[View source]
def default_payment_method : Stripe::SubscriptionDefaultPaymentMethod | Nil #

[View source]
def default_payment_method=(new_value : Stripe::SubscriptionDefaultPaymentMethod | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] default_payment_method Object to be assigned


[View source]
def default_source : Stripe::SubscriptionDefaultSource | Nil #

[View source]
def default_source=(new_value : Stripe::SubscriptionDefaultSource | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] default_source Object to be assigned


[View source]
def default_tax_rates : Array(Stripe::TaxRate) | Nil #

[View source]
def default_tax_rates=(new_value : Array(Stripe::TaxRate) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] default_tax_rates Object to be assigned


[View source]
def default_tax_rates_present=(default_tax_rates_present : Bool) #

[View source]
def default_tax_rates_present? : Bool #

[View source]
def description : String | Nil #

[View source]
def description=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] description Object to be assigned


[View source]
def discount : Stripe::SubscriptionDiscount | Nil #

[View source]
def discount=(new_value : Stripe::SubscriptionDiscount | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] discount Object to be assigned


[View source]
def discounts : Array(Stripe::InvoiceitemDiscountsInner) | Nil #

[View source]
def discounts=(new_value : Array(Stripe::InvoiceitemDiscountsInner) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] discounts Object to be assigned


[View source]
def ended_at : Int64 | Nil #

[View source]
def ended_at=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] ended_at Object to be assigned


[View source]
def hash(hasher) #

Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code


def id : String | Nil #

[View source]
def id=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] id Object to be assigned


[View source]

[View source]
def invoice_settings=(new_value : Stripe::SubscriptionsResourceSubscriptionInvoiceSettings | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] invoice_settings Object to be assigned


[View source]
def items : Stripe::SubscriptionItemList | Nil #

[View source]
def items=(new_value : Stripe::SubscriptionItemList | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] items Object to be assigned


[View source]
def latest_invoice : Stripe::SubscriptionLatestInvoice | Nil #

[View source]
def latest_invoice=(new_value : Stripe::SubscriptionLatestInvoice | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] latest_invoice Object to be assigned


[View source]
def list_invalid_properties : Array(String) #

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons


[View source]
def livemode : Bool | Nil #

[View source]
def livemode=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] livemode Object to be assigned


[View source]
def metadata : Hash(String, String) | Nil #

[View source]
def metadata=(new_value : Hash(String, String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] metadata Object to be assigned


[View source]
def next_pending_invoice_item_invoice : Int64 | Nil #

[View source]
def next_pending_invoice_item_invoice=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] next_pending_invoice_item_invoice Object to be assigned


[View source]
def object : String | Nil #

[View source]
def object=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] object Object to be assigned


[View source]
def on_behalf_of : Stripe::SubscriptionOnBehalfOf | Nil #

[View source]
def on_behalf_of=(new_value : Stripe::SubscriptionOnBehalfOf | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] on_behalf_of Object to be assigned


[View source]
def pause_collection : Stripe::SubscriptionPauseCollection | Nil #

[View source]
def pause_collection=(new_value : Stripe::SubscriptionPauseCollection | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] pause_collection Object to be assigned


[View source]
def payment_settings : Stripe::SubscriptionPaymentSettings | Nil #

[View source]
def payment_settings=(new_value : Stripe::SubscriptionPaymentSettings | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] payment_settings Object to be assigned


[View source]
def pending_invoice_item_interval : Stripe::SubscriptionPendingInvoiceItemInterval1 | Nil #

[View source]
def pending_invoice_item_interval=(new_value : Stripe::SubscriptionPendingInvoiceItemInterval1 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] pending_invoice_item_interval Object to be assigned


[View source]
def pending_setup_intent : Stripe::SubscriptionPendingSetupIntent | Nil #

[View source]
def pending_setup_intent=(new_value : Stripe::SubscriptionPendingSetupIntent | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] pending_setup_intent Object to be assigned


[View source]
def pending_update : Stripe::SubscriptionPendingUpdate | Nil #

[View source]
def pending_update=(new_value : Stripe::SubscriptionPendingUpdate | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] pending_update Object to be assigned


[View source]
def schedule : Stripe::SubscriptionSchedule1 | Nil #

[View source]
def schedule=(new_value : Stripe::SubscriptionSchedule1 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] schedule Object to be assigned


[View source]
def start_date : Int64 | Nil #

[View source]
def start_date=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] start_date Object to be assigned


[View source]
def status : String | Nil #

[View source]
def status=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] status Object to be assigned


[View source]
def test_clock : Stripe::SubscriptionTestClock | Nil #

[View source]
def test_clock=(new_value : Stripe::SubscriptionTestClock | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] test_clock Object to be assigned


[View source]
def transfer_data : Stripe::SubscriptionTransferData1 | Nil #

[View source]
def transfer_data=(new_value : Stripe::SubscriptionTransferData1 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] transfer_data Object to be assigned


[View source]
def trial_end : Int64 | Nil #

[View source]
def trial_end=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] trial_end Object to be assigned


[View source]

[View source]
def trial_settings=(new_value : Stripe::PaymentLinksResourceSubscriptionDataTrialSettings | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] trial_settings Object to be assigned


[View source]
def trial_start : Int64 | Nil #

[View source]
def trial_start=(new_value : Int64 | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] trial_start Object to be assigned


[View source]
def valid? : Bool #

Check to see if the all the properties in the model are valid @return true if the model is valid


[View source]