maxio-advanced-billing-sdk 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +101 -43
  3. data/bin/console +15 -0
  4. data/lib/advanced_billing/client.rb +14 -3
  5. data/lib/advanced_billing/configuration.rb +82 -5
  6. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +2 -2
  7. data/lib/advanced_billing/controllers/base_controller.rb +1 -1
  8. data/lib/advanced_billing/controllers/billing_portal_controller.rb +2 -2
  9. data/lib/advanced_billing/controllers/component_price_points_controller.rb +3 -4
  10. data/lib/advanced_billing/controllers/components_controller.rb +7 -8
  11. data/lib/advanced_billing/controllers/coupons_controller.rb +5 -11
  12. data/lib/advanced_billing/controllers/custom_fields_controller.rb +102 -128
  13. data/lib/advanced_billing/controllers/customers_controller.rb +6 -6
  14. data/lib/advanced_billing/controllers/invoices_controller.rb +48 -11
  15. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +76 -250
  16. data/lib/advanced_billing/controllers/product_families_controller.rb +7 -8
  17. data/lib/advanced_billing/controllers/product_price_points_controller.rb +15 -17
  18. data/lib/advanced_billing/controllers/products_controller.rb +7 -8
  19. data/lib/advanced_billing/controllers/proforma_invoices_controller.rb +1 -1
  20. data/lib/advanced_billing/controllers/sales_commissions_controller.rb +3 -3
  21. data/lib/advanced_billing/controllers/subscription_components_controller.rb +53 -44
  22. data/lib/advanced_billing/controllers/subscription_group_status_controller.rb +9 -9
  23. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +10 -5
  24. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +1 -1
  25. data/lib/advanced_billing/controllers/subscription_products_controller.rb +6 -7
  26. data/lib/advanced_billing/controllers/subscription_status_controller.rb +6 -7
  27. data/lib/advanced_billing/controllers/subscriptions_controller.rb +87 -810
  28. data/lib/advanced_billing/controllers/webhooks_controller.rb +23 -48
  29. data/lib/advanced_billing/http/auth/basic_auth.rb +12 -0
  30. data/lib/advanced_billing/http/proxy_settings.rb +22 -0
  31. data/lib/advanced_billing/models/activate_event_based_component.rb +1 -2
  32. data/lib/advanced_billing/models/all_vaults.rb +45 -0
  33. data/lib/advanced_billing/models/allocation_preview_direction.rb +13 -0
  34. data/lib/advanced_billing/models/allocation_preview_line_item_kind.rb +15 -0
  35. data/lib/advanced_billing/models/apple_pay_vault.rb +6 -0
  36. data/lib/advanced_billing/models/auto_invite.rb +19 -0
  37. data/lib/advanced_billing/models/bank_account_holder_type.rb +13 -0
  38. data/lib/advanced_billing/models/bank_account_type.rb +13 -0
  39. data/lib/advanced_billing/models/bank_account_vault.rb +19 -0
  40. data/lib/advanced_billing/models/basic_date_field.rb +13 -0
  41. data/lib/advanced_billing/models/billing_manifest_line_item_kind.rb +17 -0
  42. data/lib/advanced_billing/models/billing_schedule.rb +2 -2
  43. data/lib/advanced_billing/models/calendar_billing.rb +3 -1
  44. data/lib/advanced_billing/models/cancellation_method.rb +17 -0
  45. data/lib/advanced_billing/models/card_type.rb +47 -0
  46. data/lib/advanced_billing/models/chargeback_status.rb +15 -0
  47. data/lib/advanced_billing/models/chargify_ebb.rb +4 -4
  48. data/lib/advanced_billing/models/cleanup_scope.rb +13 -0
  49. data/lib/advanced_billing/models/collection_method.rb +15 -0
  50. data/lib/advanced_billing/models/component.rb +31 -31
  51. data/lib/advanced_billing/models/component_custom_price.rb +61 -3
  52. data/lib/advanced_billing/models/component_kind.rb +16 -0
  53. data/lib/advanced_billing/models/compounding_strategy.rb +13 -0
  54. data/lib/advanced_billing/models/create_allocation.rb +1 -2
  55. data/lib/advanced_billing/models/create_invoice_coupon.rb +16 -7
  56. data/lib/advanced_billing/models/create_invoice_item.rb +5 -5
  57. data/lib/advanced_billing/models/create_invoice_status.rb +13 -0
  58. data/lib/advanced_billing/models/create_metafield.rb +3 -5
  59. data/lib/advanced_billing/models/create_or_update_product.rb +12 -7
  60. data/lib/advanced_billing/models/create_payment_profile.rb +6 -6
  61. data/lib/advanced_billing/models/create_prepayment_method.rb +19 -0
  62. data/lib/advanced_billing/models/create_product_price_point.rb +8 -3
  63. data/lib/advanced_billing/models/create_signup_proforma_preview_include.rb +6 -0
  64. data/lib/advanced_billing/models/create_usage.rb +17 -7
  65. data/lib/advanced_billing/models/credit_card_vault.rb +44 -0
  66. data/lib/advanced_billing/models/credit_note_status.rb +13 -0
  67. data/lib/advanced_billing/models/credit_scheme.rb +14 -0
  68. data/lib/advanced_billing/models/credit_type.rb +14 -0
  69. data/lib/advanced_billing/models/currency_price_role.rb +14 -0
  70. data/lib/advanced_billing/models/custom_field_owner.rb +13 -0
  71. data/lib/advanced_billing/models/debit_note_role.rb +13 -0
  72. data/lib/advanced_billing/models/debit_note_status.rb +15 -0
  73. data/lib/advanced_billing/models/direction.rb +13 -0
  74. data/lib/advanced_billing/models/discount_type.rb +13 -0
  75. data/lib/advanced_billing/models/ebb_component.rb +2 -2
  76. data/lib/advanced_billing/models/event_key.rb +91 -0
  77. data/lib/advanced_billing/models/expiration_interval_unit.rb +14 -0
  78. data/lib/advanced_billing/models/failed_payment_action.rb +14 -0
  79. data/lib/advanced_billing/models/first_charge_type.rb +14 -0
  80. data/lib/advanced_billing/models/group_target_type.rb +16 -0
  81. data/lib/advanced_billing/models/group_type.rb +13 -0
  82. data/lib/advanced_billing/models/include_not_null.rb +6 -0
  83. data/lib/advanced_billing/models/include_null_or_not_null.rb +13 -0
  84. data/lib/advanced_billing/models/include_option.rb +13 -0
  85. data/lib/advanced_billing/models/interval_unit.rb +13 -0
  86. data/lib/advanced_billing/models/invoice_consolidation_level.rb +14 -0
  87. data/lib/advanced_billing/models/invoice_date_field.rb +16 -0
  88. data/lib/advanced_billing/models/invoice_discount_source_type.rb +14 -0
  89. data/lib/advanced_billing/models/invoice_discount_type.rb +14 -0
  90. data/lib/advanced_billing/models/invoice_event_payment_method.rb +16 -0
  91. data/lib/advanced_billing/models/invoice_event_type.rb +26 -0
  92. data/lib/advanced_billing/models/invoice_payment_method_type.rb +17 -0
  93. data/lib/advanced_billing/models/invoice_payment_type.rb +15 -0
  94. data/lib/advanced_billing/models/invoice_role.rb +21 -0
  95. data/lib/advanced_billing/models/invoice_sort_field.rb +19 -0
  96. data/lib/advanced_billing/models/invoice_status.rb +18 -0
  97. data/lib/advanced_billing/models/item_category.rb +16 -0
  98. data/lib/advanced_billing/models/line_item_kind.rb +21 -0
  99. data/lib/advanced_billing/models/line_item_transaction_type.rb +18 -0
  100. data/lib/advanced_billing/models/list_components_price_points_include.rb +6 -0
  101. data/lib/advanced_billing/models/list_coupons_filter.rb +22 -6
  102. data/lib/advanced_billing/models/list_events_date_field.rb +6 -0
  103. data/lib/advanced_billing/models/list_prepayment_date_field.rb +13 -0
  104. data/lib/advanced_billing/models/list_products_include.rb +6 -0
  105. data/lib/advanced_billing/models/list_products_price_points_include.rb +6 -0
  106. data/lib/advanced_billing/models/list_subscription_components_include.rb +13 -0
  107. data/lib/advanced_billing/models/list_subscription_components_sort.rb +13 -0
  108. data/lib/advanced_billing/models/metafield.rb +8 -11
  109. data/lib/advanced_billing/models/metafield_input.rb +18 -5
  110. data/lib/advanced_billing/models/metafield_scope.rb +9 -4
  111. data/lib/advanced_billing/models/metered_component.rb +2 -2
  112. data/lib/advanced_billing/models/nested_subscription_group.rb +10 -0
  113. data/lib/advanced_billing/models/on_off_component.rb +2 -2
  114. data/lib/advanced_billing/models/pay_pal_vault.rb +15 -0
  115. data/lib/advanced_billing/models/payment_profile_attributes.rb +3 -3
  116. data/lib/advanced_billing/models/payment_type.rb +15 -0
  117. data/lib/advanced_billing/models/prepaid_configuration.rb +10 -0
  118. data/lib/advanced_billing/models/prepaid_usage_component.rb +2 -2
  119. data/lib/advanced_billing/models/prepayment_method.rb +18 -0
  120. data/lib/advanced_billing/models/price_point_type.rb +14 -0
  121. data/lib/advanced_billing/models/pricing_scheme.rb +15 -0
  122. data/lib/advanced_billing/models/product.rb +18 -8
  123. data/lib/advanced_billing/models/product_family.rb +10 -0
  124. data/lib/advanced_billing/models/product_price_point.rb +8 -3
  125. data/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb +13 -0
  126. data/lib/advanced_billing/models/proforma_invoice_role.rb +15 -0
  127. data/lib/advanced_billing/models/proforma_invoice_status.rb +14 -0
  128. data/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb +13 -0
  129. data/lib/advanced_billing/models/public_signup_page.rb +10 -0
  130. data/lib/advanced_billing/models/quantity_based_component.rb +2 -2
  131. data/lib/advanced_billing/models/reactivation_charge.rb +14 -0
  132. data/lib/advanced_billing/models/recurring_scheme.rb +14 -0
  133. data/lib/advanced_billing/models/resource_type.rb +13 -0
  134. data/lib/advanced_billing/models/restriction_type.rb +13 -0
  135. data/lib/advanced_billing/models/resume_options.rb +1 -1
  136. data/lib/advanced_billing/models/resumption_charge.rb +14 -0
  137. data/lib/advanced_billing/models/service_credit_type.rb +13 -0
  138. data/lib/advanced_billing/models/snap_day.rb +7 -2
  139. data/lib/advanced_billing/models/sorting_direction.rb +13 -0
  140. data/lib/advanced_billing/models/subscription.rb +16 -3
  141. data/lib/advanced_billing/models/subscription_custom_price.rb +23 -7
  142. data/lib/advanced_billing/models/subscription_date_field.rb +20 -0
  143. data/lib/advanced_billing/models/subscription_group_include.rb +6 -0
  144. data/lib/advanced_billing/models/subscription_group_prepayment_method.rb +17 -0
  145. data/lib/advanced_billing/models/subscription_groups_list_include.rb +6 -0
  146. data/lib/advanced_billing/models/subscription_include.rb +13 -0
  147. data/lib/advanced_billing/models/subscription_included_coupon.rb +10 -0
  148. data/lib/advanced_billing/models/subscription_list_date_field.rb +6 -0
  149. data/lib/advanced_billing/models/subscription_list_include.rb +6 -0
  150. data/lib/advanced_billing/models/subscription_purge_type.rb +13 -0
  151. data/lib/advanced_billing/models/subscription_sort.rb +17 -0
  152. data/lib/advanced_billing/models/subscription_state.rb +26 -0
  153. data/lib/advanced_billing/models/subscription_state_filter.rb +23 -0
  154. data/lib/advanced_billing/models/tax_configuration_kind.rb +15 -0
  155. data/lib/advanced_billing/models/tax_destination_address.rb +15 -0
  156. data/lib/advanced_billing/models/trial_type.rb +41 -0
  157. data/lib/advanced_billing/models/update_component.rb +2 -2
  158. data/lib/advanced_billing/models/update_metafield.rb +4 -6
  159. data/lib/advanced_billing/models/update_payment_profile.rb +3 -3
  160. data/lib/advanced_billing/models/update_subscription.rb +1 -0
  161. data/lib/advanced_billing/models/webhook_order.rb +13 -0
  162. data/lib/advanced_billing/models/webhook_status.rb +15 -0
  163. data/lib/advanced_billing/models/webhook_subscription.rb +46 -0
  164. data/lib/advanced_billing/utilities/union_type_lookup.rb +32 -5
  165. data/lib/advanced_billing.rb +2 -0
  166. metadata +11 -8
@@ -6,770 +6,37 @@
6
6
  module AdvancedBilling
7
7
  # SubscriptionsController
8
8
  class SubscriptionsController < BaseController
9
- # Full documentation on how subscriptions operate within Advanced Billing
10
- # can be located under the following topics:
11
- # + [Subscriptions
12
- # Reference](https://maxio.zendesk.com/hc/en-us/articles/24251526991757-Subs
13
- # cription-Overview)
14
- # + [Subscriptions
15
- # Actions](https://maxio.zendesk.com/hc/en-us/articles/24251983024653-Subscr
16
- # iption-Actions-Overview)
17
- # + [Subscription
18
- # Cancellation](https://maxio.zendesk.com/hc/en-us/articles/24251957778829-C
19
- # ancel-Subscriptions)
20
- # + [Subscription
21
- # Reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-R
22
- # eactivating-and-Resuming)
23
- # + [Subscription
24
- # Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports
25
- # )
26
- # When creating a subscription, you must specify a product and a customer.
27
- # Credit card details may be required, depending on the options for the
28
- # Product being subscribed ([see Product
29
- # Options](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Produc
30
- # t-Editing)).
31
- # The product may be specified by `product_id` or by `product_handle` (API
32
- # Handle). In similar fashion, to pass a particular product price point, you
33
- # may either use `product_price_point_handle` or `product_price_point_id`.
34
- # An existing customer may be specified by a `customer_id` (ID within
35
- # Advanced Billing) or a `customer_reference` (unique value within your app
36
- # that you have shared with Advanced Billing via the reference attribute on
37
- # a customer). You may also pass in an existing payment profile for that
38
- # customer with `payment_profile_id`. A new customer may be created by
39
- # providing `customer_attributes`.
40
- # Credit card details may be required, depending on the options for the
41
- # product being subscribed. The product can be specified by `product_id` or
42
- # by `product_handle` (API Handle).
43
- # If you are creating a subscription with a payment profile, the attribute
44
- # to send will be `credit_card_attributes` or `bank_account_attributes` for
45
- # ACH and Direct Debit. That said, when you read the subscription after
46
- # creation, we return the profile details under `credit_card` or
47
- # `bank_account`.
48
- # ## Bulk creation of subscriptions
49
- # Bulk creation of subscriptions is currently not supported. For scenarios
50
- # where multiple subscriptions must be added, particularly when assigning to
51
- # the same subscription group, it is essential to switch to a
52
- # single-threaded approach.
53
- # To avoid data conflicts or inaccuracies, incorporate a sleep interval
54
- # between requests.
55
- # While this single-threaded approach may impact performance, it ensures
56
- # data consistency and accuracy in cases where concurrent creation attempts
57
- # could otherwise lead to issues with subscription alignment and integrity.
58
- # ## Taxable Subscriptions
59
- # If your intent is to charge your subscribers tax via [Avalara
60
- # Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287043035661-Avalara-
61
- # VAT-Tax) or [Custom
62
- # Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287044212749-Custom-T
63
- # axes), there are a few considerations to be made regarding collecting
64
- # subscription data.
65
- # For subscribers to be eligible to be taxed, the following information for
66
- # the `customer` object or `payment_profile` object must by supplied:
67
- # + A subscription to a [taxable
68
- # product](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Produc
69
- # t-Editing#tax-settings)
70
- # + [Full valid billing or shipping
71
- # address](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanc
72
- # ed-Billing-Managed-Sales-Tax#full-address-required-for-taxable-subscriptio
73
- # ns) to identify the tax locale
74
- # + The portion of the address that houses the [state
75
- # information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Ad
76
- # vanced-Billing-Managed-Sales-Tax#required-state-format-for-taxable-subscri
77
- # ptions) of either adddress must adhere to the ISO standard of a 2-3
78
- # character limit/format.
79
- # + The portion of the address that houses the [country
80
- # information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Ad
81
- # vanced-Billing-Managed-Sales-Tax#required-country-format-for-taxable-subsc
82
- # riptions) must adhere to the ISO standard of a 2 character limit/format.
83
- # ## Subscription Request Examples
84
- # The subscription examples below will be split into two sections.
85
- # The first section, "Subscription Customization", will focus on passing
86
- # different information with a subscription, such as components, calendar
87
- # billing, and custom fields. These examples will presume you are using a
88
- # secure `chargify_token` generated by Chargify.js.
89
- # The second section, "Passing Payment Information", will focus on passing
90
- # payment information into Advanced Billing. Please be aware that
91
- # <b>collecting and sending Advanced Billing raw card details requires PCI
92
- # compliance on your end</b>; these examples are provided as guidance. If
93
- # your business is not PCI compliant, we recommend using Chargify.js to
94
- # collect credit cards or bank accounts.
95
- # # Subscription Customization
96
- # ## With Components
97
- # Different components require slightly different data. For example,
98
- # quantity-based and on/off components accept `allocated_quantity`, while
99
- # metered components accept `unit_balance`.
100
- # When creating a subscription with a component, a `price_point_id` can be
101
- # passed in along with the `component_id` to specify which price point to
102
- # use. If not passed in, the default price point will be used.
103
- # Note: if an invalid `price_point_id` is used, the subscription will still
104
- # proceed but will use the component's default price point.
105
- # Components and their price points may be added by ID or by handle. See the
106
- # example request body labeled "Components By Handle (Quantity-Based)"; the
107
- # format will be the same for other component types.
108
- # ## With Coupon(s)
109
- # Pass an array of `coupon_codes`. See the example request body "With
110
- # Coupon".
111
- # ## With Manual Invoice Collection
112
- # The `invoice` collection method works only on legacy Statement
113
- # Architecture.
114
- # On Relationship Invoicing Architecture use the `remittance` collection
115
- # method.
116
- # ## Prepaid Subscription
117
- # A prepaid subscription can be created with the usual subscription creation
118
- # parameters, specifying `prepaid` as the `payment_collection_method` and
119
- # including a nested `prepaid_configuration`.
120
- # After a prepaid subscription has been created, additional funds can be
121
- # manually added to the prepayment account through the [Create Prepayment
122
- # Endpoint](https://developers.chargify.com/docs/api-docs/7ec482de77ba7-crea
123
- # te-prepayment).
124
- # Prepaid subscriptions do not work on legacy Statement Architecture.
125
- # ## With Metafields
126
- # Metafields can either attach to subscriptions or customers. Metafields are
127
- # popuplated with the supplied metadata to the resource specified.
128
- # If the metafield doesn't exist yet, it will be created on-the-fly.
129
- # ## With Custom Pricing
130
- # Custom pricing is pricing specific to the subscription in question.
131
- # Create a subscription with custom pricing by passing pricing information
132
- # instead of a price point.
133
- # For a custom priced product, pass the custom_price object in place of
134
- # `product_price_point_id`. For a custom priced component, pass the
135
- # `custom_price` object within the component object.
136
- # Custom prices and price points can exist in harmony on a subscription.
137
- # # Passing Payment Information
138
- # ## Subscription with Chargify.js token
139
- # The `chargify_token` can be obtained using
140
- # [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0
141
- # NjAzNDI0-overview). The token represents payment profile attributes that
142
- # were provided by the customer in their browser and stored at the payment
143
- # gateway.
144
- # The `payment_type` attribute may either be `credit_card` or
145
- # `bank_account`, depending on the type of payment method being added. If a
146
- # bank account is being passed, the payment attributes should be changed to
147
- # `bank_account_attributes`.
148
- # ```json
149
- # {
150
- # "subscription": {
151
- # "product_handle": "pro-plan",
152
- # "customer_attributes": {
153
- # "first_name": "Joe",
154
- # "last_name": "Smith",
155
- # "email": "j.smith@example.com"
156
- # },
157
- # "credit_card_attributes": {
158
- # "chargify_token": "tok_cwhvpfcnbtgkd8nfkzf9dnjn",
159
- # "payment_type": "credit_card"
160
- # }
161
- # }
162
- # }
163
- # ```
164
- # ## Subscription with vault token
165
- # If you already have a customer and card stored in your payment gateway,
166
- # you may create a subscription with a `vault_token`. Providing the
167
- # last_four, card type and expiration date will allow the card to be
168
- # displayed properly in the Advanced Billing UI.
169
- # ```json
170
- # {
171
- # "subscription": {
172
- # "product_handle": "pro-plan",
173
- # "customer_attributes": {
174
- # "first_name": "Joe",
175
- # "last_name": "Smith",
176
- # "email": "j.smith@example.com"
177
- # },
178
- # "credit_card_attributes": {
179
- # first_name: "Joe,
180
- # last_name: "Smith",
181
- # card_type: "visa",
182
- # expiration_month: "05",
183
- # expiration_year: "2025",
184
- # last_four: "1234",
185
- # vault_token: "12345abc",
186
- # current_vault: "braintree_blue"
187
- # }
188
- # }
189
- # ```
190
- # ## Subscription with ACH as Payment Profile
191
- # ```json
192
- # {
193
- # "subscription": {
194
- # "product_handle": "gold-product",
195
- # "customer_attributes": {
196
- # "first_name": "Joe",
197
- # "last_name": "Blow",
198
- # "email": "joe@example.com",
199
- # "zip": "02120",
200
- # "state": "MA",
201
- # "reference": "XYZ",
202
- # "phone": "(617) 111 - 0000",
203
- # "organization": "Acme",
204
- # "country": "US",
205
- # "city": "Boston",
206
- # "address_2": null,
207
- # "address": "123 Mass Ave."
208
- # },
209
- # "bank_account_attributes": {
210
- # "bank_name": "Best Bank",
211
- # "bank_routing_number": "021000089",
212
- # "bank_account_number": "111111111111",
213
- # "bank_account_type": "checking",
214
- # "bank_account_holder_type": "business",
215
- # "payment_type": "bank_account"
216
- # }
217
- # }
218
- # }
219
- # ```
220
- # ## Subscription with PayPal payment profile
221
- # ### With the nonce from Braintree JS
222
- # ```json
223
- # { "subscription": {
224
- # "product_handle":"test-product-b",
225
- # "customer_attributes": {
226
- # "first_name":"Amelia",
227
- # "last_name":"Johnson",
228
- # "email":"amelia@example.com",
229
- # "organization":"My Awesome Company"
230
- # },
231
- # "payment_profile_attributes":{
232
- # "paypal_email": "amelia@example.com",
233
- # "current_vault": "braintree_blue",
234
- # "payment_method_nonce":"abc123",
235
- # "payment_type":"paypal_account"
236
- # }
237
- # }
238
- # ```
239
- # ### With the Braintree Customer ID as the vault token:
240
- # ```json
241
- # { "subscription": {
242
- # "product_handle":"test-product-b",
243
- # "customer_attributes": {
244
- # "first_name":"Amelia",
245
- # "last_name":"Johnson",
246
- # "email":"amelia@example.com",
247
- # "organization":"My Awesome Company"
248
- # },
249
- # "payment_profile_attributes":{
250
- # "paypal_email": "amelia@example.com",
251
- # "current_vault": "braintree_blue",
252
- # "vault_token":"58271347",
253
- # "payment_type":"paypal_account"
254
- # }
255
- # }
256
- # ```
257
- # ## Subscription using GoCardless Bank Number
258
- # These examples creates a customer, bank account and mandate in GoCardless.
259
- # For more information on GoCardless, please view the following two
260
- # resources:
261
- # + [Payment Profiles via API for
262
- # GoCardless](https://developers.chargify.com/docs/api-docs/1f10a4f170405-cr
263
- # eate-payment-profile#gocardless)
264
- # + [Full documentation on
265
- # GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoC
266
- # ardless)
267
- # + [Using Chargify.js with GoCardless - minimal
268
- # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN
269
- # DIy-examples#minimal-example-with-direct-debit-gocardless-gateway)
270
- # + [Using Chargify.js with GoCardless - full
271
- # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN
272
- # DIy-examples#full-example-with-direct-debit-gocardless-gateway)
273
- # ```json
274
- # {
275
- # "subscription": {
276
- # "product_handle": "gold-product",
277
- # "customer_attributes": {
278
- # "first_name": "Jane",
279
- # "last_name": "Doe",
280
- # "email": "jd@chargify.test"
281
- # },
282
- # "bank_account_attributes": {
283
- # "bank_name": "Royal Bank of France",
284
- # "bank_account_number": "0000000",
285
- # "bank_routing_number": "0003",
286
- # "bank_branch_code": "00006",
287
- # "payment_type": "bank_account",
288
- # "billing_address": "20 Place de la Gare",
289
- # "billing_city": "Colombes",
290
- # "billing_state": "Île-de-France",
291
- # "billing_zip": "92700",
292
- # "billing_country": "FR"
293
- # }
294
- # }
295
- # }
296
- # ```
297
- # ## Subscription using GoCardless IBAN Number
298
- # ```json
299
- # {
300
- # "subscription": {
301
- # "product_handle": "gold-product",
302
- # "customer_attributes": {
303
- # "first_name": "Jane",
304
- # "last_name": "Doe",
305
- # "email": "jd@chargify.test"
306
- # },
307
- # "bank_account_attributes": {
308
- # "bank_name": "French Bank",
309
- # "bank_iban": "FR1420041010050500013M02606",
310
- # "payment_type": "bank_account",
311
- # "billing_address": "20 Place de la Gare",
312
- # "billing_city": "Colombes",
313
- # "billing_state": "Île-de-France",
314
- # "billing_zip": "92700",
315
- # "billing_country": "FR"
316
- # }
317
- # }
318
- # }
319
- # ```
320
- # ## Subscription using Stripe SEPA Direct Debit
321
- # For more information on Stripe Direct Debit, please view the following two
322
- # resources:
323
- # + [Payment Profiles via API for Stripe SEPA Direct
324
- # Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-
325
- # payment-profile#sepa-direct-debit)
326
- # + [Full documentation on Stripe Direct
327
- # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S
328
- # EPA-and-BECS-Direct-Debit)
329
- # + [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal
330
- # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN
331
- # DIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway
332
- # )
333
- # + [Using Chargify.js with Stripe SEPA Direct Debit - full
334
- # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN
335
- # DIy-examples#full-example-with-sepa-direct-debit-stripe-gateway)
336
- # ```json
337
- # {
338
- # "subscription": {
339
- # "product_handle": "gold-product",
340
- # "customer_attributes": {
341
- # "first_name": "Jane",
342
- # "last_name": "Doe",
343
- # "email": "jd@chargify.test"
344
- # },
345
- # "bank_account_attributes": {
346
- # "bank_name": "Test Bank",
347
- # "bank_iban": "DE89370400440532013000",
348
- # "payment_type": "bank_account"
349
- # }
350
- # }
351
- # }
352
- # ```
353
- # ## Subscription using Stripe BECS Direct Debit
354
- # For more information on Stripe Direct Debit, please view the following two
355
- # resources:
356
- # + [Payment Profiles via API for Stripe BECS Direct
357
- # Debit]($e/Payment%20Profiles/createPaymentProfile)
358
- # + [Full documentation on Stripe Direct
359
- # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S
360
- # EPA-and-BECS-Direct-Debit)
361
- # + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal
362
- # example](page:development-tools/chargify-js/examples#minimal-example-with-
363
- # sepa-becs-or-bacs-direct-debit-stripe-gateway)
364
- # + [Using Chargify.js with Stripe BECS Direct Debit - full
365
- # example](page:development-tools/chargify-js/examples#full-example-with-bec
366
- # s-direct-debit-stripe-gateway)
367
- # ```json
368
- # {
369
- # "subscription": {
370
- # "product_handle": "gold-product",
371
- # "customer_attributes": {
372
- # "first_name": "Jane",
373
- # "last_name": "Doe",
374
- # "email": "jd@chargify.test"
375
- # },
376
- # "bank_account_attributes": {
377
- # "bank_name": "Test Bank",
378
- # "bank_branch_code": "000000",
379
- # "bank_account_number": "000123456",
380
- # "payment_type": "bank_account"
381
- # }
382
- # }
383
- # }
384
- # ```
385
- # ## Subscription using Stripe BACS Direct Debit
386
- # For more information on Stripe Direct Debit, please view the following two
387
- # resources:
388
- # + [Payment Profiles via API for Stripe BACS Direct
389
- # Debit]($e/Payment%20Profiles/createPaymentProfile)
390
- # + [Full documentation on Stripe Direct
391
- # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S
392
- # EPA-and-BECS-Direct-Debit)
393
- # + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal
394
- # example](page:development-tools/chargify-js/examples#minimal-example-with-
395
- # sepa-becs-or-bacs-direct-debit-stripe-gateway)
396
- # + [Using Chargify.js with Stripe BACS Direct Debit - full
397
- # example](page:development-tools/chargify-js/examples#full-example-with-bac
398
- # s-direct-debit-stripe-gateway)
399
- # ```json
400
- # {
401
- # "subscription": {
402
- # "product_handle": "gold-product",
403
- # "customer_attributes": {
404
- # "first_name": "Jane",
405
- # "last_name": "Doe",
406
- # "email": "jd@chargify.test"
407
- # },
408
- # "bank_account_attributes": {
409
- # "bank_name": "Test Bank",
410
- # "bank_branch_code": "108800",
411
- # "bank_account_number": "00012345",
412
- # "payment_type": "bank_account",
413
- # "billing_address": "123 Main St.",
414
- # "billing_city": "London",
415
- # "billing_state": "LND",
416
- # "billing_zip": "W1A 1AA",
417
- # "billing_country": "GB"
418
- # }
419
- # }
420
- # }
421
- # ```
422
- # ## 3D Secure - Stripe
423
- # It may happen that a payment needs 3D Secure Authentication when the
424
- # subscription is created; this is referred to in our help docs as a
425
- # [post-authentication
426
- # flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I
427
- # mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio
428
- # n). The server returns `422 Unprocessable Entity` in this case with the
429
- # following response:
430
- # ```json
431
- # {
432
- # "errors": [
433
- # "Your card was declined. This transaction requires 3D secure
434
- # authentication."
435
- # ],
436
- # "gateway_payment_id": "pi_1F0aGoJ2UDb3Q4av7zU3sHPh",
437
- # "description": "This card requires 3D secure authentication. Redirect
438
- # the customer to the URL from the action_link attribute to authenticate.
439
- # Attach callback_url param to this URL if you want to be notified about the
440
- # result of 3D Secure authentication. Attach redirect_url param to this URL
441
- # if you want to redirect a customer back to your page after 3D Secure
442
- # authentication. Example:
443
- # https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time
444
- # _token_id=128&callback_url=https://localhost:4000&redirect_url=https://you
445
- # rpage.com will do a POST request to https://localhost:4000 after payment
446
- # is authenticated and will redirect a customer to https://yourpage.com
447
- # after 3DS authentication.",
448
- # "action_link":
449
- # "http://acme.chargify.com/3d-secure/pi_1F0aGoJ2UDb3Q4av7zU3sHPh?one_time_t
450
- # oken_id=242"
451
- # }
452
- # ```
453
- # To let the customer go through 3D Secure Authentication, they need to be
454
- # redirected to the URL specified in `action_link`.
455
- # Optionally, you can specify `callback_url` parameter in the `action_link`
456
- # URL if you’d like to be notified about the result of 3D Secure
457
- # Authentication. The `callback_url` will return the following information:
458
- # - whether the authentication was successful (`success`)
459
- # - the gateway ID for the payment (`gateway_payment_id`)
460
- # - the subscription ID (`subscription_id`)
461
- # Lastly, you can also specify a `redirect_url` within the `action_link` URL
462
- # if you’d like to redirect a customer back to your site.
463
- # It is not possible to use `action_link` in an iframe inside a custom
464
- # application. You have to redirect the customer directly to the
465
- # `action_link`, then, to be notified about the result, use `redirect_url`
466
- # or `callback_url`.
467
- # The final URL that you send a customer to to complete 3D Secure may
468
- # resemble the following, where the first half is the `action_link` and the
469
- # second half contains a `redirect_url` and `callback_url`:
470
- # `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_tim
471
- # e_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yo
472
- # urpage.com`
473
- # ## 3D Secure - Checkout
474
- # It may happen that a payment needs 3D Secure Authentication when the
475
- # subscription is created; this is referred to in our help docs as a
476
- # [post-authentication
477
- # flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I
478
- # mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio
479
- # n). The server returns `422 Unprocessable Entity` in this case with the
480
- # following response:
481
- # ```json
482
- # {
483
- # "errors": [
484
- # "Your card was declined. This transaction requires 3D secure
485
- # authentication."
486
- # ],
487
- # "gateway_payment_id": "pay_6gjofv7dlyrkpizlolsuspvtiu",
488
- # "description": "This card requires 3D secure authentication. Redirect
489
- # the customer to the URL from the action_link attribute to authenticate.
490
- # Attach callback_url param to this URL if you want to be notified about the
491
- # result of 3D Secure authentication. Attach redirect_url param to this URL
492
- # if you want to redirect a customer back to your page after 3D Secure
493
- # authentication. Example:
494
- # https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_t
495
- # ime_token_id=123&callback_url=https://localhost:4000&redirect_url=https://
496
- # yourpage.com will do a POST request to https://localhost:4000 after
497
- # payment is authenticated and will redirect a customer to
498
- # https://yourpage.com after 3DS authentication.",
499
- # "action_link":
500
- # "http://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_t
501
- # ime_token_id=123"
502
- # }
503
- # ```
504
- # To let the customer go through 3D Secure Authentication, they need to be
505
- # redirected to the URL specified in `action_link`.
506
- # Optionally, you can specify `callback_url` parameter in the `action_link`
507
- # URL if you’d like to be notified about the result of 3D Secure
508
- # Authentication. The `callback_url` will return the following information:
509
- # - whether the authentication was successful (`success`)
510
- # - the gateway ID for the payment (`gateway_payment_id`)
511
- # - the subscription ID (`subscription_id`)
512
- # Lastly, you can also specify a `redirect_url` parameter within the
513
- # `action_link` URL if you’d like to redirect a customer back to your site.
514
- # It is not possible to use `action_link` in an iframe inside a custom
515
- # application. You have to redirect the customer directly to the
516
- # `action_link`, then, to be notified about the result, use `redirect_url`
517
- # or `callback_url`.
518
- # The final URL that you send a customer to complete 3D Secure may resemble
519
- # the following, where the first half is the `action_link` and the second
520
- # half contains a `redirect_url` and `callback_url`:
521
- # `https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_
522
- # time_token_id=123&callback_url=https://localhost:4000&redirect_url=https:/
523
- # /yourpage.com`
524
- # ### Example Redirect Flow
525
- # You may wish to redirect customers to different pages depending on whether
526
- # their SCA was performed successfully. Here's an example flow to use as a
527
- # reference:
528
- # 1. Create a subscription via API; it requires 3DS
529
- # 2. You receive a `gateway_payment_id` in the `action_link` along other
530
- # params in the response.
531
- # 3. Use this `gateway_payment_id` to, for example, connect with your
532
- # internal resources or generate a session_id
533
- # 4. Include 1 of those attributes inside the `callback_url` and
534
- # `redirect_url` to be aware which “session” this applies to
535
- # 5. Redirect the customer to the `action_link` with `callback_url` and
536
- # `redirect_url` applied
537
- # 6. After the customer finishes 3DS authentication, we let you know the
538
- # result by making a request to applied `callback_url`.
539
- # 7. After that, we redirect the customer to the `redirect_url`; at this
540
- # point the result of authentication is known
541
- # 8. Optionally, you can use the applied "msg" param in the `redirect_url`
542
- # to determine whether it was successful or not
543
- # ## Subscriptions Import
544
- # Subscriptions can be “imported” via the API to handle the following
545
- # scenarios:
546
- # + You already have existing subscriptions with specific start and renewal
547
- # dates that you would like to import to Advanced Billing
548
- # + You already have credit cards stored in your provider’s vault and you
549
- # would like to create subscriptions using those tokens
550
- # Before importing, you should have already set up your products to match
551
- # your offerings. Then, you can create Subscriptions via the API just like
552
- # you normally would, but using a few special attributes.
553
- # Full documentation on how import Subscriptions using the **import tool**
554
- # in the Advanced Billing UI can be located
555
- # [here](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports)
556
- # .
557
- # ### Important Notices and Disclaimers regarding Imports
558
- # Before performing a bulk import of subscriptions via the API, we suggest
559
- # reading the [Subscriptions
560
- # Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports
561
- # ) instructions to understand the repurcussions of a large import.
562
- # ### Subscription Input Attributes
563
- # The following _additional_ attributes to the subscription input attributes
564
- # make imports possible: `next_billing_at`, `previous_billing_at`, and
565
- # `import_mrr`.
566
- # ### Current Vault
567
- # If you are using a Legacy gateway such as "eWAY Rapid (Legacy)" or "Stripe
568
- # (Legacy)" then please contact Support for further instructions on
569
- # subscription imports.
570
- # ### Braintree Blue (Braintree v2) Imports
571
- # Braintree Blue is Braintree’s newer (version 2) API. For this gateway,
572
- # please provide the `vault_token` parameter with the value from Braintree’s
573
- # “Customer ID” rather than the “Payment Profile Token”. At this time we do
574
- # not use `current_vault_token` with the Braintree Blue gateway, and we only
575
- # support a single payment profile per Braintree Customer.
576
- # When importing PayPal type payment profiles, please set `payment_type` to
577
- # `paypal_account`.
578
- # ### Stripe ACH Imports
579
- # If the bank account has already been verified, currently you will need to
580
- # create the customer, create the payment profile in Advanced Billing -
581
- # setting verified=true, then create a subscription using the customer_id
582
- # and payment_profile_id.
583
- # ### Webhooks During Import
584
- # If no `next_billing_at` is provided, webhooks will be fired as normal. If
585
- # you do set a future `next_billing_at`, only a subset of the webhooks are
586
- # fired when the subscription is created. Keep reading for more information
587
- # as to what webhooks will be fired under which scenarios.
588
- # #### Successful creation with Billing Date
589
- # Scenario: If `next_billing_at` provided
590
- # + `signup_success`
591
- # + `billing_date_change`
592
- # #### Successful creation without Billing Date
593
- # Scenario: If no `next_billing_at` provided
594
- # + `signup_success`
595
- # + `payment_success`
596
- # #### Unsuccessful creation
597
- # Scenario: If card can’t be charged, and no `next_billing_at` provided
598
- # + signup_failure
599
- # #### Webhooks fired when next_billing_at is reached:
600
- # + `renewal_success or renewal_failure`
601
- # + `payment_success or payment_failure`
602
- # ### Date and Time Formats
603
- # We will attempt to parse any string you send as the value of
604
- # next_billing_at in to a date or time. For best results, use a known format
605
- # like described in “Date and Time Specification” of RFC 2822 or ISO 8601 .
606
- # The following are all equivalent and will work as input to
607
- # `next_billing_at`:
608
- # ```
609
- # Aug 06 2030 11:34:00 -0400
610
- # Aug 06 2030 11:34 -0400
611
- # 2030-08-06T11:34:00-04:00
612
- # 8/6/2030 11:34:00 EDT
613
- # 8/6/2030 8:34:00 PDT
614
- # 2030-08-06T15:34:00Z
615
- # ```
616
- # You may also pass just a date, in which case we will assume the time to be
617
- # noon
618
- # ```
619
- # 2010-08-06
620
- # ```
621
- # ## Subscription Hierarchies & WhoPays
622
- # When subscription groups were first added to our Relationship Invoicing
623
- # architecture, to group together invoices for related subscriptions and
624
- # allow for complex customer hierarchies and WhoPays scenarios, they were
625
- # designed to consist of a primary and a collection of group members. The
626
- # primary would control many aspects of the group, such as when the
627
- # consolidated invoice is generated. As of today, groups still function this
628
- # way.
629
- # In the future, the concept of a "primary" will be removed in order to
630
- # offer more flexibility into group management and reduce confusion
631
- # concerning what actions must be done on a primary level, rather than a
632
- # member level.
633
- # We have introduced a two scheme system as a bridge between these two group
634
- # organizations. Scheme 1, which is relevant to all subscription groups
635
- # today, marks the group as being "ruled" by a primary.
636
- # When reading a subscription via API, they will return a top-level
637
- # attribute called `group`, which will denote which scheme is being used. At
638
- # this time, the `scheme` attribute will always be 1.
639
- # ### Subscription in a Customer Hierarchy
640
- # For sites making use of the [Relationship
641
- # Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanc
642
- # ed-Billing-Invoices-Overview) and [Customer
643
- # Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Cust
644
- # omer-Hierarchies-WhoPays) features, it is possible to create subscriptions
645
- # within a customer hierarchy. This can be achieved through the API by
646
- # passing group parameters in the **Create Subscription** request.
647
- # + The `group` parameters are optional and consist of the required `target`
648
- # and optional `billing` parameters.
649
- # When the `target` parameter specifies a customer that is already part of a
650
- # hierarchy, the new subscription will become a member of the customer
651
- # hierarchy as well. If the target customer is not part of a hierarchy, a
652
- # new customer hierarchy will be created and both the target customer and
653
- # the new subscription will become part of the hierarchy with the specified
654
- # target customer set as the responsible payer for the hierarchy's
9
+ # Creates a Subscription for a customer and product
10
+ # Specify the product with `product_id` or `product_handle`. To set a
11
+ # specific product pricepPoint, use `product_price_point_handle` or
12
+ # `product_price_point_id`.
13
+ # Identify an existing customer with `customer_id` or `customer_reference`.
14
+ # Optionally, include an existing payment profile using
15
+ # `payment_profile_id`. To create a new customer, pass customer_attributes.
16
+ # Select an option from the **Request Examples** drop-down on the right side
17
+ # of the portal to see examples of common scenarios for creating
655
18
  # subscriptions.
656
- # Rather than specifying a customer, the `target` parameter could instead
657
- # simply have a value of `self` which indicates the subscription will be
658
- # paid for not by some other customer, but by the subscribing customer.
659
- # This will be true whether the customer is being created new, is already
660
- # part of a hierarchy, or already exists outside a hierarchy. A valid
661
- # payment method must also be specified in the subscription parameters.
662
- # Note that when creating subscriptions in a customer hierarchy, if the
663
- # customer hierarchy does not already have a payment method, passing valid
664
- # credit card attributes in the subscription parameters will also result in
665
- # the payment method being established as the default payment method for the
666
- # customer hierarchy irrespective of the responsible payer.
667
- # The optional `billing` parameters specify how some aspects of the billing
668
- # for the new subscription should be handled. Rather than capturing payment
669
- # immediately, the `accrue` parameter can be included so that the new
670
- # subscription charges accrue until the next assessment date. Regarding the
671
- # date, the `align_date` parameter can be included so that the billing date
672
- # of the new subscription matches up with the default subscription group in
673
- # the customer hierarchy. When choosing to align the dates, the `prorate`
674
- # parameter can also be specified so that the new subscription charges are
675
- # prorated based on the billing period of the default subscription group in
676
- # the customer hierarchy also.
677
- # ### Subscription in a Subscription Group
678
- # For sites making use of [Relationship
679
- # Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanc
680
- # ed-Billing-Invoices-Overview) it may be desireable to create a
681
- # subscription as part of a [subscription
682
- # group](https://maxio.zendesk.com/hc/en-us/articles/24252172565005-Subscrip
683
- # tion-Groups-Overview) in order to rely on [invoice
684
- # consolidation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-
685
- # Invoice-Consolidation). This can be achieved through the API by passing
686
- # group parameters in the Create Subscription request. The `group`
687
- # parameters are optional and consist of the required `target` and optional
688
- # `billing` parameters.
689
- # The `target` parameters specify an existing subscription with which the
690
- # newly created subscription should be grouped. If the target subscription
691
- # is already part of a group, the new subscription will become a member of
692
- # the group as well. If the target subscription is not part of a group, a
693
- # new group will be created and both the target and the new subscription
694
- # will become part of the group with the target as the group's primary
695
- # subscription.
696
- # The optional `billing` parameters specify how some aspects of the billing
697
- # for the new subscription should be handled. Rather than capturing payment
698
- # immediately, the `accrue` parameter can be included so that the new
699
- # subscription charges accrue until the next assessment date. Regarding the
700
- # date, the `align_date` parameter can be included so that the billing date
701
- # of the new subscription matches up with the target subscription. When
702
- # choosing to align the dates, the `prorate` parameter can also be specified
703
- # so that the new subscription charges are prorated based on the billing
704
- # period of the target subscription also.
705
- # ## Providing Agreement Acceptance Params
706
- # It is possible to provide a proof of customer's acceptance of terms and
707
- # policies.
708
- # We will be storing this proof in case it might be required (i.e.
709
- # chargeback).
710
- # Currently, we already keep it for subscriptions created via Public Signup
711
- # Pages.
712
- # In order to create a subscription with the proof of agreement acceptance,
713
- # you must provide additional parameters `agreement acceptance` with
714
- # `ip_address` and at least one url to the policy that was accepted:
715
- # `terms_url` or `privacy_policy_url`. Additional urls that can be provided:
716
- # `return_refund_policy_url`, `delivery_policy_url` and
717
- # `secure_checkout_policy_url`.
718
- # ```json
719
- # "subscription": {
720
- # "product_handle": "gold-product",
721
- # "customer_attributes": {
722
- # "first_name": "Jane",
723
- # "last_name": "Doe",
724
- # "email": "jd@chargify.test"
725
- # },
726
- # "agreement_acceptance": {
727
- # "ip_address": "1.2.3.4",
728
- # "terms_url": "https://terms.url",
729
- # "privacy_policy_url": "https://privacy_policy.url",
730
- # "return_refund_policy_url": "https://return_refund_policy.url",
731
- # "delivery_policy_url": "https://delivery_policy.url",
732
- # "secure_checkout_policy_url": "https://secure_checkout_policy.url"
733
- # }
734
- # }
735
- # }
736
- # ```
737
- # **For Maxio Payments subscriptions, the agreement acceptance params are
738
- # required, with at least terms_url provided.**
739
- # ## Providing ACH Agreement params
740
- # It is also possible to provide a proof that a customer authorized ACH
741
- # agreement terms.
742
- # The proof will be stored and the email will be sent to the customer with a
743
- # copy of the terms (if enabled).
744
- # In order to create a subscription with the proof of authorized ACH
745
- # agreement terms, you must provide the additional parameter `ach_agreement`
746
- # with the following nested parameters: `agreement_terms`,
747
- # `authorizer_first_name`, `authorizer_last_name` and `ip_address`.
748
- # Each of them is required.
749
- # ```json
750
- # "subscription": {
751
- # "product_handle": "gold-product",
752
- # "customer_attributes": {
753
- # "first_name": "Jane",
754
- # "last_name": "Doe",
755
- # "email": "jd@chargify.test"
756
- # },
757
- # "bank_account_attributes": {
758
- # "bank_name": "Test Bank",
759
- # "bank_routing_number": "021000089",
760
- # "bank_account_number": "111111111111",
761
- # "bank_account_type": "checking",
762
- # "bank_account_holder_type": "business",
763
- # "payment_type": "bank_account"
764
- # },
765
- # "ach_agreement": {
766
- # "agreement_terms": "ACH agreement terms",
767
- # "authorizer_first_name": "Jane",
768
- # "authorizer_last_name": "Doe",
769
- # "ip_address": "1.2.3.4"
770
- # }
771
- # }
772
- # ```
19
+ # Payment information may be required to create a subscription, depending on
20
+ # the options for the Product being subscribed. See [product
21
+ # options](https://docs.maxio.com/hc/en-us/articles/24261076617869-Edit-Prod
22
+ # ucts) for more information. See the [Payments
23
+ # Profile]($e/Payment%20Profiles/createPaymentProfile) endpoint for details
24
+ # on payment parameters.
25
+ # Do not use real card information for testing. See the Sites articles that
26
+ # cover [testing your site
27
+ # setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Ove
28
+ # rview#testing-overview-0-0) for more details on testing in your sandbox.
29
+ # Note that collecting and sending raw card details in production requires
30
+ # [PCI
31
+ # compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Co
32
+ # mpliance#pci-compliance-0-0) on your end. If your business is not PCI
33
+ # compliant, use
34
+ # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char
35
+ # gify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank
36
+ # account information.
37
+ # See the [Subscription
38
+ # Signups](page:introduction/basic-concepts/subscription-signup) article for
39
+ # more information on working with subscriptions in Advanced Billing.
773
40
  # @param [CreateSubscriptionRequest] body Optional parameter: TODO: type
774
41
  # description here
775
42
  # @return [SubscriptionResponse] Response from the API call.
@@ -892,68 +159,78 @@ module AdvancedBilling
892
159
  .execute
893
160
  end
894
161
 
895
- # The subscription endpoint allows you to instantly update one or many
896
- # attributes about a subscription in a single call.
162
+ # Updates one or more attributes of a subscription.
897
163
  # ## Update Subscription Payment Method
898
- # Change the card that your Subscriber uses for their subscription. You can
899
- # also use this method to simply change the expiration date of the card **if
900
- # your gateway allows**.
901
- # Note that partial card updates for **Authorize.Net** are not allowed via
164
+ # Change the card that your subscriber uses for their subscription. You can
165
+ # also use this method to change the expiration date of the card **if your
166
+ # gateway allows**.
167
+ # Do not use real card information for testing. See the Sites articles that
168
+ # cover [testing your site
169
+ # setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Ove
170
+ # rview#testing-overview-0-0) for more details on testing in your sandbox.
171
+ # Note that collecting and sending raw card details in production requires
172
+ # [PCI
173
+ # compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Co
174
+ # mpliance#pci-compliance-0-0) on your end. If your business is not PCI
175
+ # compliant, use
176
+ # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char
177
+ # gify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank
178
+ # account information.
179
+ # > Note: Partial card updates for **Authorize.Net** are not allowed via
902
180
  # this endpoint. The existing Payment Profile must be directly updated
903
181
  # instead.
182
+ # ## Update Product
904
183
  # You also use this method to change the subscription to a different product
905
184
  # by setting a new value for product_handle. A product change can be done in
906
185
  # two different ways, **product change** or **delayed product change**.
907
- # ## Product Change
908
- # This endpoint may be used to change a subscription's product. The new
909
- # payment amount is calculated and charged at the normal start of the next
910
- # period. If you desire complex product changes or prorated upgrades and
911
- # downgrades instead, please see the documentation on Migrating Subscription
912
- # Products.
913
- # To perform a product change, simply set either the `product_handle` or
186
+ # ### Product Change
187
+ # You can change a subscription's product. The new payment amount is
188
+ # calculated and charged at the normal start of the next period. If you
189
+ # require complex product changes or prorated upgrades and downgrades
190
+ # instead, please see the documentation on [Migrating Subscription
191
+ # Products](https://docs.maxio.com/hc/en-us/articles/24252069837581-Product-
192
+ # Changes-and-Migrations#product-changes-and-migrations-0-0).
193
+ # To perform a product change, set either the `product_handle` or
914
194
  # `product_id` attribute to that of a different product from the same site
915
195
  # as the subscription. You can also change the price point by passing in
916
196
  # either `product_price_point_id` or `product_price_point_handle` -
917
- # otherwise the new product's default price point will be used.
197
+ # otherwise the new product's default price point is used.
918
198
  # ### Delayed Product Change
919
199
  # This method also changes the product and/or price point, and the new
920
200
  # payment amount is calculated and charged at the normal start of the next
921
201
  # period.
922
202
  # This method schedules the product change to happen automatically at the
923
- # subscription’s next renewal date. To perform a Delayed Product Change, set
203
+ # subscription’s next renewal date. To perform a delayed product change, set
924
204
  # the `product_handle` attribute as you would in a regular product change,
925
205
  # but also set the `product_change_delayed` attribute to `true`. No
926
206
  # proration applies in this case.
927
207
  # You can also perform a delayed change to the price point by passing in
928
208
  # either `product_price_point_id` or `product_price_point_handle`
929
- # **Note: To cancel a delayed product change, set `next_product_id` to an
930
- # empty string.**
209
+ # > **Note:** To cancel a delayed product change, set `next_product_id` to
210
+ # an empty string.
931
211
  # ## Billing Date Changes
212
+ # You can update dates for a subscrption.
932
213
  # ### Regular Billing Date Changes
933
214
  # Send the `next_billing_at` to set the next billing date for the
934
215
  # subscription. After that date passes and the subscription is processed,
935
216
  # the following billing date will be set according to the subscription's
936
217
  # product period.
937
- # Note that if you pass an invalid date, we will automatically interpret and
938
- # set the correct date. For example, when February 30 is entered, the next
939
- # billing will be set to March 2nd in a non-leap year.
218
+ # > Note: If you pass an invalid date, the correct date is automatically set
219
+ # to he correct date. For example, if February 30 is passed, the next
220
+ # billing would be set to March 2nd in a non-leap year.
940
221
  # The server response will not return data under the key/value pair of
941
- # `next_billing`. Please view the key/value pair of `current_period_ends_at`
942
- # to verify that the `next_billing` date has been changed successfully.
943
- # ### Snap Day Changes
222
+ # `next_billing_at`. View the key/value pair of `current_period_ends_at` to
223
+ # verify that the `next_billing_at` date has been changed successfully.
224
+ # ### Calendar Billing and Snap Day Changes
944
225
  # For a subscription using Calendar Billing, setting the next billing date
945
226
  # is a bit different. Send the `snap_day` attribute to change the calendar
946
227
  # billing date for **a subscription using a product eligible for calendar
947
228
  # billing**.
948
- # Note: If you change the product associated with a subscription that
949
- # contains a `snap_date` and immediately `READ/GET` the subscription data,
950
- # it will still contain evidence of the existing `snap_date`. This is due to
951
- # the fact that a product change is instantanous and only affects the
952
- # product associated with a subscription. After the `next_billing` date
953
- # arrives, the `snap_day` associated with the subscription will return to
954
- # `null.` Another way of looking at this is that you willl have to wait for
955
- # the next billing cycle to arrive before the `snap_date` will reset to
956
- # `null`.
229
+ # > Note: If you change the product associated with a subscription that
230
+ # contains a `snap_day` and immediately `READ/GET` the subscription data, it
231
+ # will still contain original `snap_day`. The `snap_day`will will reset to
232
+ # 'null on the next billing cycle. This is because a product change is
233
+ # instantanous and only affects the product associated with a subscription.
957
234
  # @param [Integer] subscription_id Required parameter: The Chargify id of
958
235
  # the subscription
959
236
  # @param [UpdateSubscriptionRequest] body Optional parameter: TODO: type
@@ -1098,8 +375,8 @@ module AdvancedBilling
1098
375
  # record and/or payment profiles by passing `cascade` parameters. For
1099
376
  # example, to delete just the customer record, the query params would be:
1100
377
  # `?ack={customer_id}&cascade[]=customer`
1101
- # If you need to remove subscriptions from a live site, please contact
1102
- # support to discuss your use case.
378
+ # If you need to remove subscriptions from a live site, contact support to
379
+ # discuss your use case.
1103
380
  # ### Delete customer and payment profile
1104
381
  # The query params will be:
1105
382
  # `?ack={customer_id}&cascade[]=customer&cascade[]=payment_profile`
@@ -1172,7 +449,7 @@ module AdvancedBilling
1172
449
  # Subscriber's Summary.
1173
450
  # A subscription will not be created by utilizing this endpoint; it is meant
1174
451
  # to serve as a prediction.
1175
- # For more information, please see our documentation
452
+ # For more information, see our documentation
1176
453
  # [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscrib
1177
454
  # er-Interface-Overview).
1178
455
  # ## Taxable Subscriptions
@@ -1183,24 +460,24 @@ module AdvancedBilling
1183
460
  # or combination of the two.
1184
461
  # + The subscription payload must contain a full billing or shipping address
1185
462
  # in order to calculate tax
1186
- # For more information about creating taxable previews, please see our
463
+ # For more information about creating taxable previews, see our
1187
464
  # documentation guide on how to create [taxable
1188
465
  # subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325
1189
466
  # -Taxes)
1190
467
  # You do **not** need to include a card number to generate tax information
1191
- # when you are previewing a subscription. However, please note that when you
1192
- # actually want to create the subscription, you must include the credit card
1193
- # information if you want the billing address to be stored in Advanced
1194
- # Billing. The billing address and the credit card information are stored
1195
- # together within the payment profile object. Also, you may not send a
1196
- # billing address to Advanced Billing without payment profile information,
1197
- # as the address is stored on the card.
468
+ # when you are previewing a subscription. However, when you actually want to
469
+ # create the subscription, you must include the credit card information if
470
+ # you want the billing address to be stored in Advanced Billing. The billing
471
+ # address and the credit card information are stored together within the
472
+ # payment profile object. Also, you may not send a billing address to
473
+ # Advanced Billing without payment profile information, as the address is
474
+ # stored on the card.
1198
475
  # You can pass shipping and billing addresses and still decide not to
1199
476
  # calculate taxes. To do that, pass `skip_billing_manifest_taxes: true`
1200
477
  # attribute.
1201
478
  # ## Non-taxable Subscriptions
1202
- # If you'd like to calculate subscriptions that do not include tax, please
1203
- # feel free to leave off the billing information.
479
+ # If you'd like to calculate subscriptions that do not include tax you may
480
+ # leave off the billing information.
1204
481
  # @param [CreateSubscriptionRequest] body Optional parameter: TODO: type
1205
482
  # description here
1206
483
  # @return [SubscriptionPreviewResponse] Response from the API call.
@@ -1268,7 +545,7 @@ module AdvancedBilling
1268
545
 
1269
546
  # Use this endpoint to remove a coupon from an existing subscription.
1270
547
  # For more information on the expected behaviour of removing a coupon from a
1271
- # subscription, please see our documentation
548
+ # subscription, See our documentation
1272
549
  # [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons
1273
550
  # -and-Subscriptions#removing-a-coupon)
1274
551
  # @param [Integer] subscription_id Required parameter: The Chargify id of
@@ -1288,7 +565,7 @@ module AdvancedBilling
1288
565
  .auth(Single.new('BasicAuth')))
1289
566
  .response(new_response_handler
1290
567
  .deserializer(APIHelper.method(:deserialize_primitive_types))
1291
- .deserialize_into(proc do |response| response.to_s end)
568
+ .deserialize_into(proc do |response| response&.to_s end)
1292
569
  .is_primitive_response(true)
1293
570
  .local_error_template('422',
1294
571
  'HTTP Response Not OK. Status code: {$statusCode}.'\