Class: AdvancedBilling::CreateSubscription
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateSubscription
- Defined in:
- lib/advanced_billing/models/create_subscription.rb
Overview
CreateSubscription Model.
Instance Attribute Summary collapse
-
#ach_agreement ⇒ ACHAgreement
(Optional) If passed, the proof of the authorized ACH agreement terms will be persisted.
-
#activated_at ⇒ String
Setting this attribute to true will cause the subscription’s MRR to be added to your MRR analytics immediately.
-
#agreement_acceptance ⇒ AgreementAcceptance
Required when creating a subscription with Maxio Payments.
-
#agreement_terms ⇒ String
(Optional) The ACH authorization agreement terms.
-
#authorizer_first_name ⇒ String
(Optional) The first name of the person authorizing the ACH agreement.
-
#authorizer_last_name ⇒ String
(Optional) The last name of the person authorizing the ACH agreement.
-
#bank_account_attributes ⇒ BankAccountAttributes
Credit Card data to create a new Subscription.
-
#calendar_billing ⇒ CalendarBilling
(Optional).
-
#calendar_billing_first_charge ⇒ String
(Optional) One of “prorated” (the default – the prorated product price will be charged immediately), “immediate” (the full product price will be charged immediately), or “delayed” (the full product price will be charged with the first scheduled renewal).
-
#canceled_at ⇒ String
Setting this attribute to true will cause the subscription’s MRR to be added to your MRR analytics immediately.
-
#cancellation_message ⇒ String
(Optional) Can be used when canceling a subscription (via the HTTP DELETE method) to make a note about the reason for cancellation.
-
#cancellation_method ⇒ String
(Optional) Can be used when canceling a subscription (via the HTTP DELETE method) to make a note about how the subscription was canceled.
-
#components ⇒ Array[CreateSubscriptionComponent]
(Optional) An array of component ids and quantities to be added to the subscription.
-
#coupon_code ⇒ String
(deprecated) The coupon code of the single coupon currently applied to the subscription.
-
#coupon_codes ⇒ Array[String]
An array for all the coupons attached to the subscription.
-
#credit_card_attributes ⇒ PaymentProfileAttributes
Credit Card data to create a new Subscription.
-
#currency ⇒ String
(Optional) If Multi-Currency is enabled and the currency is configured in Chargify, pass it at signup to create a subscription on a non-default currency.
-
#custom_price ⇒ CustomPriceUsedForSubscriptionCreateUpdate
(Optional) Used in place of ‘product_price_point_id` to define a custom price point unique to the subscription.
-
#customer_attributes ⇒ CustomerAttributes
The reference value (provided by your app) for the subscription itelf.
-
#customer_id ⇒ Integer
The ID of an existing customer within Chargify.
-
#customer_reference ⇒ String
The reference value (provided by your app) of an existing customer within Chargify.
-
#dunning_communication_delay_enabled ⇒ TrueClass | FalseClass
Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the ‘dunning_communication_delay_time_zone` attribute.
-
#dunning_communication_delay_time_zone ⇒ String
Time zone for the Dunning Communication Delay feature.
-
#expiration_tracks_next_billing_change ⇒ String
(Optional, default false) When set to true, and when next_billing_at is present, if the subscription expires, the expires_at will be shifted by the same amount of time as the difference between the old and new “next billing” dates.
-
#expires_at ⇒ String
Timestamp giving the expiration date of this subscription (if any).
-
#group ⇒ Object
The reference value (provided by your app) of an existing customer within Chargify.
-
#import_mrr ⇒ TrueClass | FalseClass
Setting this attribute to true will cause the subscription’s MRR to be added to your MRR analytics immediately.
-
#initial_billing_at ⇒ String
(Optional) Set this attribute to a future date/time to create a subscription in the “Awaiting Signup” state, rather than “Active” or “Trialing”.
-
#metafields ⇒ Hash[String, String]
(Optional) A set of key/value pairs representing custom fields and their values.
-
#net_terms ⇒ String
(Optional) Default: null The number of days after renewal (on invoice billing) that a subscription is due.
-
#next_billing_at ⇒ String
(Optional) Set this attribute to a future date/time to sync imported subscriptions to your existing renewal schedule.
-
#offer_id ⇒ Object
Use in place of passing product and component information to set up the subscription with an existing offer.
-
#payment_collection_method ⇒ PaymentCollectionMethod
The type of payment collection to be used in the subscription.
-
#payment_profile_attributes ⇒ PaymentProfileAttributes
alias to credit_card_attributes.
-
#payment_profile_id ⇒ Integer
The Payment Profile ID of an existing card or bank account, which belongs to an existing customer to use for payment for this subscription.
-
#prepaid_subscription_configuration ⇒ UpsertPrepaidConfiguration
Use in place of passing product and component information to set up the subscription with an existing offer.
-
#previous_billing_at ⇒ String
Providing a previous_billing_at that is in the past will set the current_period_starts_at when the subscription is created.
-
#product_change_delayed ⇒ TrueClass | FalseClass
(Optional, used only for Delayed Product Change When set to true, indicates that a changed value for product_handle should schedule the product change to the next subscription renewal..
-
#product_handle ⇒ String
The API Handle of the product for which you are creating a subscription.
-
#product_id ⇒ String
The Product ID of the product for which you are creating a subscription.
-
#product_price_point_handle ⇒ String
The user-friendly API handle of a product’s particular price point.
-
#product_price_point_id ⇒ String
The ID of the particular price point on the product.
-
#reason_code ⇒ String
(Optional) Can be used when canceling a subscription (via the HTTP DELETE method) to indicate why a subscription was canceled.
-
#receives_invoice_emails ⇒ String
(Optional) Default: True - Whether or not this subscription is set to receive emails related to this subscription.
-
#ref ⇒ String
A valid referral code.
-
#reference ⇒ String
The reference value (provided by your app) for the subscription itelf.
-
#sales_rep_id ⇒ Integer
For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer.
-
#skip_billing_manifest_taxes ⇒ TrueClass | FalseClass
Valid only for the Subscription Preview endpoint.
-
#stored_credential_transaction_id ⇒ Integer
For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
Methods inherited from BaseModel
Constructor Details
#initialize(product_handle = SKIP, product_id = SKIP, product_price_point_handle = SKIP, product_price_point_id = SKIP, custom_price = SKIP, coupon_code = SKIP, coupon_codes = SKIP, payment_collection_method = PaymentCollectionMethod::AUTOMATIC, receives_invoice_emails = SKIP, net_terms = SKIP, customer_id = SKIP, next_billing_at = SKIP, initial_billing_at = SKIP, stored_credential_transaction_id = SKIP, sales_rep_id = SKIP, payment_profile_id = SKIP, reference = SKIP, customer_attributes = SKIP, payment_profile_attributes = SKIP, credit_card_attributes = SKIP, bank_account_attributes = SKIP, components = SKIP, calendar_billing = SKIP, metafields = SKIP, customer_reference = SKIP, group = SKIP, ref = SKIP, cancellation_message = SKIP, cancellation_method = SKIP, currency = SKIP, expires_at = SKIP, expiration_tracks_next_billing_change = SKIP, agreement_terms = SKIP, authorizer_first_name = SKIP, authorizer_last_name = SKIP, calendar_billing_first_charge = SKIP, reason_code = SKIP, product_change_delayed = SKIP, offer_id = SKIP, prepaid_subscription_configuration = SKIP, previous_billing_at = SKIP, import_mrr = SKIP, canceled_at = SKIP, activated_at = SKIP, agreement_acceptance = SKIP, ach_agreement = SKIP, dunning_communication_delay_enabled = false, dunning_communication_delay_time_zone = SKIP, skip_billing_manifest_taxes = false) ⇒ CreateSubscription
Returns a new instance of CreateSubscription.
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 433 def initialize( product_handle = SKIP, product_id = SKIP, product_price_point_handle = SKIP, product_price_point_id = SKIP, custom_price = SKIP, coupon_code = SKIP, coupon_codes = SKIP, payment_collection_method = PaymentCollectionMethod::AUTOMATIC, receives_invoice_emails = SKIP, net_terms = SKIP, customer_id = SKIP, next_billing_at = SKIP, initial_billing_at = SKIP, stored_credential_transaction_id = SKIP, sales_rep_id = SKIP, payment_profile_id = SKIP, reference = SKIP, customer_attributes = SKIP, payment_profile_attributes = SKIP, credit_card_attributes = SKIP, bank_account_attributes = SKIP, components = SKIP, calendar_billing = SKIP, = SKIP, customer_reference = SKIP, group = SKIP, ref = SKIP, = SKIP, cancellation_method = SKIP, currency = SKIP, expires_at = SKIP, expiration_tracks_next_billing_change = SKIP, agreement_terms = SKIP, = SKIP, = SKIP, calendar_billing_first_charge = SKIP, reason_code = SKIP, product_change_delayed = SKIP, offer_id = SKIP, prepaid_subscription_configuration = SKIP, previous_billing_at = SKIP, import_mrr = SKIP, canceled_at = SKIP, activated_at = SKIP, agreement_acceptance = SKIP, ach_agreement = SKIP, dunning_communication_delay_enabled = false, dunning_communication_delay_time_zone = SKIP, skip_billing_manifest_taxes = false ) @product_handle = product_handle unless product_handle == SKIP @product_id = product_id unless product_id == SKIP unless product_price_point_handle == SKIP @product_price_point_handle = product_price_point_handle end @product_price_point_id = product_price_point_id unless product_price_point_id == SKIP @custom_price = custom_price unless custom_price == SKIP @coupon_code = coupon_code unless coupon_code == SKIP @coupon_codes = coupon_codes unless coupon_codes == SKIP unless payment_collection_method == SKIP @payment_collection_method = payment_collection_method end @receives_invoice_emails = receives_invoice_emails unless receives_invoice_emails == SKIP @net_terms = net_terms unless net_terms == SKIP @customer_id = customer_id unless customer_id == SKIP @next_billing_at = next_billing_at unless next_billing_at == SKIP @initial_billing_at = initial_billing_at unless initial_billing_at == SKIP unless stored_credential_transaction_id == SKIP @stored_credential_transaction_id = stored_credential_transaction_id end @sales_rep_id = sales_rep_id unless sales_rep_id == SKIP @payment_profile_id = payment_profile_id unless payment_profile_id == SKIP @reference = reference unless reference == SKIP @customer_attributes = customer_attributes unless customer_attributes == SKIP unless payment_profile_attributes == SKIP @payment_profile_attributes = payment_profile_attributes end @credit_card_attributes = credit_card_attributes unless credit_card_attributes == SKIP @bank_account_attributes = bank_account_attributes unless bank_account_attributes == SKIP @components = components unless components == SKIP @calendar_billing = calendar_billing unless calendar_billing == SKIP @metafields = unless == SKIP @customer_reference = customer_reference unless customer_reference == SKIP @group = group unless group == SKIP @ref = ref unless ref == SKIP @cancellation_message = unless == SKIP @cancellation_method = cancellation_method unless cancellation_method == SKIP @currency = currency unless currency == SKIP @expires_at = expires_at unless expires_at == SKIP unless expiration_tracks_next_billing_change == SKIP @expiration_tracks_next_billing_change = expiration_tracks_next_billing_change end @agreement_terms = agreement_terms unless agreement_terms == SKIP @authorizer_first_name = unless == SKIP @authorizer_last_name = unless == SKIP unless calendar_billing_first_charge == SKIP @calendar_billing_first_charge = calendar_billing_first_charge end @reason_code = reason_code unless reason_code == SKIP @product_change_delayed = product_change_delayed unless product_change_delayed == SKIP @offer_id = offer_id unless offer_id == SKIP unless prepaid_subscription_configuration == SKIP @prepaid_subscription_configuration = prepaid_subscription_configuration end @previous_billing_at = previous_billing_at unless previous_billing_at == SKIP @import_mrr = import_mrr unless import_mrr == SKIP @canceled_at = canceled_at unless canceled_at == SKIP @activated_at = activated_at unless activated_at == SKIP @agreement_acceptance = agreement_acceptance unless agreement_acceptance == SKIP @ach_agreement = ach_agreement unless ach_agreement == SKIP unless dunning_communication_delay_enabled == SKIP @dunning_communication_delay_enabled = dunning_communication_delay_enabled end unless dunning_communication_delay_time_zone == SKIP @dunning_communication_delay_time_zone = dunning_communication_delay_time_zone end unless skip_billing_manifest_taxes == SKIP @skip_billing_manifest_taxes = skip_billing_manifest_taxes end end |
Instance Attribute Details
#ach_agreement ⇒ ACHAgreement
(Optional) If passed, the proof of the authorized ACH agreement terms will be persisted.
292 293 294 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 292 def ach_agreement @ach_agreement end |
#activated_at ⇒ String
Setting this attribute to true will cause the subscription’s MRR to be added to your MRR analytics immediately. For this value to be honored, a next_billing_at must be present and set to a future date. This key/value will not be returned in the subscription response body.
283 284 285 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 283 def activated_at @activated_at end |
#agreement_acceptance ⇒ AgreementAcceptance
Required when creating a subscription with Maxio Payments.
287 288 289 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 287 def agreement_acceptance @agreement_acceptance end |
#agreement_terms ⇒ String
(Optional) The ACH authorization agreement terms. If enabled, an email will be sent to the customer with a copy of the terms.
215 216 217 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 215 def agreement_terms @agreement_terms end |
#authorizer_first_name ⇒ String
(Optional) The first name of the person authorizing the ACH agreement.
219 220 221 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 219 def @authorizer_first_name end |
#authorizer_last_name ⇒ String
(Optional) The last name of the person authorizing the ACH agreement.
223 224 225 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 223 def @authorizer_last_name end |
#bank_account_attributes ⇒ BankAccountAttributes
Credit Card data to create a new Subscription. Interchangeable with ‘payment_profile_attributes` property.
144 145 146 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 144 def bank_account_attributes @bank_account_attributes end |
#calendar_billing ⇒ CalendarBilling
(Optional). Cannot be used when also specifying next_billing_at
155 156 157 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 155 def calendar_billing @calendar_billing end |
#calendar_billing_first_charge ⇒ String
(Optional) One of “prorated” (the default – the prorated product price will be charged immediately), “immediate” (the full product price will be charged immediately), or “delayed” (the full product price will be charged with the first scheduled renewal).
230 231 232 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 230 def calendar_billing_first_charge @calendar_billing_first_charge end |
#canceled_at ⇒ String
Setting this attribute to true will cause the subscription’s MRR to be added to your MRR analytics immediately. For this value to be honored, a next_billing_at must be present and set to a future date. This key/value will not be returned in the subscription response body.
276 277 278 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 276 def canceled_at @canceled_at end |
#cancellation_message ⇒ String
(Optional) Can be used when canceling a subscription (via the HTTP DELETE method) to make a note about the reason for cancellation.
185 186 187 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 185 def @cancellation_message end |
#cancellation_method ⇒ String
(Optional) Can be used when canceling a subscription (via the HTTP DELETE method) to make a note about how the subscription was canceled.
190 191 192 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 190 def cancellation_method @cancellation_method end |
#components ⇒ Array[CreateSubscriptionComponent]
(Optional) An array of component ids and quantities to be added to the subscription. See [Components](maxio-chargify.zendesk.com/hc/en-us/articles/54050206 25677) for more information.
151 152 153 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 151 def components @components end |
#coupon_code ⇒ String
(deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon.
40 41 42 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 40 def coupon_code @coupon_code end |
#coupon_codes ⇒ Array[String]
An array for all the coupons attached to the subscription.
44 45 46 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 44 def coupon_codes @coupon_codes end |
#credit_card_attributes ⇒ PaymentProfileAttributes
Credit Card data to create a new Subscription. Interchangeable with ‘payment_profile_attributes` property.
139 140 141 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 139 def credit_card_attributes @credit_card_attributes end |
#currency ⇒ String
(Optional) If Multi-Currency is enabled and the currency is configured in Chargify, pass it at signup to create a subscription on a non-default currency. Note that you cannot update the currency of an existing subscription.
197 198 199 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 197 def currency @currency end |
#custom_price ⇒ CustomPriceUsedForSubscriptionCreateUpdate
(Optional) Used in place of ‘product_price_point_id` to define a custom price point unique to the subscription
34 35 36 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 34 def custom_price @custom_price end |
#customer_attributes ⇒ CustomerAttributes
The reference value (provided by your app) for the subscription itelf.
130 131 132 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 130 def customer_attributes @customer_attributes end |
#customer_id ⇒ Integer
The ID of an existing customer within Chargify. Required, unless a ‘customer_reference` or a set of `customer_attributes` is given.
67 68 69 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 67 def customer_id @customer_id end |
#customer_reference ⇒ String
The reference value (provided by your app) of an existing customer within Chargify. Required, unless a ‘customer_id` or a set of `customer_attributes` is given.
167 168 169 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 167 def customer_reference @customer_reference end |
#dunning_communication_delay_enabled ⇒ TrueClass | FalseClass
Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the ‘dunning_communication_delay_time_zone` attribute.
298 299 300 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 298 def dunning_communication_delay_enabled @dunning_communication_delay_enabled end |
#dunning_communication_delay_time_zone ⇒ String
Time zone for the Dunning Communication Delay feature.
302 303 304 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 302 def dunning_communication_delay_time_zone @dunning_communication_delay_time_zone end |
#expiration_tracks_next_billing_change ⇒ String
(Optional, default false) When set to true, and when next_billing_at is present, if the subscription expires, the expires_at will be shifted by the same amount of time as the difference between the old and new “next billing” dates.
210 211 212 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 210 def expiration_tracks_next_billing_change @expiration_tracks_next_billing_change end |
#expires_at ⇒ String
Timestamp giving the expiration date of this subscription (if any). You may manually change the expiration date at any point during a subscription period.
203 204 205 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 203 def expires_at @expires_at end |
#group ⇒ Object
The reference value (provided by your app) of an existing customer within Chargify. Required, unless a ‘customer_id` or a set of `customer_attributes` is given.
173 174 175 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 173 def group @group end |
#import_mrr ⇒ TrueClass | FalseClass
Setting this attribute to true will cause the subscription’s MRR to be added to your MRR analytics immediately. For this value to be honored, a next_billing_at must be present and set to a future date. This key/value will not be returned in the subscription response body.
269 270 271 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 269 def import_mrr @import_mrr end |
#initial_billing_at ⇒ String
(Optional) Set this attribute to a future date/time to create a subscription in the “Awaiting Signup” state, rather than “Active” or “Trialing”. See the notes on “Date/Time Format” in our [subscription import documentation](maxio-chargify.zendesk.com/hc/en-us/articles/540486 3655821#date-format). In the “Awaiting Signup” state, a subscription behaves like any other. It can be canceled, allocated to, had its billing date changed. etc. When the initial_billing_at date hits, the subscription will transition to the expected state. If the product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees will be respected either before or after the trial, as configured on the price point. If the payment is due at the initial_billing_at and it fails the subscription will be immediately canceled. See further notes in the section on Delayed Signups.
100 101 102 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 100 def initial_billing_at @initial_billing_at end |
#metafields ⇒ Hash[String, String]
(Optional) A set of key/value pairs representing custom fields and their values. Metafields will be created “on-the-fly” in your site for a given key, if they have not been created yet.
161 162 163 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 161 def @metafields end |
#net_terms ⇒ String
(Optional) Default: null The number of days after renewal (on invoice billing) that a subscription is due. A value between 0 (due immediately) and 180.
62 63 64 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 62 def net_terms @net_terms end |
#next_billing_at ⇒ String
(Optional) Set this attribute to a future date/time to sync imported subscriptions to your existing renewal schedule. See the notes on “Date/Time Format” in our [subscription import documentation](maxio-chargify.zendesk.com/hc/en-us/articles/540486 3655821#date-format). If you provide a next_billing_at timestamp that is in the future, no trial or initial charges will be applied when you create the subscription. In fact, no payment will be captured at all. The first payment will be captured, according to the prices defined by the product, near the time specified by next_billing_at. If you do not provide a value for next_billing_at, any trial and/or initial charges will be assessed and charged at the time of subscription creation. If the card cannot be successfully charged, the subscription will not be created. See further notes in the section on Importing Subscriptions.
83 84 85 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 83 def next_billing_at @next_billing_at end |
#offer_id ⇒ Object
Use in place of passing product and component information to set up the subscription with an existing offer. May be either the Chargify id of the offer or its handle prefixed with ‘handle:`.er
247 248 249 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 247 def offer_id @offer_id end |
#payment_collection_method ⇒ PaymentCollectionMethod
The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - ‘invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
51 52 53 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 51 def payment_collection_method @payment_collection_method end |
#payment_profile_attributes ⇒ PaymentProfileAttributes
alias to credit_card_attributes
134 135 136 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 134 def payment_profile_attributes @payment_profile_attributes end |
#payment_profile_id ⇒ Integer
The Payment Profile ID of an existing card or bank account, which belongs to an existing customer to use for payment for this subscription. If the card, bank account, or customer does not exist already, or if you want to use a new (unstored) card or bank account for the subscription, use ‘payment_profile_attributes` instead to create a new payment profile along with the subscription. (This value is available on an existing subscription via the API as `credit_card` > id or `bank_account` > id)
122 123 124 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 122 def payment_profile_id @payment_profile_id end |
#prepaid_subscription_configuration ⇒ UpsertPrepaidConfiguration
Use in place of passing product and component information to set up the subscription with an existing offer. May be either the Chargify id of the offer or its handle prefixed with ‘handle:`.er
253 254 255 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 253 def prepaid_subscription_configuration @prepaid_subscription_configuration end |
#previous_billing_at ⇒ String
Providing a previous_billing_at that is in the past will set the current_period_starts_at when the subscription is created. It will also set activated_at if not explicitly passed during the subscription import. Can only be used if next_billing_at is also passed. Using this option will allow you to set the period start for the subscription so mid period component allocations have the correct prorated amount.
262 263 264 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 262 def previous_billing_at @previous_billing_at end |
#product_change_delayed ⇒ TrueClass | FalseClass
(Optional, used only for Delayed Product Change When set to true, indicates that a changed value for product_handle should schedule the product change to the next subscription renewal.
241 242 243 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 241 def product_change_delayed @product_change_delayed end |
#product_handle ⇒ String
The API Handle of the product for which you are creating a subscription. Required, unless a ‘product_id` is given instead.
15 16 17 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 15 def product_handle @product_handle end |
#product_id ⇒ String
The Product ID of the product for which you are creating a subscription. The product ID is not currently published, so we recommend using the API Handle instead.
21 22 23 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 21 def product_id @product_id end |
#product_price_point_handle ⇒ String
The user-friendly API handle of a product’s particular price point.
25 26 27 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 25 def product_price_point_handle @product_price_point_handle end |
#product_price_point_id ⇒ String
The ID of the particular price point on the product.
29 30 31 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 29 def product_price_point_id @product_price_point_id end |
#reason_code ⇒ String
(Optional) Can be used when canceling a subscription (via the HTTP DELETE method) to indicate why a subscription was canceled.
235 236 237 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 235 def reason_code @reason_code end |
#receives_invoice_emails ⇒ String
(Optional) Default: True - Whether or not this subscription is set to receive emails related to this subscription.
56 57 58 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 56 def receives_invoice_emails @receives_invoice_emails end |
#ref ⇒ String
A valid referral code. (optional, see [Referrals](maxio-chargify.zendesk.com/hc/en-us/articles/540542020 4045-Referrals-Reference#how-to-obtain-referral-codes) for more details). If supplied, must be valid, or else subscription creation will fail.
180 181 182 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 180 def ref @ref end |
#reference ⇒ String
The reference value (provided by your app) for the subscription itelf.
126 127 128 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 126 def reference @reference end |
#sales_rep_id ⇒ Integer
For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer. This will ensure the card will be charged successfully at renewal.
112 113 114 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 112 def sales_rep_id @sales_rep_id end |
#skip_billing_manifest_taxes ⇒ TrueClass | FalseClass
Valid only for the Subscription Preview endpoint. When set to ‘true` it skips calculating taxes for the current and next billing manifests.
307 308 309 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 307 def skip_billing_manifest_taxes @skip_billing_manifest_taxes end |
#stored_credential_transaction_id ⇒ Integer
For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer. This will ensure the card will be charged successfully at renewal.
106 107 108 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 106 def stored_credential_transaction_id @stored_credential_transaction_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 540 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_handle = hash.key?('product_handle') ? hash['product_handle'] : SKIP product_id = hash.key?('product_id') ? hash['product_id'] : SKIP product_price_point_handle = hash.key?('product_price_point_handle') ? hash['product_price_point_handle'] : SKIP product_price_point_id = hash.key?('product_price_point_id') ? hash['product_price_point_id'] : SKIP custom_price = CustomPriceUsedForSubscriptionCreateUpdate.from_hash(hash['custom_price']) if hash['custom_price'] coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP coupon_codes = hash.key?('coupon_codes') ? hash['coupon_codes'] : SKIP payment_collection_method = hash['payment_collection_method'] ||= PaymentCollectionMethod::AUTOMATIC receives_invoice_emails = hash.key?('receives_invoice_emails') ? hash['receives_invoice_emails'] : SKIP net_terms = hash.key?('net_terms') ? hash['net_terms'] : SKIP customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP next_billing_at = hash.key?('next_billing_at') ? hash['next_billing_at'] : SKIP initial_billing_at = hash.key?('initial_billing_at') ? hash['initial_billing_at'] : SKIP stored_credential_transaction_id = hash.key?('stored_credential_transaction_id') ? hash['stored_credential_transaction_id'] : SKIP sales_rep_id = hash.key?('sales_rep_id') ? hash['sales_rep_id'] : SKIP payment_profile_id = hash.key?('payment_profile_id') ? hash['payment_profile_id'] : SKIP reference = hash.key?('reference') ? hash['reference'] : SKIP customer_attributes = CustomerAttributes.from_hash(hash['customer_attributes']) if hash['customer_attributes'] if hash['payment_profile_attributes'] payment_profile_attributes = PaymentProfileAttributes.from_hash(hash['payment_profile_attributes']) end credit_card_attributes = PaymentProfileAttributes.from_hash(hash['credit_card_attributes']) if hash['credit_card_attributes'] bank_account_attributes = BankAccountAttributes.from_hash(hash['bank_account_attributes']) if hash['bank_account_attributes'] components = hash.key?('components') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateSubscriptionComponents), hash['components'] ) : SKIP calendar_billing = CalendarBilling.from_hash(hash['calendar_billing']) if hash['calendar_billing'] = hash.key?('metafields') ? hash['metafields'] : SKIP customer_reference = hash.key?('customer_reference') ? hash['customer_reference'] : SKIP group = hash.key?('group') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateSubscriptionGroup2), hash['group'] ) : SKIP ref = hash.key?('ref') ? hash['ref'] : SKIP = hash.key?('cancellation_message') ? hash['cancellation_message'] : SKIP cancellation_method = hash.key?('cancellation_method') ? hash['cancellation_method'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP expires_at = hash.key?('expires_at') ? hash['expires_at'] : SKIP expiration_tracks_next_billing_change = hash.key?('expiration_tracks_next_billing_change') ? hash['expiration_tracks_next_billing_change'] : SKIP agreement_terms = hash.key?('agreement_terms') ? hash['agreement_terms'] : SKIP = hash.key?('authorizer_first_name') ? hash['authorizer_first_name'] : SKIP = hash.key?('authorizer_last_name') ? hash['authorizer_last_name'] : SKIP calendar_billing_first_charge = hash.key?('calendar_billing_first_charge') ? hash['calendar_billing_first_charge'] : SKIP reason_code = hash.key?('reason_code') ? hash['reason_code'] : SKIP product_change_delayed = hash.key?('product_change_delayed') ? hash['product_change_delayed'] : SKIP offer_id = hash.key?('offer_id') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateSubscriptionOfferId), hash['offer_id'] ) : SKIP if hash['prepaid_subscription_configuration'] prepaid_subscription_configuration = UpsertPrepaidConfiguration.from_hash(hash['prepaid_subscription_configuration']) end previous_billing_at = hash.key?('previous_billing_at') ? hash['previous_billing_at'] : SKIP import_mrr = hash.key?('import_mrr') ? hash['import_mrr'] : SKIP canceled_at = hash.key?('canceled_at') ? hash['canceled_at'] : SKIP activated_at = hash.key?('activated_at') ? hash['activated_at'] : SKIP agreement_acceptance = AgreementAcceptance.from_hash(hash['agreement_acceptance']) if hash['agreement_acceptance'] ach_agreement = ACHAgreement.from_hash(hash['ach_agreement']) if hash['ach_agreement'] dunning_communication_delay_enabled = hash['dunning_communication_delay_enabled'] ||= false dunning_communication_delay_time_zone = hash.key?('dunning_communication_delay_time_zone') ? hash['dunning_communication_delay_time_zone'] : SKIP skip_billing_manifest_taxes = hash['skip_billing_manifest_taxes'] ||= false # Create object from extracted values. CreateSubscription.new(product_handle, product_id, product_price_point_handle, product_price_point_id, custom_price, coupon_code, coupon_codes, payment_collection_method, receives_invoice_emails, net_terms, customer_id, next_billing_at, initial_billing_at, stored_credential_transaction_id, sales_rep_id, payment_profile_id, reference, customer_attributes, payment_profile_attributes, credit_card_attributes, bank_account_attributes, components, calendar_billing, , customer_reference, group, ref, , cancellation_method, currency, expires_at, expiration_tracks_next_billing_change, agreement_terms, , , calendar_billing_first_charge, reason_code, product_change_delayed, offer_id, prepaid_subscription_configuration, previous_billing_at, import_mrr, canceled_at, activated_at, agreement_acceptance, ach_agreement, dunning_communication_delay_enabled, dunning_communication_delay_time_zone, skip_billing_manifest_taxes) end |
.names ⇒ Object
A mapping from model property names to API property names.
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 310 def self.names @_hash = {} if @_hash.nil? @_hash['product_handle'] = 'product_handle' @_hash['product_id'] = 'product_id' @_hash['product_price_point_handle'] = 'product_price_point_handle' @_hash['product_price_point_id'] = 'product_price_point_id' @_hash['custom_price'] = 'custom_price' @_hash['coupon_code'] = 'coupon_code' @_hash['coupon_codes'] = 'coupon_codes' @_hash['payment_collection_method'] = 'payment_collection_method' @_hash['receives_invoice_emails'] = 'receives_invoice_emails' @_hash['net_terms'] = 'net_terms' @_hash['customer_id'] = 'customer_id' @_hash['next_billing_at'] = 'next_billing_at' @_hash['initial_billing_at'] = 'initial_billing_at' @_hash['stored_credential_transaction_id'] = 'stored_credential_transaction_id' @_hash['sales_rep_id'] = 'sales_rep_id' @_hash['payment_profile_id'] = 'payment_profile_id' @_hash['reference'] = 'reference' @_hash['customer_attributes'] = 'customer_attributes' @_hash['payment_profile_attributes'] = 'payment_profile_attributes' @_hash['credit_card_attributes'] = 'credit_card_attributes' @_hash['bank_account_attributes'] = 'bank_account_attributes' @_hash['components'] = 'components' @_hash['calendar_billing'] = 'calendar_billing' @_hash['metafields'] = 'metafields' @_hash['customer_reference'] = 'customer_reference' @_hash['group'] = 'group' @_hash['ref'] = 'ref' @_hash['cancellation_message'] = 'cancellation_message' @_hash['cancellation_method'] = 'cancellation_method' @_hash['currency'] = 'currency' @_hash['expires_at'] = 'expires_at' @_hash['expiration_tracks_next_billing_change'] = 'expiration_tracks_next_billing_change' @_hash['agreement_terms'] = 'agreement_terms' @_hash['authorizer_first_name'] = 'authorizer_first_name' @_hash['authorizer_last_name'] = 'authorizer_last_name' @_hash['calendar_billing_first_charge'] = 'calendar_billing_first_charge' @_hash['reason_code'] = 'reason_code' @_hash['product_change_delayed'] = 'product_change_delayed' @_hash['offer_id'] = 'offer_id' @_hash['prepaid_subscription_configuration'] = 'prepaid_subscription_configuration' @_hash['previous_billing_at'] = 'previous_billing_at' @_hash['import_mrr'] = 'import_mrr' @_hash['canceled_at'] = 'canceled_at' @_hash['activated_at'] = 'activated_at' @_hash['agreement_acceptance'] = 'agreement_acceptance' @_hash['ach_agreement'] = 'ach_agreement' @_hash['dunning_communication_delay_enabled'] = 'dunning_communication_delay_enabled' @_hash['dunning_communication_delay_time_zone'] = 'dunning_communication_delay_time_zone' @_hash['skip_billing_manifest_taxes'] = 'skip_billing_manifest_taxes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
426 427 428 429 430 431 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 426 def self.nullables %w[ dunning_communication_delay_enabled dunning_communication_delay_time_zone ] end |
.optionals ⇒ Object
An array for optional fields
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 371 def self.optionals %w[ product_handle product_id product_price_point_handle product_price_point_id custom_price coupon_code coupon_codes payment_collection_method receives_invoice_emails net_terms customer_id next_billing_at initial_billing_at stored_credential_transaction_id sales_rep_id payment_profile_id reference customer_attributes payment_profile_attributes credit_card_attributes bank_account_attributes components calendar_billing metafields customer_reference group ref cancellation_message cancellation_method currency expires_at expiration_tracks_next_billing_change agreement_terms authorizer_first_name authorizer_last_name calendar_billing_first_charge reason_code product_change_delayed offer_id prepaid_subscription_configuration previous_billing_at import_mrr canceled_at activated_at agreement_acceptance ach_agreement dunning_communication_delay_enabled dunning_communication_delay_time_zone skip_billing_manifest_taxes ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
686 687 688 689 690 691 692 |
# File 'lib/advanced_billing/models/create_subscription.rb', line 686 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |