stripe 5.38.0 → 15.2.1

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 (708) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +742 -0
  3. data/CONTRIBUTING.md +25 -0
  4. data/Gemfile +12 -4
  5. data/Makefile +22 -0
  6. data/OPENAPI_VERSION +1 -0
  7. data/README.md +137 -27
  8. data/Rakefile +3 -6
  9. data/VERSION +1 -1
  10. data/examples/README.md +16 -0
  11. data/examples/example_template.rb +36 -0
  12. data/examples/meter_event_stream.rb +57 -0
  13. data/examples/thinevent_webhook_handler.rb +39 -0
  14. data/{bin → exe}/stripe-console +1 -1
  15. data/justfile +43 -0
  16. data/lib/data/ca-certificates.crt +1241 -1937
  17. data/lib/stripe/api_operations/create.rb +6 -2
  18. data/lib/stripe/api_operations/delete.rb +12 -7
  19. data/lib/stripe/api_operations/list.rb +6 -9
  20. data/lib/stripe/api_operations/nested_resource.rb +59 -31
  21. data/lib/stripe/api_operations/request.rb +30 -65
  22. data/lib/stripe/api_operations/save.rb +20 -10
  23. data/lib/stripe/api_operations/search.rb +21 -0
  24. data/lib/stripe/api_operations/singleton_save.rb +90 -0
  25. data/lib/stripe/api_requestor.rb +1136 -0
  26. data/lib/stripe/api_resource.rb +49 -34
  27. data/lib/stripe/api_resource_test_helpers.rb +53 -0
  28. data/lib/stripe/{resources/usage_record.rb → api_version.rb} +2 -2
  29. data/lib/stripe/connection_manager.rb +28 -11
  30. data/lib/stripe/errors.rb +11 -20
  31. data/lib/stripe/event_types.rb +15 -0
  32. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  33. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  34. data/lib/stripe/events/v2_core_event_destination_ping_event.rb +21 -0
  35. data/lib/stripe/instrumentation.rb +37 -15
  36. data/lib/stripe/list_object.rb +5 -3
  37. data/lib/stripe/multipart_encoder.rb +7 -7
  38. data/lib/stripe/oauth.rb +14 -21
  39. data/lib/stripe/object_types.rb +157 -91
  40. data/lib/stripe/request_options.rb +129 -0
  41. data/lib/stripe/request_params.rb +24 -0
  42. data/lib/stripe/resources/account.rb +4854 -30
  43. data/lib/stripe/resources/account_link.rb +66 -0
  44. data/lib/stripe/resources/account_session.rb +868 -0
  45. data/lib/stripe/resources/alipay_account.rb +1 -1
  46. data/lib/stripe/resources/apple_pay_domain.rb +91 -0
  47. data/lib/stripe/resources/application.rb +20 -0
  48. data/lib/stripe/resources/application_fee.rb +96 -2
  49. data/lib/stripe/resources/application_fee_refund.rb +26 -2
  50. data/lib/stripe/resources/apps/secret.rb +196 -0
  51. data/lib/stripe/resources/balance.rb +178 -0
  52. data/lib/stripe/resources/balance_transaction.rb +124 -0
  53. data/lib/stripe/resources/bank_account.rb +137 -6
  54. data/lib/stripe/resources/billing/alert.rb +222 -0
  55. data/lib/stripe/resources/billing/alert_triggered.rb +26 -0
  56. data/lib/stripe/resources/billing/credit_balance_summary.rb +54 -0
  57. data/lib/stripe/resources/billing/credit_balance_transaction.rb +133 -0
  58. data/lib/stripe/resources/billing/credit_grant.rb +307 -0
  59. data/lib/stripe/resources/billing/meter.rb +254 -0
  60. data/lib/stripe/resources/billing/meter_event.rb +61 -0
  61. data/lib/stripe/resources/billing/meter_event_adjustment.rb +69 -0
  62. data/lib/stripe/resources/billing/meter_event_summary.rb +32 -0
  63. data/lib/stripe/resources/billing_portal/configuration.rb +587 -0
  64. data/lib/stripe/resources/billing_portal/session.rb +298 -0
  65. data/lib/stripe/resources/capability.rb +91 -2
  66. data/lib/stripe/resources/card.rb +111 -3
  67. data/lib/stripe/resources/cash_balance.rb +43 -0
  68. data/lib/stripe/resources/charge.rb +1682 -2
  69. data/lib/stripe/resources/checkout/session.rb +3666 -2
  70. data/lib/stripe/resources/climate/order.rb +234 -0
  71. data/lib/stripe/resources/climate/product.rb +74 -0
  72. data/lib/stripe/resources/climate/supplier.rb +71 -0
  73. data/lib/stripe/resources/confirmation_token.rb +1498 -0
  74. data/lib/stripe/resources/connect_collection_transfer.rb +24 -0
  75. data/lib/stripe/resources/country_spec.rb +68 -0
  76. data/lib/stripe/resources/coupon.rb +236 -0
  77. data/lib/stripe/resources/credit_note.rb +709 -9
  78. data/lib/stripe/resources/credit_note_line_item.rb +71 -0
  79. data/lib/stripe/resources/customer.rb +1015 -16
  80. data/lib/stripe/resources/customer_balance_transaction.rb +38 -1
  81. data/lib/stripe/resources/customer_cash_balance_transaction.rb +124 -0
  82. data/lib/stripe/resources/customer_session.rb +188 -0
  83. data/lib/stripe/resources/discount.rb +37 -0
  84. data/lib/stripe/resources/dispute.rb +650 -2
  85. data/lib/stripe/resources/entitlements/active_entitlement.rb +63 -0
  86. data/lib/stripe/resources/entitlements/active_entitlement_summary.rb +23 -0
  87. data/lib/stripe/resources/entitlements/feature.rb +130 -0
  88. data/lib/stripe/resources/ephemeral_key.rb +44 -0
  89. data/lib/stripe/resources/event.rb +130 -0
  90. data/lib/stripe/resources/exchange_rate.rb +58 -0
  91. data/lib/stripe/resources/file.rb +139 -15
  92. data/lib/stripe/resources/file_link.rb +129 -0
  93. data/lib/stripe/resources/financial_connections/account.rb +363 -0
  94. data/lib/stripe/resources/financial_connections/account_owner.rb +31 -0
  95. data/lib/stripe/resources/financial_connections/account_ownership.rb +23 -0
  96. data/lib/stripe/resources/financial_connections/session.rb +121 -0
  97. data/lib/stripe/resources/financial_connections/transaction.rb +118 -0
  98. data/lib/stripe/resources/forwarding/request.rb +208 -0
  99. data/lib/stripe/resources/funding_instructions.rb +332 -0
  100. data/lib/stripe/resources/identity/verification_report.rb +287 -0
  101. data/lib/stripe/resources/identity/verification_session.rb +474 -4
  102. data/lib/stripe/resources/invoice.rb +3525 -17
  103. data/lib/stripe/resources/invoice_item.rb +453 -0
  104. data/lib/stripe/resources/invoice_line_item.rb +372 -1
  105. data/lib/stripe/resources/invoice_payment.rb +112 -0
  106. data/lib/stripe/resources/invoice_rendering_template.rb +120 -0
  107. data/lib/stripe/resources/issuing/authorization.rb +1313 -4
  108. data/lib/stripe/resources/issuing/card.rb +785 -4
  109. data/lib/stripe/resources/issuing/cardholder.rb +684 -0
  110. data/lib/stripe/resources/issuing/dispute.rb +828 -2
  111. data/lib/stripe/resources/issuing/personalization_design.rb +395 -0
  112. data/lib/stripe/resources/issuing/physical_bundle.rb +80 -0
  113. data/lib/stripe/resources/issuing/token.rb +198 -0
  114. data/lib/stripe/resources/issuing/transaction.rb +991 -0
  115. data/lib/stripe/resources/line_item.rb +51 -0
  116. data/lib/stripe/resources/login_link.rb +12 -0
  117. data/lib/stripe/resources/mandate.rb +146 -0
  118. data/lib/stripe/resources/payment_intent.rb +8876 -6
  119. data/lib/stripe/resources/payment_link.rb +1692 -0
  120. data/lib/stripe/resources/payment_method.rb +1570 -4
  121. data/lib/stripe/resources/payment_method_configuration.rb +3189 -0
  122. data/lib/stripe/resources/payment_method_domain.rb +236 -0
  123. data/lib/stripe/resources/payout.rb +271 -4
  124. data/lib/stripe/resources/person.rb +295 -1
  125. data/lib/stripe/resources/plan.rb +352 -0
  126. data/lib/stripe/resources/price.rb +642 -0
  127. data/lib/stripe/resources/product.rb +534 -0
  128. data/lib/stripe/resources/product_feature.rb +25 -0
  129. data/lib/stripe/resources/promotion_code.rb +237 -0
  130. data/lib/stripe/resources/quote.rb +1015 -38
  131. data/lib/stripe/resources/radar/early_fraud_warning.rb +85 -0
  132. data/lib/stripe/resources/radar/value_list.rb +171 -0
  133. data/lib/stripe/resources/radar/value_list_item.rb +131 -0
  134. data/lib/stripe/resources/refund.rb +494 -0
  135. data/lib/stripe/resources/reporting/report_run.rb +172 -0
  136. data/lib/stripe/resources/reporting/report_type.rb +48 -1
  137. data/lib/stripe/resources/reserve_transaction.rb +22 -0
  138. data/lib/stripe/resources/reversal.rb +38 -2
  139. data/lib/stripe/resources/review.rb +122 -2
  140. data/lib/stripe/resources/setup_attempt.rb +380 -0
  141. data/lib/stripe/resources/setup_intent.rb +3432 -4
  142. data/lib/stripe/resources/shipping_rate.rb +287 -0
  143. data/lib/stripe/resources/sigma/scheduled_query_run.rb +62 -0
  144. data/lib/stripe/resources/source.rb +1250 -10
  145. data/lib/stripe/resources/source_mandate_notification.rb +66 -0
  146. data/lib/stripe/resources/source_transaction.rb +93 -0
  147. data/lib/stripe/resources/subscription.rb +1871 -3
  148. data/lib/stripe/resources/subscription_item.rb +399 -10
  149. data/lib/stripe/resources/subscription_schedule.rb +1455 -4
  150. data/lib/stripe/resources/tax/calculation.rb +430 -0
  151. data/lib/stripe/resources/tax/calculation_line_item.rb +71 -0
  152. data/lib/stripe/resources/tax/registration.rb +2667 -0
  153. data/lib/stripe/resources/tax/settings.rb +134 -0
  154. data/lib/stripe/resources/tax/transaction.rb +314 -0
  155. data/lib/stripe/resources/tax/transaction_line_item.rb +44 -0
  156. data/lib/stripe/resources/tax_code.rb +35 -0
  157. data/lib/stripe/resources/tax_deducted_at_source.rb +22 -0
  158. data/lib/stripe/resources/tax_id.rb +144 -11
  159. data/lib/stripe/resources/tax_rate.rb +217 -0
  160. data/lib/stripe/resources/terminal/configuration.rb +1328 -0
  161. data/lib/stripe/resources/terminal/connection_token.rb +34 -0
  162. data/lib/stripe/resources/terminal/location.rb +222 -0
  163. data/lib/stripe/resources/terminal/reader.rb +886 -0
  164. data/lib/stripe/resources/test_helpers/test_clock.rb +156 -0
  165. data/lib/stripe/resources/token.rb +1249 -0
  166. data/lib/stripe/resources/topup.rb +204 -2
  167. data/lib/stripe/resources/transfer.rb +173 -6
  168. data/lib/stripe/resources/treasury/credit_reversal.rb +120 -0
  169. data/lib/stripe/resources/treasury/debit_reversal.rb +131 -0
  170. data/lib/stripe/resources/treasury/financial_account.rb +833 -0
  171. data/lib/stripe/resources/treasury/financial_account_features.rb +204 -0
  172. data/lib/stripe/resources/treasury/inbound_transfer.rb +356 -0
  173. data/lib/stripe/resources/treasury/outbound_payment.rb +638 -0
  174. data/lib/stripe/resources/treasury/outbound_transfer.rb +493 -0
  175. data/lib/stripe/resources/treasury/received_credit.rb +284 -0
  176. data/lib/stripe/resources/treasury/received_debit.rb +243 -0
  177. data/lib/stripe/resources/treasury/transaction.rb +193 -0
  178. data/lib/stripe/resources/treasury/transaction_entry.rb +178 -0
  179. data/lib/stripe/resources/v2/amount.rb +9 -0
  180. data/lib/stripe/resources/v2/billing/meter_event.rb +34 -0
  181. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +36 -0
  182. data/lib/stripe/resources/v2/billing/meter_event_session.rb +29 -0
  183. data/lib/stripe/resources/v2/event.rb +41 -0
  184. data/lib/stripe/resources/v2/event_destination.rb +73 -0
  185. data/lib/stripe/resources/webhook_endpoint.rb +167 -0
  186. data/lib/stripe/resources.rb +70 -12
  187. data/lib/stripe/search_result_object.rb +89 -0
  188. data/lib/stripe/services/account_capability_service.rb +71 -0
  189. data/lib/stripe/services/account_external_account_service.rb +317 -0
  190. data/lib/stripe/services/account_link_service.rb +63 -0
  191. data/lib/stripe/services/account_login_link_service.rb +28 -0
  192. data/lib/stripe/services/account_person_service.rb +1019 -0
  193. data/lib/stripe/services/account_service.rb +4171 -0
  194. data/lib/stripe/services/account_session_service.rb +569 -0
  195. data/lib/stripe/services/apple_pay_domain_service.rb +100 -0
  196. data/lib/stripe/services/application_fee_refund_service.rb +114 -0
  197. data/lib/stripe/services/application_fee_service.rb +92 -0
  198. data/lib/stripe/services/apps/secret_service.rb +168 -0
  199. data/lib/stripe/services/apps_service.rb +13 -0
  200. data/lib/stripe/services/balance_service.rb +21 -0
  201. data/lib/stripe/services/balance_transaction_service.rb +101 -0
  202. data/lib/stripe/services/billing/alert_service.rb +187 -0
  203. data/lib/stripe/services/billing/credit_balance_summary_service.rb +67 -0
  204. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +70 -0
  205. data/lib/stripe/services/billing/credit_grant_service.rb +240 -0
  206. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +45 -0
  207. data/lib/stripe/services/billing/meter_event_service.rb +40 -0
  208. data/lib/stripe/services/billing/meter_event_summary_service.rb +58 -0
  209. data/lib/stripe/services/billing/meter_service.rb +211 -0
  210. data/lib/stripe/services/billing_portal/configuration_service.rb +496 -0
  211. data/lib/stripe/services/billing_portal/session_service.rb +192 -0
  212. data/lib/stripe/services/billing_portal_service.rb +14 -0
  213. data/lib/stripe/services/billing_service.rb +20 -0
  214. data/lib/stripe/services/charge_service.rb +471 -0
  215. data/lib/stripe/services/checkout/session_line_item_service.rb +37 -0
  216. data/lib/stripe/services/checkout/session_service.rb +2495 -0
  217. data/lib/stripe/services/checkout_service.rb +13 -0
  218. data/lib/stripe/services/climate/order_service.rb +170 -0
  219. data/lib/stripe/services/climate/product_service.rb +57 -0
  220. data/lib/stripe/services/climate/supplier_service.rb +57 -0
  221. data/lib/stripe/services/climate_service.rb +15 -0
  222. data/lib/stripe/services/confirmation_token_service.rb +26 -0
  223. data/lib/stripe/services/country_spec_service.rb +55 -0
  224. data/lib/stripe/services/coupon_service.rb +202 -0
  225. data/lib/stripe/services/credit_note_line_item_service.rb +35 -0
  226. data/lib/stripe/services/credit_note_preview_lines_service.rb +169 -0
  227. data/lib/stripe/services/credit_note_service.rb +457 -0
  228. data/lib/stripe/services/customer_balance_transaction_service.rb +113 -0
  229. data/lib/stripe/services/customer_cash_balance_service.rb +57 -0
  230. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +55 -0
  231. data/lib/stripe/services/customer_funding_instructions_service.rb +61 -0
  232. data/lib/stripe/services/customer_payment_method_service.rb +68 -0
  233. data/lib/stripe/services/customer_payment_source_service.rb +255 -0
  234. data/lib/stripe/services/customer_service.rb +664 -0
  235. data/lib/stripe/services/customer_session_service.rb +113 -0
  236. data/lib/stripe/services/customer_tax_id_service.rb +94 -0
  237. data/lib/stripe/services/dispute_service.rb +422 -0
  238. data/lib/stripe/services/entitlements/active_entitlement_service.rb +66 -0
  239. data/lib/stripe/services/entitlements/feature_service.rb +128 -0
  240. data/lib/stripe/services/entitlements_service.rb +14 -0
  241. data/lib/stripe/services/ephemeral_key_service.rb +64 -0
  242. data/lib/stripe/services/event_service.rb +87 -0
  243. data/lib/stripe/services/exchange_rate_service.rb +55 -0
  244. data/lib/stripe/services/file_link_service.rb +132 -0
  245. data/lib/stripe/services/file_service.rb +124 -0
  246. data/lib/stripe/services/financial_connections/account_owner_service.rb +46 -0
  247. data/lib/stripe/services/financial_connections/account_service.rb +177 -0
  248. data/lib/stripe/services/financial_connections/session_service.rb +98 -0
  249. data/lib/stripe/services/financial_connections/transaction_service.rb +100 -0
  250. data/lib/stripe/services/financial_connections_service.rb +15 -0
  251. data/lib/stripe/services/forwarding/request_service.rb +147 -0
  252. data/lib/stripe/services/forwarding_service.rb +13 -0
  253. data/lib/stripe/services/identity/verification_report_service.rb +95 -0
  254. data/lib/stripe/services/identity/verification_session_service.rb +337 -0
  255. data/lib/stripe/services/identity_service.rb +14 -0
  256. data/lib/stripe/services/invoice_item_service.rb +394 -0
  257. data/lib/stripe/services/invoice_line_item_service.rb +252 -0
  258. data/lib/stripe/services/invoice_payment_service.rb +83 -0
  259. data/lib/stripe/services/invoice_rendering_template_service.rb +101 -0
  260. data/lib/stripe/services/invoice_service.rb +2900 -0
  261. data/lib/stripe/services/issuing/authorization_service.rb +169 -0
  262. data/lib/stripe/services/issuing/card_service.rb +507 -0
  263. data/lib/stripe/services/issuing/cardholder_service.rb +577 -0
  264. data/lib/stripe/services/issuing/dispute_service.rb +696 -0
  265. data/lib/stripe/services/issuing/personalization_design_service.rb +245 -0
  266. data/lib/stripe/services/issuing/physical_bundle_service.rb +70 -0
  267. data/lib/stripe/services/issuing/token_service.rb +114 -0
  268. data/lib/stripe/services/issuing/transaction_service.rb +118 -0
  269. data/lib/stripe/services/issuing_service.rb +20 -0
  270. data/lib/stripe/services/mandate_service.rb +26 -0
  271. data/lib/stripe/services/oauth_service.rb +63 -0
  272. data/lib/stripe/services/payment_intent_service.rb +7202 -0
  273. data/lib/stripe/services/payment_link_line_item_service.rb +35 -0
  274. data/lib/stripe/services/payment_link_service.rb +1333 -0
  275. data/lib/stripe/services/payment_method_configuration_service.rb +2306 -0
  276. data/lib/stripe/services/payment_method_domain_service.rb +142 -0
  277. data/lib/stripe/services/payment_method_service.rb +843 -0
  278. data/lib/stripe/services/payout_service.rb +225 -0
  279. data/lib/stripe/services/plan_service.rb +297 -0
  280. data/lib/stripe/services/price_service.rb +545 -0
  281. data/lib/stripe/services/product_feature_service.rb +91 -0
  282. data/lib/stripe/services/product_service.rb +494 -0
  283. data/lib/stripe/services/promotion_code_service.rb +228 -0
  284. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +35 -0
  285. data/lib/stripe/services/quote_line_item_service.rb +35 -0
  286. data/lib/stripe/services/quote_service.rb +703 -0
  287. data/lib/stripe/services/radar/early_fraud_warning_service.rb +93 -0
  288. data/lib/stripe/services/radar/value_list_item_service.rb +130 -0
  289. data/lib/stripe/services/radar/value_list_service.rb +165 -0
  290. data/lib/stripe/services/radar_service.rb +15 -0
  291. data/lib/stripe/services/refund_service.rb +200 -0
  292. data/lib/stripe/services/reporting/report_run_service.rb +147 -0
  293. data/lib/stripe/services/reporting/report_type_service.rb +48 -0
  294. data/lib/stripe/services/reporting_service.rb +14 -0
  295. data/lib/stripe/services/review_service.rb +89 -0
  296. data/lib/stripe/services/setup_attempt_service.rb +68 -0
  297. data/lib/stripe/services/setup_intent_service.rb +3107 -0
  298. data/lib/stripe/services/shipping_rate_service.rb +250 -0
  299. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +57 -0
  300. data/lib/stripe/services/sigma_service.rb +13 -0
  301. data/lib/stripe/services/source_service.rb +665 -0
  302. data/lib/stripe/services/source_transaction_service.rb +35 -0
  303. data/lib/stripe/services/subscription_item_service.rb +372 -0
  304. data/lib/stripe/services/subscription_schedule_service.rb +1224 -0
  305. data/lib/stripe/services/subscription_service.rb +1590 -0
  306. data/lib/stripe/services/tax/calculation_line_item_service.rb +37 -0
  307. data/lib/stripe/services/tax/calculation_service.rb +246 -0
  308. data/lib/stripe/services/tax/registration_service.rb +1774 -0
  309. data/lib/stripe/services/tax/settings_service.rb +104 -0
  310. data/lib/stripe/services/tax/transaction_line_item_service.rb +37 -0
  311. data/lib/stripe/services/tax/transaction_service.rb +159 -0
  312. data/lib/stripe/services/tax_code_service.rb +49 -0
  313. data/lib/stripe/services/tax_id_service.rb +116 -0
  314. data/lib/stripe/services/tax_rate_service.rb +193 -0
  315. data/lib/stripe/services/tax_service.rb +16 -0
  316. data/lib/stripe/services/terminal/configuration_service.rb +1059 -0
  317. data/lib/stripe/services/terminal/connection_token_service.rb +31 -0
  318. data/lib/stripe/services/terminal/location_service.rb +207 -0
  319. data/lib/stripe/services/terminal/reader_service.rb +488 -0
  320. data/lib/stripe/services/terminal_service.rb +16 -0
  321. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +655 -0
  322. data/lib/stripe/services/test_helpers/customer_service.rb +37 -0
  323. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +832 -0
  324. data/lib/stripe/services/test_helpers/issuing/card_service.rb +110 -0
  325. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +84 -0
  326. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +675 -0
  327. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  328. data/lib/stripe/services/test_helpers/refund_service.rb +28 -0
  329. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +108 -0
  330. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  331. data/lib/stripe/services/test_helpers/test_clock_service.rb +119 -0
  332. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +81 -0
  333. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +141 -0
  334. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +141 -0
  335. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +81 -0
  336. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +81 -0
  337. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  338. data/lib/stripe/services/test_helpers_service.rb +19 -0
  339. data/lib/stripe/services/token_service.rb +1224 -0
  340. data/lib/stripe/services/topup_service.rb +191 -0
  341. data/lib/stripe/services/transfer_reversal_service.rb +122 -0
  342. data/lib/stripe/services/transfer_service.rb +166 -0
  343. data/lib/stripe/services/treasury/credit_reversal_service.rb +100 -0
  344. data/lib/stripe/services/treasury/debit_reversal_service.rb +104 -0
  345. data/lib/stripe/services/treasury/financial_account_features_service.rb +196 -0
  346. data/lib/stripe/services/treasury/financial_account_service.rb +554 -0
  347. data/lib/stripe/services/treasury/inbound_transfer_service.rb +140 -0
  348. data/lib/stripe/services/treasury/outbound_payment_service.rb +310 -0
  349. data/lib/stripe/services/treasury/outbound_transfer_service.rb +176 -0
  350. data/lib/stripe/services/treasury/received_credit_service.rb +82 -0
  351. data/lib/stripe/services/treasury/received_debit_service.rb +70 -0
  352. data/lib/stripe/services/treasury/transaction_entry_service.rb +117 -0
  353. data/lib/stripe/services/treasury/transaction_service.rb +125 -0
  354. data/lib/stripe/services/treasury_service.rb +22 -0
  355. data/lib/stripe/services/v1_services.rb +90 -0
  356. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +44 -0
  357. data/lib/stripe/services/v2/billing/meter_event_service.rb +46 -0
  358. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +23 -0
  359. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +56 -0
  360. data/lib/stripe/services/v2/billing_service.rb +18 -0
  361. data/lib/stripe/services/v2/core/event_destination_service.rb +235 -0
  362. data/lib/stripe/services/v2/core/event_service.rb +48 -0
  363. data/lib/stripe/services/v2/core_service.rb +16 -0
  364. data/lib/stripe/services/v2_services.rb +14 -0
  365. data/lib/stripe/services/webhook_endpoint_service.rb +156 -0
  366. data/lib/stripe/services.rb +180 -0
  367. data/lib/stripe/singleton_api_resource.rb +3 -3
  368. data/lib/stripe/stripe_client.rb +56 -1021
  369. data/lib/stripe/stripe_configuration.rb +63 -42
  370. data/lib/stripe/stripe_object.rb +75 -39
  371. data/lib/stripe/stripe_response.rb +1 -3
  372. data/lib/stripe/stripe_service.rb +32 -0
  373. data/lib/stripe/thin_event.rb +37 -0
  374. data/lib/stripe/util.rb +161 -39
  375. data/lib/stripe/v2_list_object.rb +84 -0
  376. data/lib/stripe/version.rb +1 -1
  377. data/lib/stripe/webhook.rb +3 -2
  378. data/lib/stripe.rb +44 -1
  379. data/rbi/stripe/resources/account.rbi +4926 -0
  380. data/rbi/stripe/resources/account_link.rbi +74 -0
  381. data/rbi/stripe/resources/account_session.rbi +1013 -0
  382. data/rbi/stripe/resources/apple_pay_domain.rbi +88 -0
  383. data/rbi/stripe/resources/application.rbi +20 -0
  384. data/rbi/stripe/resources/application_fee.rbi +118 -0
  385. data/rbi/stripe/resources/application_fee_refund.rbi +37 -0
  386. data/rbi/stripe/resources/apps/secret.rbi +195 -0
  387. data/rbi/stripe/resources/balance.rbi +235 -0
  388. data/rbi/stripe/resources/balance_transaction.rbi +147 -0
  389. data/rbi/stripe/resources/bank_account.rbi +127 -0
  390. data/rbi/stripe/resources/billing/alert.rbi +201 -0
  391. data/rbi/stripe/resources/billing/alert_triggered.rbi +28 -0
  392. data/rbi/stripe/resources/billing/credit_balance_summary.rbi +63 -0
  393. data/rbi/stripe/resources/billing/credit_balance_transaction.rbi +147 -0
  394. data/rbi/stripe/resources/billing/credit_grant.rbi +291 -0
  395. data/rbi/stripe/resources/billing/meter.rbi +226 -0
  396. data/rbi/stripe/resources/billing/meter_event.rbi +64 -0
  397. data/rbi/stripe/resources/billing/meter_event_adjustment.rbi +64 -0
  398. data/rbi/stripe/resources/billing/meter_event_summary.rbi +35 -0
  399. data/rbi/stripe/resources/billing_portal/configuration.rbi +645 -0
  400. data/rbi/stripe/resources/billing_portal/session.rbi +345 -0
  401. data/rbi/stripe/resources/capability.rbi +125 -0
  402. data/rbi/stripe/resources/card.rbi +125 -0
  403. data/rbi/stripe/resources/cash_balance.rbi +32 -0
  404. data/rbi/stripe/resources/charge.rbi +2069 -0
  405. data/rbi/stripe/resources/checkout/session.rbi +4004 -0
  406. data/rbi/stripe/resources/climate/order.rbi +245 -0
  407. data/rbi/stripe/resources/climate/product.rbi +75 -0
  408. data/rbi/stripe/resources/climate/supplier.rbi +72 -0
  409. data/rbi/stripe/resources/confirmation_token.rbi +1807 -0
  410. data/rbi/stripe/resources/connect_collection_transfer.rbi +26 -0
  411. data/rbi/stripe/resources/country_spec.rbi +85 -0
  412. data/rbi/stripe/resources/coupon.rbi +250 -0
  413. data/rbi/stripe/resources/credit_note.rbi +752 -0
  414. data/rbi/stripe/resources/credit_note_line_item.rbi +101 -0
  415. data/rbi/stripe/resources/customer.rbi +1005 -0
  416. data/rbi/stripe/resources/customer_balance_transaction.rbi +56 -0
  417. data/rbi/stripe/resources/customer_cash_balance_transaction.rbi +151 -0
  418. data/rbi/stripe/resources/customer_session.rbi +200 -0
  419. data/rbi/stripe/resources/discount.rbi +53 -0
  420. data/rbi/stripe/resources/dispute.rbi +761 -0
  421. data/rbi/stripe/resources/entitlements/active_entitlement.rbi +58 -0
  422. data/rbi/stripe/resources/entitlements/active_entitlement_summary.rbi +23 -0
  423. data/rbi/stripe/resources/entitlements/feature.rbi +117 -0
  424. data/rbi/stripe/resources/ephemeral_key.rbi +44 -0
  425. data/rbi/stripe/resources/event.rbi +149 -0
  426. data/rbi/stripe/resources/exchange_rate.rbi +66 -0
  427. data/rbi/stripe/resources/file.rbi +143 -0
  428. data/rbi/stripe/resources/file_link.rbi +141 -0
  429. data/rbi/stripe/resources/financial_connections/account.rbi +339 -0
  430. data/rbi/stripe/resources/financial_connections/account_owner.rbi +35 -0
  431. data/rbi/stripe/resources/financial_connections/account_ownership.rbi +23 -0
  432. data/rbi/stripe/resources/financial_connections/session.rbi +123 -0
  433. data/rbi/stripe/resources/financial_connections/transaction.rbi +124 -0
  434. data/rbi/stripe/resources/forwarding/request.rbi +216 -0
  435. data/rbi/stripe/resources/funding_instructions.rbi +437 -0
  436. data/rbi/stripe/resources/identity/verification_report.rbi +360 -0
  437. data/rbi/stripe/resources/identity/verification_session.rbi +526 -0
  438. data/rbi/stripe/resources/invoice.rbi +3812 -0
  439. data/rbi/stripe/resources/invoice_item.rbi +473 -0
  440. data/rbi/stripe/resources/invoice_line_item.rbi +432 -0
  441. data/rbi/stripe/resources/invoice_payment.rbi +121 -0
  442. data/rbi/stripe/resources/invoice_rendering_template.rbi +104 -0
  443. data/rbi/stripe/resources/issuing/authorization.rbi +1283 -0
  444. data/rbi/stripe/resources/issuing/card.rbi +741 -0
  445. data/rbi/stripe/resources/issuing/cardholder.rbi +744 -0
  446. data/rbi/stripe/resources/issuing/dispute.rbi +913 -0
  447. data/rbi/stripe/resources/issuing/personalization_design.rbi +338 -0
  448. data/rbi/stripe/resources/issuing/physical_bundle.rbi +79 -0
  449. data/rbi/stripe/resources/issuing/token.rbi +226 -0
  450. data/rbi/stripe/resources/issuing/transaction.rbi +1061 -0
  451. data/rbi/stripe/resources/line_item.rbi +72 -0
  452. data/rbi/stripe/resources/login_link.rbi +19 -0
  453. data/rbi/stripe/resources/mandate.rbi +187 -0
  454. data/rbi/stripe/resources/payment_intent.rbi +9647 -0
  455. data/rbi/stripe/resources/payment_link.rbi +1801 -0
  456. data/rbi/stripe/resources/payment_method.rbi +1761 -0
  457. data/rbi/stripe/resources/payment_method_configuration.rbi +3550 -0
  458. data/rbi/stripe/resources/payment_method_domain.rbi +228 -0
  459. data/rbi/stripe/resources/payout.rbi +300 -0
  460. data/rbi/stripe/resources/person.rbi +401 -0
  461. data/rbi/stripe/resources/plan.rbi +371 -0
  462. data/rbi/stripe/resources/price.rbi +694 -0
  463. data/rbi/stripe/resources/product.rbi +555 -0
  464. data/rbi/stripe/resources/product_feature.rbi +26 -0
  465. data/rbi/stripe/resources/promotion_code.rbi +261 -0
  466. data/rbi/stripe/resources/quote.rbi +1126 -0
  467. data/rbi/stripe/resources/radar/early_fraud_warning.rbi +98 -0
  468. data/rbi/stripe/resources/radar/value_list.rbi +168 -0
  469. data/rbi/stripe/resources/radar/value_list_item.rbi +129 -0
  470. data/rbi/stripe/resources/refund.rbi +523 -0
  471. data/rbi/stripe/resources/reporting/report_run.rbi +191 -0
  472. data/rbi/stripe/resources/reporting/report_type.rbi +57 -0
  473. data/rbi/stripe/resources/reserve_transaction.rbi +23 -0
  474. data/rbi/stripe/resources/reversal.rbi +51 -0
  475. data/rbi/stripe/resources/review.rbi +154 -0
  476. data/rbi/stripe/resources/setup_attempt.rbi +477 -0
  477. data/rbi/stripe/resources/setup_intent.rbi +3655 -0
  478. data/rbi/stripe/resources/shipping_rate.rbi +305 -0
  479. data/rbi/stripe/resources/sigma/scheduled_query_run.rbi +75 -0
  480. data/rbi/stripe/resources/source.rbi +1496 -0
  481. data/rbi/stripe/resources/source_mandate_notification.rbi +77 -0
  482. data/rbi/stripe/resources/source_transaction.rbi +127 -0
  483. data/rbi/stripe/resources/subscription.rbi +2027 -0
  484. data/rbi/stripe/resources/subscription_item.rbi +404 -0
  485. data/rbi/stripe/resources/subscription_schedule.rbi +1623 -0
  486. data/rbi/stripe/resources/tax/calculation.rbi +478 -0
  487. data/rbi/stripe/resources/tax/calculation_line_item.rbi +91 -0
  488. data/rbi/stripe/resources/tax/registration.rbi +2713 -0
  489. data/rbi/stripe/resources/tax/settings.rbi +141 -0
  490. data/rbi/stripe/resources/tax/transaction.rbi +351 -0
  491. data/rbi/stripe/resources/tax/transaction_line_item.rbi +54 -0
  492. data/rbi/stripe/resources/tax_code.rbi +44 -0
  493. data/rbi/stripe/resources/tax_deducted_at_source.rbi +23 -0
  494. data/rbi/stripe/resources/tax_id.rbi +165 -0
  495. data/rbi/stripe/resources/tax_rate.rbi +239 -0
  496. data/rbi/stripe/resources/terminal/configuration.rbi +1386 -0
  497. data/rbi/stripe/resources/terminal/connection_token.rbi +37 -0
  498. data/rbi/stripe/resources/terminal/location.rbi +222 -0
  499. data/rbi/stripe/resources/terminal/reader.rbi +847 -0
  500. data/rbi/stripe/resources/test_helpers/test_clock.rbi +132 -0
  501. data/rbi/stripe/resources/token.rbi +1283 -0
  502. data/rbi/stripe/resources/topup.rbi +222 -0
  503. data/rbi/stripe/resources/transfer.rbi +199 -0
  504. data/rbi/stripe/resources/treasury/credit_reversal.rbi +119 -0
  505. data/rbi/stripe/resources/treasury/debit_reversal.rbi +131 -0
  506. data/rbi/stripe/resources/treasury/financial_account.rbi +865 -0
  507. data/rbi/stripe/resources/treasury/financial_account_features.rbi +260 -0
  508. data/rbi/stripe/resources/treasury/inbound_transfer.rbi +295 -0
  509. data/rbi/stripe/resources/treasury/outbound_payment.rbi +592 -0
  510. data/rbi/stripe/resources/treasury/outbound_transfer.rbi +431 -0
  511. data/rbi/stripe/resources/treasury/received_credit.rbi +302 -0
  512. data/rbi/stripe/resources/treasury/received_debit.rbi +256 -0
  513. data/rbi/stripe/resources/treasury/transaction.rbi +215 -0
  514. data/rbi/stripe/resources/treasury/transaction_entry.rbi +192 -0
  515. data/rbi/stripe/resources/v2/amount.rbi +14 -0
  516. data/rbi/stripe/resources/v2/billing/meter_event.rbi +37 -0
  517. data/rbi/stripe/resources/v2/billing/meter_event_adjustment.rbi +41 -0
  518. data/rbi/stripe/resources/v2/billing/meter_event_session.rbi +31 -0
  519. data/rbi/stripe/resources/v2/event.rbi +48 -0
  520. data/rbi/stripe/resources/v2/event_destination.rbi +91 -0
  521. data/rbi/stripe/resources/webhook_endpoint.rbi +168 -0
  522. data/rbi/stripe/services/account_capability_service.rbi +51 -0
  523. data/rbi/stripe/services/account_external_account_service.rbi +304 -0
  524. data/rbi/stripe/services/account_link_service.rbi +58 -0
  525. data/rbi/stripe/services/account_login_link_service.rbi +22 -0
  526. data/rbi/stripe/services/account_person_service.rbi +1011 -0
  527. data/rbi/stripe/services/account_service.rbi +4213 -0
  528. data/rbi/stripe/services/account_session_service.rbi +646 -0
  529. data/rbi/stripe/services/apple_pay_domain_service.rbi +76 -0
  530. data/rbi/stripe/services/application_fee_refund_service.rbi +93 -0
  531. data/rbi/stripe/services/application_fee_service.rbi +78 -0
  532. data/rbi/stripe/services/apps/secret_service.rbi +151 -0
  533. data/{lib/stripe/resources/usage_record_summary.rb → rbi/stripe/services/apps_service.rbi} +4 -3
  534. data/rbi/stripe/services/balance_service.rbi +21 -0
  535. data/rbi/stripe/services/balance_transaction_service.rbi +93 -0
  536. data/rbi/stripe/services/billing/alert_service.rbi +152 -0
  537. data/rbi/stripe/services/billing/credit_balance_summary_service.rbi +68 -0
  538. data/rbi/stripe/services/billing/credit_balance_transaction_service.rbi +59 -0
  539. data/rbi/stripe/services/billing/credit_grant_service.rbi +211 -0
  540. data/rbi/stripe/services/billing/meter_event_adjustment_service.rbi +42 -0
  541. data/rbi/stripe/services/billing/meter_event_service.rbi +42 -0
  542. data/rbi/stripe/services/billing/meter_event_summary_service.rbi +54 -0
  543. data/rbi/stripe/services/billing/meter_service.rbi +163 -0
  544. data/rbi/stripe/services/billing_portal/configuration_service.rbi +511 -0
  545. data/rbi/stripe/services/billing_portal/session_service.rbi +204 -0
  546. data/rbi/stripe/services/billing_portal_service.rbi +10 -0
  547. data/rbi/stripe/services/billing_service.rbi +15 -0
  548. data/rbi/stripe/services/charge_service.rbi +448 -0
  549. data/rbi/stripe/services/checkout/session_line_item_service.rbi +33 -0
  550. data/rbi/stripe/services/checkout/session_service.rbi +2614 -0
  551. data/rbi/stripe/services/checkout_service.rbi +9 -0
  552. data/rbi/stripe/services/climate/order_service.rbi +142 -0
  553. data/rbi/stripe/services/climate/product_service.rbi +46 -0
  554. data/rbi/stripe/services/climate/supplier_service.rbi +46 -0
  555. data/rbi/stripe/services/climate_service.rbi +11 -0
  556. data/rbi/stripe/services/confirmation_token_service.rbi +20 -0
  557. data/rbi/stripe/services/country_spec_service.rbi +44 -0
  558. data/rbi/stripe/services/coupon_service.rbi +194 -0
  559. data/rbi/stripe/services/credit_note_line_item_service.rbi +31 -0
  560. data/rbi/stripe/services/credit_note_preview_lines_service.rbi +167 -0
  561. data/rbi/stripe/services/credit_note_service.rbi +415 -0
  562. data/rbi/stripe/services/customer_balance_transaction_service.rbi +92 -0
  563. data/rbi/stripe/services/customer_cash_balance_service.rbi +45 -0
  564. data/rbi/stripe/services/customer_cash_balance_transaction_service.rbi +44 -0
  565. data/rbi/stripe/services/customer_funding_instructions_service.rbi +59 -0
  566. data/rbi/stripe/services/customer_payment_method_service.rbi +57 -0
  567. data/rbi/stripe/services/customer_payment_source_service.rbi +232 -0
  568. data/rbi/stripe/services/customer_service.rbi +647 -0
  569. data/rbi/stripe/services/customer_session_service.rbi +116 -0
  570. data/rbi/stripe/services/customer_tax_id_service.rbi +70 -0
  571. data/rbi/stripe/services/dispute_service.rbi +424 -0
  572. data/rbi/stripe/services/entitlements/active_entitlement_service.rbi +55 -0
  573. data/rbi/stripe/services/entitlements/feature_service.rbi +107 -0
  574. data/rbi/stripe/services/entitlements_service.rbi +10 -0
  575. data/rbi/stripe/services/ephemeral_key_service.rbi +53 -0
  576. data/rbi/stripe/services/event_service.rbi +83 -0
  577. data/rbi/stripe/services/exchange_rate_service.rbi +44 -0
  578. data/rbi/stripe/services/file_link_service.rbi +124 -0
  579. data/rbi/stripe/services/file_service.rbi +116 -0
  580. data/rbi/stripe/services/financial_connections/account_owner_service.rbi +42 -0
  581. data/rbi/stripe/services/financial_connections/account_service.rbi +133 -0
  582. data/rbi/stripe/services/financial_connections/session_service.rbi +88 -0
  583. data/rbi/stripe/services/financial_connections/transaction_service.rbi +92 -0
  584. data/rbi/stripe/services/financial_connections_service.rbi +11 -0
  585. data/rbi/stripe/services/forwarding/request_service.rbi +134 -0
  586. data/rbi/stripe/services/forwarding_service.rbi +9 -0
  587. data/rbi/stripe/services/identity/verification_report_service.rbi +87 -0
  588. data/rbi/stripe/services/identity/verification_session_service.rbi +323 -0
  589. data/rbi/stripe/services/identity_service.rbi +10 -0
  590. data/rbi/stripe/services/invoice_item_service.rbi +366 -0
  591. data/rbi/stripe/services/invoice_line_item_service.rbi +259 -0
  592. data/rbi/stripe/services/invoice_payment_service.rbi +71 -0
  593. data/rbi/stripe/services/invoice_rendering_template_service.rbi +82 -0
  594. data/rbi/stripe/services/invoice_service.rbi +2981 -0
  595. data/rbi/stripe/services/issuing/authorization_service.rbi +146 -0
  596. data/rbi/stripe/services/issuing/card_service.rbi +495 -0
  597. data/rbi/stripe/services/issuing/cardholder_service.rbi +587 -0
  598. data/rbi/stripe/services/issuing/dispute_service.rbi +707 -0
  599. data/rbi/stripe/services/issuing/personalization_design_service.rbi +243 -0
  600. data/rbi/stripe/services/issuing/physical_bundle_service.rbi +59 -0
  601. data/rbi/stripe/services/issuing/token_service.rbi +99 -0
  602. data/rbi/stripe/services/issuing/transaction_service.rbi +105 -0
  603. data/rbi/stripe/services/issuing_service.rbi +16 -0
  604. data/rbi/stripe/services/mandate_service.rbi +20 -0
  605. data/rbi/stripe/services/payment_intent_service.rbi +7659 -0
  606. data/rbi/stripe/services/payment_link_line_item_service.rbi +31 -0
  607. data/rbi/stripe/services/payment_link_service.rbi +1352 -0
  608. data/rbi/stripe/services/payment_method_configuration_service.rbi +2487 -0
  609. data/rbi/stripe/services/payment_method_domain_service.rbi +112 -0
  610. data/rbi/stripe/services/payment_method_service.rbi +776 -0
  611. data/rbi/stripe/services/payout_service.rbi +205 -0
  612. data/rbi/stripe/services/plan_service.rbi +282 -0
  613. data/rbi/stripe/services/price_service.rbi +546 -0
  614. data/rbi/stripe/services/product_feature_service.rbi +67 -0
  615. data/rbi/stripe/services/product_service.rbi +477 -0
  616. data/rbi/stripe/services/promotion_code_service.rbi +214 -0
  617. data/rbi/stripe/services/quote_computed_upfront_line_items_service.rbi +31 -0
  618. data/rbi/stripe/services/quote_line_item_service.rbi +31 -0
  619. data/rbi/stripe/services/quote_service.rbi +686 -0
  620. data/rbi/stripe/services/radar/early_fraud_warning_service.rbi +85 -0
  621. data/rbi/stripe/services/radar/value_list_item_service.rbi +109 -0
  622. data/rbi/stripe/services/radar/value_list_service.rbi +141 -0
  623. data/rbi/stripe/services/radar_service.rbi +11 -0
  624. data/rbi/stripe/services/refund_service.rbi +185 -0
  625. data/rbi/stripe/services/reporting/report_run_service.rbi +135 -0
  626. data/rbi/stripe/services/reporting/report_type_service.rbi +35 -0
  627. data/rbi/stripe/services/reporting_service.rbi +10 -0
  628. data/rbi/stripe/services/review_service.rbi +84 -0
  629. data/rbi/stripe/services/setup_attempt_service.rbi +65 -0
  630. data/rbi/stripe/services/setup_intent_service.rbi +3391 -0
  631. data/rbi/stripe/services/shipping_rate_service.rbi +241 -0
  632. data/rbi/stripe/services/sigma/scheduled_query_run_service.rbi +46 -0
  633. data/rbi/stripe/services/sigma_service.rbi +9 -0
  634. data/rbi/stripe/services/source_service.rbi +663 -0
  635. data/rbi/stripe/services/source_transaction_service.rbi +31 -0
  636. data/rbi/stripe/services/subscription_item_service.rbi +350 -0
  637. data/rbi/stripe/services/subscription_schedule_service.rbi +1290 -0
  638. data/rbi/stripe/services/subscription_service.rbi +1648 -0
  639. data/rbi/stripe/services/tax/calculation_line_item_service.rbi +33 -0
  640. data/rbi/stripe/services/tax/calculation_service.rbi +234 -0
  641. data/rbi/stripe/services/tax/registration_service.rbi +1845 -0
  642. data/rbi/stripe/services/tax/settings_service.rbi +93 -0
  643. data/rbi/stripe/services/tax/transaction_line_item_service.rbi +33 -0
  644. data/rbi/stripe/services/tax/transaction_service.rbi +146 -0
  645. data/rbi/stripe/services/tax_code_service.rbi +44 -0
  646. data/rbi/stripe/services/tax_id_service.rbi +110 -0
  647. data/rbi/stripe/services/tax_rate_service.rbi +185 -0
  648. data/rbi/stripe/services/tax_service.rbi +12 -0
  649. data/rbi/stripe/services/terminal/configuration_service.rbi +1118 -0
  650. data/rbi/stripe/services/terminal/connection_token_service.rbi +25 -0
  651. data/rbi/stripe/services/terminal/location_service.rbi +182 -0
  652. data/rbi/stripe/services/terminal/reader_service.rbi +455 -0
  653. data/rbi/stripe/services/terminal_service.rbi +12 -0
  654. data/rbi/stripe/services/test_helpers/confirmation_token_service.rbi +739 -0
  655. data/rbi/stripe/services/test_helpers/customer_service.rbi +33 -0
  656. data/rbi/stripe/services/test_helpers/issuing/authorization_service.rbi +848 -0
  657. data/rbi/stripe/services/test_helpers/issuing/card_service.rbi +76 -0
  658. data/rbi/stripe/services/test_helpers/issuing/personalization_design_service.rbi +69 -0
  659. data/rbi/stripe/services/test_helpers/issuing/transaction_service.rbi +711 -0
  660. data/rbi/stripe/services/test_helpers/issuing_service.rbi +14 -0
  661. data/rbi/stripe/services/test_helpers/refund_service.rbi +22 -0
  662. data/rbi/stripe/services/test_helpers/terminal/reader_service.rbi +93 -0
  663. data/rbi/stripe/services/test_helpers/terminal_service.rbi +11 -0
  664. data/rbi/stripe/services/test_helpers/test_clock_service.rbi +90 -0
  665. data/rbi/stripe/services/test_helpers/treasury/inbound_transfer_service.rbi +64 -0
  666. data/rbi/stripe/services/test_helpers/treasury/outbound_payment_service.rbi +125 -0
  667. data/rbi/stripe/services/test_helpers/treasury/outbound_transfer_service.rbi +125 -0
  668. data/rbi/stripe/services/test_helpers/treasury/received_credit_service.rbi +87 -0
  669. data/rbi/stripe/services/test_helpers/treasury/received_debit_service.rbi +87 -0
  670. data/rbi/stripe/services/test_helpers/treasury_service.rbi +15 -0
  671. data/rbi/stripe/services/test_helpers_service.rbi +15 -0
  672. data/rbi/stripe/services/token_service.rbi +1257 -0
  673. data/rbi/stripe/services/topup_service.rbi +176 -0
  674. data/rbi/stripe/services/transfer_reversal_service.rbi +101 -0
  675. data/rbi/stripe/services/transfer_service.rbi +152 -0
  676. data/rbi/stripe/services/treasury/credit_reversal_service.rbi +84 -0
  677. data/rbi/stripe/services/treasury/debit_reversal_service.rbi +88 -0
  678. data/rbi/stripe/services/treasury/financial_account_features_service.rbi +198 -0
  679. data/rbi/stripe/services/treasury/financial_account_service.rbi +562 -0
  680. data/rbi/stripe/services/treasury/inbound_transfer_service.rbi +117 -0
  681. data/rbi/stripe/services/treasury/outbound_payment_service.rbi +304 -0
  682. data/rbi/stripe/services/treasury/outbound_transfer_service.rbi +157 -0
  683. data/rbi/stripe/services/treasury/received_credit_service.rbi +72 -0
  684. data/rbi/stripe/services/treasury/received_debit_service.rbi +59 -0
  685. data/rbi/stripe/services/treasury/transaction_entry_service.rbi +111 -0
  686. data/rbi/stripe/services/treasury/transaction_service.rbi +122 -0
  687. data/rbi/stripe/services/treasury_service.rbi +18 -0
  688. data/rbi/stripe/services/v1_services.rbi +77 -0
  689. data/rbi/stripe/services/v2/billing/meter_event_adjustment_service.rbi +39 -0
  690. data/rbi/stripe/services/v2/billing/meter_event_service.rbi +42 -0
  691. data/rbi/stripe/services/v2/billing/meter_event_session_service.rbi +18 -0
  692. data/rbi/stripe/services/v2/billing/meter_event_stream_service.rbi +55 -0
  693. data/rbi/stripe/services/v2/billing_service.rbi +14 -0
  694. data/rbi/stripe/services/v2/core/event_destination_service.rbi +192 -0
  695. data/rbi/stripe/services/v2/core/event_service.rbi +36 -0
  696. data/rbi/stripe/services/v2/core_service.rbi +12 -0
  697. data/rbi/stripe/services/v2_services.rbi +10 -0
  698. data/rbi/stripe/services/webhook_endpoint_service.rbi +129 -0
  699. data/stripe.gemspec +10 -7
  700. metadata +599 -18
  701. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  702. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  703. data/lib/stripe/resources/issuing/card_details.rb +0 -9
  704. data/lib/stripe/resources/order.rb +0 -33
  705. data/lib/stripe/resources/order_return.rb +0 -10
  706. data/lib/stripe/resources/recipient.rb +0 -14
  707. data/lib/stripe/resources/sku.rb +0 -13
  708. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -2,29 +2,1480 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.
6
+ #
7
+ # Related guide: [Subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules)
5
8
  class SubscriptionSchedule < APIResource
6
9
  extend Stripe::APIOperations::Create
7
10
  extend Stripe::APIOperations::List
8
11
  include Stripe::APIOperations::Save
9
12
 
10
13
  OBJECT_NAME = "subscription_schedule"
14
+ def self.object_name
15
+ "subscription_schedule"
16
+ end
17
+
18
+ class CurrentPhase < Stripe::StripeObject
19
+ # The end of this phase of the subscription schedule.
20
+ attr_reader :end_date
21
+ # The start of this phase of the subscription schedule.
22
+ attr_reader :start_date
23
+ end
24
+
25
+ class DefaultSettings < Stripe::StripeObject
26
+ class AutomaticTax < Stripe::StripeObject
27
+ class Liability < Stripe::StripeObject
28
+ # The connected account being referenced when `type` is `account`.
29
+ attr_reader :account
30
+ # Type of the account referenced.
31
+ attr_reader :type
32
+ end
33
+ # If Stripe disabled automatic tax, this enum describes why.
34
+ attr_reader :disabled_reason
35
+ # Whether Stripe automatically computes tax on invoices created during this phase.
36
+ attr_reader :enabled
37
+ # The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
38
+ attr_reader :liability
39
+ end
40
+
41
+ class BillingThresholds < Stripe::StripeObject
42
+ # Monetary threshold that triggers the subscription to create an invoice
43
+ attr_reader :amount_gte
44
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`.
45
+ attr_reader :reset_billing_cycle_anchor
46
+ end
47
+
48
+ class InvoiceSettings < Stripe::StripeObject
49
+ class Issuer < Stripe::StripeObject
50
+ # The connected account being referenced when `type` is `account`.
51
+ attr_reader :account
52
+ # Type of the account referenced.
53
+ attr_reader :type
54
+ end
55
+ # The account tax IDs associated with the subscription schedule. Will be set on invoices generated by the subscription schedule.
56
+ attr_reader :account_tax_ids
57
+ # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
58
+ attr_reader :days_until_due
59
+ # Attribute for field issuer
60
+ attr_reader :issuer
61
+ end
62
+
63
+ class TransferData < Stripe::StripeObject
64
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
65
+ attr_reader :amount_percent
66
+ # The account where funds from the payment will be transferred to upon payment success.
67
+ attr_reader :destination
68
+ end
69
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule.
70
+ attr_reader :application_fee_percent
71
+ # Attribute for field automatic_tax
72
+ attr_reader :automatic_tax
73
+ # Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
74
+ attr_reader :billing_cycle_anchor
75
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
76
+ attr_reader :billing_thresholds
77
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
78
+ attr_reader :collection_method
79
+ # ID of the default payment method for the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
80
+ attr_reader :default_payment_method
81
+ # Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
82
+ attr_reader :description
83
+ # Attribute for field invoice_settings
84
+ attr_reader :invoice_settings
85
+ # The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription. See the Connect documentation for details.
86
+ attr_reader :on_behalf_of
87
+ # The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
88
+ attr_reader :transfer_data
89
+ end
90
+
91
+ class Phase < Stripe::StripeObject
92
+ class AddInvoiceItem < Stripe::StripeObject
93
+ class Discount < Stripe::StripeObject
94
+ # ID of the coupon to create a new discount for.
95
+ attr_reader :coupon
96
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
97
+ attr_reader :discount
98
+ # ID of the promotion code to create a new discount for.
99
+ attr_reader :promotion_code
100
+ end
101
+ # The stackable discounts that will be applied to the item.
102
+ attr_reader :discounts
103
+ # ID of the price used to generate the invoice item.
104
+ attr_reader :price
105
+ # The quantity of the invoice item.
106
+ attr_reader :quantity
107
+ # The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
108
+ attr_reader :tax_rates
109
+ end
110
+
111
+ class AutomaticTax < Stripe::StripeObject
112
+ class Liability < Stripe::StripeObject
113
+ # The connected account being referenced when `type` is `account`.
114
+ attr_reader :account
115
+ # Type of the account referenced.
116
+ attr_reader :type
117
+ end
118
+ # If Stripe disabled automatic tax, this enum describes why.
119
+ attr_reader :disabled_reason
120
+ # Whether Stripe automatically computes tax on invoices created during this phase.
121
+ attr_reader :enabled
122
+ # The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
123
+ attr_reader :liability
124
+ end
125
+
126
+ class BillingThresholds < Stripe::StripeObject
127
+ # Monetary threshold that triggers the subscription to create an invoice
128
+ attr_reader :amount_gte
129
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`.
130
+ attr_reader :reset_billing_cycle_anchor
131
+ end
132
+
133
+ class Discount < Stripe::StripeObject
134
+ # ID of the coupon to create a new discount for.
135
+ attr_reader :coupon
136
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
137
+ attr_reader :discount
138
+ # ID of the promotion code to create a new discount for.
139
+ attr_reader :promotion_code
140
+ end
141
+
142
+ class InvoiceSettings < Stripe::StripeObject
143
+ class Issuer < Stripe::StripeObject
144
+ # The connected account being referenced when `type` is `account`.
145
+ attr_reader :account
146
+ # Type of the account referenced.
147
+ attr_reader :type
148
+ end
149
+ # The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
150
+ attr_reader :account_tax_ids
151
+ # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
152
+ attr_reader :days_until_due
153
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
154
+ attr_reader :issuer
155
+ end
156
+
157
+ class Item < Stripe::StripeObject
158
+ class BillingThresholds < Stripe::StripeObject
159
+ # Usage threshold that triggers the subscription to create an invoice
160
+ attr_reader :usage_gte
161
+ end
162
+
163
+ class Discount < Stripe::StripeObject
164
+ # ID of the coupon to create a new discount for.
165
+ attr_reader :coupon
166
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
167
+ attr_reader :discount
168
+ # ID of the promotion code to create a new discount for.
169
+ attr_reader :promotion_code
170
+ end
171
+ # Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period
172
+ attr_reader :billing_thresholds
173
+ # The discounts applied to the subscription item. Subscription item discounts are applied before subscription discounts. Use `expand[]=discounts` to expand each discount.
174
+ attr_reader :discounts
175
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an item. Metadata on this item will update the underlying subscription item's `metadata` when the phase is entered.
176
+ attr_reader :metadata
177
+ # ID of the plan to which the customer should be subscribed.
178
+ attr_reader :plan
179
+ # ID of the price to which the customer should be subscribed.
180
+ attr_reader :price
181
+ # Quantity of the plan to which the customer should be subscribed.
182
+ attr_reader :quantity
183
+ # The tax rates which apply to this `phase_item`. When set, the `default_tax_rates` on the phase do not apply to this `phase_item`.
184
+ attr_reader :tax_rates
185
+ end
186
+
187
+ class TransferData < Stripe::StripeObject
188
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
189
+ attr_reader :amount_percent
190
+ # The account where funds from the payment will be transferred to upon payment success.
191
+ attr_reader :destination
192
+ end
193
+ # A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
194
+ attr_reader :add_invoice_items
195
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule.
196
+ attr_reader :application_fee_percent
197
+ # Attribute for field automatic_tax
198
+ attr_reader :automatic_tax
199
+ # Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
200
+ attr_reader :billing_cycle_anchor
201
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
202
+ attr_reader :billing_thresholds
203
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
204
+ attr_reader :collection_method
205
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
206
+ attr_reader :currency
207
+ # ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
208
+ attr_reader :default_payment_method
209
+ # The default tax rates to apply to the subscription during this phase of the subscription schedule.
210
+ attr_reader :default_tax_rates
211
+ # Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
212
+ attr_reader :description
213
+ # The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts.
214
+ attr_reader :discounts
215
+ # The end of this phase of the subscription schedule.
216
+ attr_reader :end_date
217
+ # The invoice settings applicable during this phase.
218
+ attr_reader :invoice_settings
219
+ # Subscription items to configure the subscription to during this phase of the subscription schedule.
220
+ attr_reader :items
221
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered. Updating the underlying subscription's `metadata` directly will not affect the current phase's `metadata`.
222
+ attr_reader :metadata
223
+ # The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription. See the Connect documentation for details.
224
+ attr_reader :on_behalf_of
225
+ # When transitioning phases, controls how prorations are handled (if any). Possible values are `create_prorations`, `none`, and `always_invoice`.
226
+ attr_reader :proration_behavior
227
+ # The start of this phase of the subscription schedule.
228
+ attr_reader :start_date
229
+ # The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
230
+ attr_reader :transfer_data
231
+ # When the trial ends within the phase.
232
+ attr_reader :trial_end
233
+ end
234
+
235
+ class ListParams < Stripe::RequestParams
236
+ class CanceledAt < Stripe::RequestParams
237
+ # Minimum value to filter by (exclusive)
238
+ attr_accessor :gt
239
+ # Minimum value to filter by (inclusive)
240
+ attr_accessor :gte
241
+ # Maximum value to filter by (exclusive)
242
+ attr_accessor :lt
243
+ # Maximum value to filter by (inclusive)
244
+ attr_accessor :lte
245
+
246
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
247
+ @gt = gt
248
+ @gte = gte
249
+ @lt = lt
250
+ @lte = lte
251
+ end
252
+ end
253
+
254
+ class CompletedAt < Stripe::RequestParams
255
+ # Minimum value to filter by (exclusive)
256
+ attr_accessor :gt
257
+ # Minimum value to filter by (inclusive)
258
+ attr_accessor :gte
259
+ # Maximum value to filter by (exclusive)
260
+ attr_accessor :lt
261
+ # Maximum value to filter by (inclusive)
262
+ attr_accessor :lte
263
+
264
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
265
+ @gt = gt
266
+ @gte = gte
267
+ @lt = lt
268
+ @lte = lte
269
+ end
270
+ end
271
+
272
+ class Created < Stripe::RequestParams
273
+ # Minimum value to filter by (exclusive)
274
+ attr_accessor :gt
275
+ # Minimum value to filter by (inclusive)
276
+ attr_accessor :gte
277
+ # Maximum value to filter by (exclusive)
278
+ attr_accessor :lt
279
+ # Maximum value to filter by (inclusive)
280
+ attr_accessor :lte
281
+
282
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
283
+ @gt = gt
284
+ @gte = gte
285
+ @lt = lt
286
+ @lte = lte
287
+ end
288
+ end
289
+
290
+ class ReleasedAt < Stripe::RequestParams
291
+ # Minimum value to filter by (exclusive)
292
+ attr_accessor :gt
293
+ # Minimum value to filter by (inclusive)
294
+ attr_accessor :gte
295
+ # Maximum value to filter by (exclusive)
296
+ attr_accessor :lt
297
+ # Maximum value to filter by (inclusive)
298
+ attr_accessor :lte
299
+
300
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
301
+ @gt = gt
302
+ @gte = gte
303
+ @lt = lt
304
+ @lte = lte
305
+ end
306
+ end
307
+ # Only return subscription schedules that were created canceled the given date interval.
308
+ attr_accessor :canceled_at
309
+ # Only return subscription schedules that completed during the given date interval.
310
+ attr_accessor :completed_at
311
+ # Only return subscription schedules that were created during the given date interval.
312
+ attr_accessor :created
313
+ # Only return subscription schedules for the given customer.
314
+ attr_accessor :customer
315
+ # A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
316
+ attr_accessor :ending_before
317
+ # Specifies which fields in the response should be expanded.
318
+ attr_accessor :expand
319
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
320
+ attr_accessor :limit
321
+ # Only return subscription schedules that were released during the given date interval.
322
+ attr_accessor :released_at
323
+ # Only return subscription schedules that have not started yet.
324
+ attr_accessor :scheduled
325
+ # A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
326
+ attr_accessor :starting_after
327
+
328
+ def initialize(
329
+ canceled_at: nil,
330
+ completed_at: nil,
331
+ created: nil,
332
+ customer: nil,
333
+ ending_before: nil,
334
+ expand: nil,
335
+ limit: nil,
336
+ released_at: nil,
337
+ scheduled: nil,
338
+ starting_after: nil
339
+ )
340
+ @canceled_at = canceled_at
341
+ @completed_at = completed_at
342
+ @created = created
343
+ @customer = customer
344
+ @ending_before = ending_before
345
+ @expand = expand
346
+ @limit = limit
347
+ @released_at = released_at
348
+ @scheduled = scheduled
349
+ @starting_after = starting_after
350
+ end
351
+ end
352
+
353
+ class CreateParams < Stripe::RequestParams
354
+ class DefaultSettings < Stripe::RequestParams
355
+ class AutomaticTax < Stripe::RequestParams
356
+ class Liability < Stripe::RequestParams
357
+ # The connected account being referenced when `type` is `account`.
358
+ attr_accessor :account
359
+ # Type of the account referenced in the request.
360
+ attr_accessor :type
361
+
362
+ def initialize(account: nil, type: nil)
363
+ @account = account
364
+ @type = type
365
+ end
366
+ end
367
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
368
+ attr_accessor :enabled
369
+ # The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
370
+ attr_accessor :liability
371
+
372
+ def initialize(enabled: nil, liability: nil)
373
+ @enabled = enabled
374
+ @liability = liability
375
+ end
376
+ end
377
+
378
+ class BillingThresholds < Stripe::RequestParams
379
+ # Monetary threshold that triggers the subscription to advance to a new billing period
380
+ attr_accessor :amount_gte
381
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
382
+ attr_accessor :reset_billing_cycle_anchor
383
+
384
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
385
+ @amount_gte = amount_gte
386
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
387
+ end
388
+ end
389
+
390
+ class InvoiceSettings < Stripe::RequestParams
391
+ class Issuer < Stripe::RequestParams
392
+ # The connected account being referenced when `type` is `account`.
393
+ attr_accessor :account
394
+ # Type of the account referenced in the request.
395
+ attr_accessor :type
396
+
397
+ def initialize(account: nil, type: nil)
398
+ @account = account
399
+ @type = type
400
+ end
401
+ end
402
+ # The account tax IDs associated with the subscription schedule. Will be set on invoices generated by the subscription schedule.
403
+ attr_accessor :account_tax_ids
404
+ # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `collection_method=charge_automatically`.
405
+ attr_accessor :days_until_due
406
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
407
+ attr_accessor :issuer
408
+
409
+ def initialize(account_tax_ids: nil, days_until_due: nil, issuer: nil)
410
+ @account_tax_ids = account_tax_ids
411
+ @days_until_due = days_until_due
412
+ @issuer = issuer
413
+ end
414
+ end
415
+
416
+ class TransferData < Stripe::RequestParams
417
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
418
+ attr_accessor :amount_percent
419
+ # ID of an existing, connected Stripe account.
420
+ attr_accessor :destination
421
+
422
+ def initialize(amount_percent: nil, destination: nil)
423
+ @amount_percent = amount_percent
424
+ @destination = destination
425
+ end
426
+ end
427
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
428
+ attr_accessor :application_fee_percent
429
+ # Default settings for automatic tax computation.
430
+ attr_accessor :automatic_tax
431
+ # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
432
+ attr_accessor :billing_cycle_anchor
433
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
434
+ attr_accessor :billing_thresholds
435
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically` on creation.
436
+ attr_accessor :collection_method
437
+ # ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
438
+ attr_accessor :default_payment_method
439
+ # Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
440
+ attr_accessor :description
441
+ # All invoices will be billed using the specified settings.
442
+ attr_accessor :invoice_settings
443
+ # The account on behalf of which to charge, for each of the associated subscription's invoices.
444
+ attr_accessor :on_behalf_of
445
+ # The data with which to automatically create a Transfer for each of the associated subscription's invoices.
446
+ attr_accessor :transfer_data
447
+
448
+ def initialize(
449
+ application_fee_percent: nil,
450
+ automatic_tax: nil,
451
+ billing_cycle_anchor: nil,
452
+ billing_thresholds: nil,
453
+ collection_method: nil,
454
+ default_payment_method: nil,
455
+ description: nil,
456
+ invoice_settings: nil,
457
+ on_behalf_of: nil,
458
+ transfer_data: nil
459
+ )
460
+ @application_fee_percent = application_fee_percent
461
+ @automatic_tax = automatic_tax
462
+ @billing_cycle_anchor = billing_cycle_anchor
463
+ @billing_thresholds = billing_thresholds
464
+ @collection_method = collection_method
465
+ @default_payment_method = default_payment_method
466
+ @description = description
467
+ @invoice_settings = invoice_settings
468
+ @on_behalf_of = on_behalf_of
469
+ @transfer_data = transfer_data
470
+ end
471
+ end
472
+
473
+ class Phase < Stripe::RequestParams
474
+ class AddInvoiceItem < Stripe::RequestParams
475
+ class Discount < Stripe::RequestParams
476
+ # ID of the coupon to create a new discount for.
477
+ attr_accessor :coupon
478
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
479
+ attr_accessor :discount
480
+ # ID of the promotion code to create a new discount for.
481
+ attr_accessor :promotion_code
482
+
483
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
484
+ @coupon = coupon
485
+ @discount = discount
486
+ @promotion_code = promotion_code
487
+ end
488
+ end
489
+
490
+ class PriceData < Stripe::RequestParams
491
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
492
+ attr_accessor :currency
493
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
494
+ attr_accessor :product
495
+ # Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
496
+ attr_accessor :tax_behavior
497
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer.
498
+ attr_accessor :unit_amount
499
+ # Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
500
+ attr_accessor :unit_amount_decimal
501
+
502
+ def initialize(
503
+ currency: nil,
504
+ product: nil,
505
+ tax_behavior: nil,
506
+ unit_amount: nil,
507
+ unit_amount_decimal: nil
508
+ )
509
+ @currency = currency
510
+ @product = product
511
+ @tax_behavior = tax_behavior
512
+ @unit_amount = unit_amount
513
+ @unit_amount_decimal = unit_amount_decimal
514
+ end
515
+ end
516
+ # The coupons to redeem into discounts for the item.
517
+ attr_accessor :discounts
518
+ # The ID of the price object. One of `price` or `price_data` is required.
519
+ attr_accessor :price
520
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
521
+ attr_accessor :price_data
522
+ # Quantity for this item. Defaults to 1.
523
+ attr_accessor :quantity
524
+ # The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
525
+ attr_accessor :tax_rates
526
+
527
+ def initialize(discounts: nil, price: nil, price_data: nil, quantity: nil, tax_rates: nil)
528
+ @discounts = discounts
529
+ @price = price
530
+ @price_data = price_data
531
+ @quantity = quantity
532
+ @tax_rates = tax_rates
533
+ end
534
+ end
535
+
536
+ class AutomaticTax < Stripe::RequestParams
537
+ class Liability < Stripe::RequestParams
538
+ # The connected account being referenced when `type` is `account`.
539
+ attr_accessor :account
540
+ # Type of the account referenced in the request.
541
+ attr_accessor :type
542
+
543
+ def initialize(account: nil, type: nil)
544
+ @account = account
545
+ @type = type
546
+ end
547
+ end
548
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
549
+ attr_accessor :enabled
550
+ # The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
551
+ attr_accessor :liability
552
+
553
+ def initialize(enabled: nil, liability: nil)
554
+ @enabled = enabled
555
+ @liability = liability
556
+ end
557
+ end
558
+
559
+ class BillingThresholds < Stripe::RequestParams
560
+ # Monetary threshold that triggers the subscription to advance to a new billing period
561
+ attr_accessor :amount_gte
562
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
563
+ attr_accessor :reset_billing_cycle_anchor
564
+
565
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
566
+ @amount_gte = amount_gte
567
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
568
+ end
569
+ end
570
+
571
+ class Discount < Stripe::RequestParams
572
+ # ID of the coupon to create a new discount for.
573
+ attr_accessor :coupon
574
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
575
+ attr_accessor :discount
576
+ # ID of the promotion code to create a new discount for.
577
+ attr_accessor :promotion_code
578
+
579
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
580
+ @coupon = coupon
581
+ @discount = discount
582
+ @promotion_code = promotion_code
583
+ end
584
+ end
585
+
586
+ class InvoiceSettings < Stripe::RequestParams
587
+ class Issuer < Stripe::RequestParams
588
+ # The connected account being referenced when `type` is `account`.
589
+ attr_accessor :account
590
+ # Type of the account referenced in the request.
591
+ attr_accessor :type
592
+
593
+ def initialize(account: nil, type: nil)
594
+ @account = account
595
+ @type = type
596
+ end
597
+ end
598
+ # The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
599
+ attr_accessor :account_tax_ids
600
+ # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
601
+ attr_accessor :days_until_due
602
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
603
+ attr_accessor :issuer
604
+
605
+ def initialize(account_tax_ids: nil, days_until_due: nil, issuer: nil)
606
+ @account_tax_ids = account_tax_ids
607
+ @days_until_due = days_until_due
608
+ @issuer = issuer
609
+ end
610
+ end
611
+
612
+ class Item < Stripe::RequestParams
613
+ class BillingThresholds < Stripe::RequestParams
614
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
615
+ attr_accessor :usage_gte
616
+
617
+ def initialize(usage_gte: nil)
618
+ @usage_gte = usage_gte
619
+ end
620
+ end
621
+
622
+ class Discount < Stripe::RequestParams
623
+ # ID of the coupon to create a new discount for.
624
+ attr_accessor :coupon
625
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
626
+ attr_accessor :discount
627
+ # ID of the promotion code to create a new discount for.
628
+ attr_accessor :promotion_code
629
+
630
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
631
+ @coupon = coupon
632
+ @discount = discount
633
+ @promotion_code = promotion_code
634
+ end
635
+ end
636
+
637
+ class PriceData < Stripe::RequestParams
638
+ class Recurring < Stripe::RequestParams
639
+ # Specifies billing frequency. Either `day`, `week`, `month` or `year`.
640
+ attr_accessor :interval
641
+ # The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
642
+ attr_accessor :interval_count
643
+
644
+ def initialize(interval: nil, interval_count: nil)
645
+ @interval = interval
646
+ @interval_count = interval_count
647
+ end
648
+ end
649
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
650
+ attr_accessor :currency
651
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
652
+ attr_accessor :product
653
+ # The recurring components of a price such as `interval` and `interval_count`.
654
+ attr_accessor :recurring
655
+ # Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
656
+ attr_accessor :tax_behavior
657
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
658
+ attr_accessor :unit_amount
659
+ # Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
660
+ attr_accessor :unit_amount_decimal
661
+
662
+ def initialize(
663
+ currency: nil,
664
+ product: nil,
665
+ recurring: nil,
666
+ tax_behavior: nil,
667
+ unit_amount: nil,
668
+ unit_amount_decimal: nil
669
+ )
670
+ @currency = currency
671
+ @product = product
672
+ @recurring = recurring
673
+ @tax_behavior = tax_behavior
674
+ @unit_amount = unit_amount
675
+ @unit_amount_decimal = unit_amount_decimal
676
+ end
677
+ end
678
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
679
+ attr_accessor :billing_thresholds
680
+ # The coupons to redeem into discounts for the subscription item.
681
+ attr_accessor :discounts
682
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
683
+ attr_accessor :metadata
684
+ # The plan ID to subscribe to. You may specify the same ID in `plan` and `price`.
685
+ attr_accessor :plan
686
+ # The ID of the price object.
687
+ attr_accessor :price
688
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
689
+ attr_accessor :price_data
690
+ # Quantity for the given price. Can be set only if the price's `usage_type` is `licensed` and not `metered`.
691
+ attr_accessor :quantity
692
+ # A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
693
+ attr_accessor :tax_rates
694
+
695
+ def initialize(
696
+ billing_thresholds: nil,
697
+ discounts: nil,
698
+ metadata: nil,
699
+ plan: nil,
700
+ price: nil,
701
+ price_data: nil,
702
+ quantity: nil,
703
+ tax_rates: nil
704
+ )
705
+ @billing_thresholds = billing_thresholds
706
+ @discounts = discounts
707
+ @metadata = metadata
708
+ @plan = plan
709
+ @price = price
710
+ @price_data = price_data
711
+ @quantity = quantity
712
+ @tax_rates = tax_rates
713
+ end
714
+ end
715
+
716
+ class TransferData < Stripe::RequestParams
717
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
718
+ attr_accessor :amount_percent
719
+ # ID of an existing, connected Stripe account.
720
+ attr_accessor :destination
721
+
722
+ def initialize(amount_percent: nil, destination: nil)
723
+ @amount_percent = amount_percent
724
+ @destination = destination
725
+ end
726
+ end
727
+ # A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
728
+ attr_accessor :add_invoice_items
729
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
730
+ attr_accessor :application_fee_percent
731
+ # Automatic tax settings for this phase.
732
+ attr_accessor :automatic_tax
733
+ # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
734
+ attr_accessor :billing_cycle_anchor
735
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
736
+ attr_accessor :billing_thresholds
737
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically` on creation.
738
+ attr_accessor :collection_method
739
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
740
+ attr_accessor :currency
741
+ # ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
742
+ attr_accessor :default_payment_method
743
+ # A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
744
+ attr_accessor :default_tax_rates
745
+ # Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
746
+ attr_accessor :description
747
+ # The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
748
+ attr_accessor :discounts
749
+ # The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set.
750
+ attr_accessor :end_date
751
+ # All invoices will be billed using the specified settings.
752
+ attr_accessor :invoice_settings
753
+ # List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
754
+ attr_accessor :items
755
+ # Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set.
756
+ attr_accessor :iterations
757
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`. Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`. To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
758
+ attr_accessor :metadata
759
+ # The account on behalf of which to charge, for each of the associated subscription's invoices.
760
+ attr_accessor :on_behalf_of
761
+ # Controls whether the subscription schedule should create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase if there is a difference in billing configuration. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration (item price, quantity, etc.) of the current phase.
762
+ attr_accessor :proration_behavior
763
+ # The data with which to automatically create a Transfer for each of the associated subscription's invoices.
764
+ attr_accessor :transfer_data
765
+ # If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
766
+ attr_accessor :trial
767
+ # Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial`
768
+ attr_accessor :trial_end
769
+
770
+ def initialize(
771
+ add_invoice_items: nil,
772
+ application_fee_percent: nil,
773
+ automatic_tax: nil,
774
+ billing_cycle_anchor: nil,
775
+ billing_thresholds: nil,
776
+ collection_method: nil,
777
+ currency: nil,
778
+ default_payment_method: nil,
779
+ default_tax_rates: nil,
780
+ description: nil,
781
+ discounts: nil,
782
+ end_date: nil,
783
+ invoice_settings: nil,
784
+ items: nil,
785
+ iterations: nil,
786
+ metadata: nil,
787
+ on_behalf_of: nil,
788
+ proration_behavior: nil,
789
+ transfer_data: nil,
790
+ trial: nil,
791
+ trial_end: nil
792
+ )
793
+ @add_invoice_items = add_invoice_items
794
+ @application_fee_percent = application_fee_percent
795
+ @automatic_tax = automatic_tax
796
+ @billing_cycle_anchor = billing_cycle_anchor
797
+ @billing_thresholds = billing_thresholds
798
+ @collection_method = collection_method
799
+ @currency = currency
800
+ @default_payment_method = default_payment_method
801
+ @default_tax_rates = default_tax_rates
802
+ @description = description
803
+ @discounts = discounts
804
+ @end_date = end_date
805
+ @invoice_settings = invoice_settings
806
+ @items = items
807
+ @iterations = iterations
808
+ @metadata = metadata
809
+ @on_behalf_of = on_behalf_of
810
+ @proration_behavior = proration_behavior
811
+ @transfer_data = transfer_data
812
+ @trial = trial
813
+ @trial_end = trial_end
814
+ end
815
+ end
816
+ # The identifier of the customer to create the subscription schedule for.
817
+ attr_accessor :customer
818
+ # Object representing the subscription schedule's default settings.
819
+ attr_accessor :default_settings
820
+ # Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running. `cancel` will end the subscription schedule and cancel the underlying subscription.
821
+ attr_accessor :end_behavior
822
+ # Specifies which fields in the response should be expanded.
823
+ attr_accessor :expand
824
+ # Migrate an existing subscription to be managed by a subscription schedule. If this parameter is set, a subscription schedule will be created using the subscription's item(s), set to auto-renew using the subscription's interval. When using this parameter, other parameters (such as phase values) cannot be set. To create a subscription schedule with other modifications, we recommend making two separate API calls.
825
+ attr_accessor :from_subscription
826
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
827
+ attr_accessor :metadata
828
+ # List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
829
+ attr_accessor :phases
830
+ # When the subscription schedule starts. We recommend using `now` so that it starts the subscription immediately. You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on.
831
+ attr_accessor :start_date
832
+
833
+ def initialize(
834
+ customer: nil,
835
+ default_settings: nil,
836
+ end_behavior: nil,
837
+ expand: nil,
838
+ from_subscription: nil,
839
+ metadata: nil,
840
+ phases: nil,
841
+ start_date: nil
842
+ )
843
+ @customer = customer
844
+ @default_settings = default_settings
845
+ @end_behavior = end_behavior
846
+ @expand = expand
847
+ @from_subscription = from_subscription
848
+ @metadata = metadata
849
+ @phases = phases
850
+ @start_date = start_date
851
+ end
852
+ end
853
+
854
+ class UpdateParams < Stripe::RequestParams
855
+ class DefaultSettings < Stripe::RequestParams
856
+ class AutomaticTax < Stripe::RequestParams
857
+ class Liability < Stripe::RequestParams
858
+ # The connected account being referenced when `type` is `account`.
859
+ attr_accessor :account
860
+ # Type of the account referenced in the request.
861
+ attr_accessor :type
862
+
863
+ def initialize(account: nil, type: nil)
864
+ @account = account
865
+ @type = type
866
+ end
867
+ end
868
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
869
+ attr_accessor :enabled
870
+ # The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
871
+ attr_accessor :liability
872
+
873
+ def initialize(enabled: nil, liability: nil)
874
+ @enabled = enabled
875
+ @liability = liability
876
+ end
877
+ end
878
+
879
+ class BillingThresholds < Stripe::RequestParams
880
+ # Monetary threshold that triggers the subscription to advance to a new billing period
881
+ attr_accessor :amount_gte
882
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
883
+ attr_accessor :reset_billing_cycle_anchor
884
+
885
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
886
+ @amount_gte = amount_gte
887
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
888
+ end
889
+ end
890
+
891
+ class InvoiceSettings < Stripe::RequestParams
892
+ class Issuer < Stripe::RequestParams
893
+ # The connected account being referenced when `type` is `account`.
894
+ attr_accessor :account
895
+ # Type of the account referenced in the request.
896
+ attr_accessor :type
11
897
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :release, http_verb: :post
898
+ def initialize(account: nil, type: nil)
899
+ @account = account
900
+ @type = type
901
+ end
902
+ end
903
+ # The account tax IDs associated with the subscription schedule. Will be set on invoices generated by the subscription schedule.
904
+ attr_accessor :account_tax_ids
905
+ # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `collection_method=charge_automatically`.
906
+ attr_accessor :days_until_due
907
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
908
+ attr_accessor :issuer
14
909
 
910
+ def initialize(account_tax_ids: nil, days_until_due: nil, issuer: nil)
911
+ @account_tax_ids = account_tax_ids
912
+ @days_until_due = days_until_due
913
+ @issuer = issuer
914
+ end
915
+ end
916
+
917
+ class TransferData < Stripe::RequestParams
918
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
919
+ attr_accessor :amount_percent
920
+ # ID of an existing, connected Stripe account.
921
+ attr_accessor :destination
922
+
923
+ def initialize(amount_percent: nil, destination: nil)
924
+ @amount_percent = amount_percent
925
+ @destination = destination
926
+ end
927
+ end
928
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
929
+ attr_accessor :application_fee_percent
930
+ # Default settings for automatic tax computation.
931
+ attr_accessor :automatic_tax
932
+ # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
933
+ attr_accessor :billing_cycle_anchor
934
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
935
+ attr_accessor :billing_thresholds
936
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically` on creation.
937
+ attr_accessor :collection_method
938
+ # ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
939
+ attr_accessor :default_payment_method
940
+ # Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
941
+ attr_accessor :description
942
+ # All invoices will be billed using the specified settings.
943
+ attr_accessor :invoice_settings
944
+ # The account on behalf of which to charge, for each of the associated subscription's invoices.
945
+ attr_accessor :on_behalf_of
946
+ # The data with which to automatically create a Transfer for each of the associated subscription's invoices.
947
+ attr_accessor :transfer_data
948
+
949
+ def initialize(
950
+ application_fee_percent: nil,
951
+ automatic_tax: nil,
952
+ billing_cycle_anchor: nil,
953
+ billing_thresholds: nil,
954
+ collection_method: nil,
955
+ default_payment_method: nil,
956
+ description: nil,
957
+ invoice_settings: nil,
958
+ on_behalf_of: nil,
959
+ transfer_data: nil
960
+ )
961
+ @application_fee_percent = application_fee_percent
962
+ @automatic_tax = automatic_tax
963
+ @billing_cycle_anchor = billing_cycle_anchor
964
+ @billing_thresholds = billing_thresholds
965
+ @collection_method = collection_method
966
+ @default_payment_method = default_payment_method
967
+ @description = description
968
+ @invoice_settings = invoice_settings
969
+ @on_behalf_of = on_behalf_of
970
+ @transfer_data = transfer_data
971
+ end
972
+ end
973
+
974
+ class Phase < Stripe::RequestParams
975
+ class AddInvoiceItem < Stripe::RequestParams
976
+ class Discount < Stripe::RequestParams
977
+ # ID of the coupon to create a new discount for.
978
+ attr_accessor :coupon
979
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
980
+ attr_accessor :discount
981
+ # ID of the promotion code to create a new discount for.
982
+ attr_accessor :promotion_code
983
+
984
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
985
+ @coupon = coupon
986
+ @discount = discount
987
+ @promotion_code = promotion_code
988
+ end
989
+ end
990
+
991
+ class PriceData < Stripe::RequestParams
992
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
993
+ attr_accessor :currency
994
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
995
+ attr_accessor :product
996
+ # Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
997
+ attr_accessor :tax_behavior
998
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer.
999
+ attr_accessor :unit_amount
1000
+ # Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
1001
+ attr_accessor :unit_amount_decimal
1002
+
1003
+ def initialize(
1004
+ currency: nil,
1005
+ product: nil,
1006
+ tax_behavior: nil,
1007
+ unit_amount: nil,
1008
+ unit_amount_decimal: nil
1009
+ )
1010
+ @currency = currency
1011
+ @product = product
1012
+ @tax_behavior = tax_behavior
1013
+ @unit_amount = unit_amount
1014
+ @unit_amount_decimal = unit_amount_decimal
1015
+ end
1016
+ end
1017
+ # The coupons to redeem into discounts for the item.
1018
+ attr_accessor :discounts
1019
+ # The ID of the price object. One of `price` or `price_data` is required.
1020
+ attr_accessor :price
1021
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1022
+ attr_accessor :price_data
1023
+ # Quantity for this item. Defaults to 1.
1024
+ attr_accessor :quantity
1025
+ # The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
1026
+ attr_accessor :tax_rates
1027
+
1028
+ def initialize(discounts: nil, price: nil, price_data: nil, quantity: nil, tax_rates: nil)
1029
+ @discounts = discounts
1030
+ @price = price
1031
+ @price_data = price_data
1032
+ @quantity = quantity
1033
+ @tax_rates = tax_rates
1034
+ end
1035
+ end
1036
+
1037
+ class AutomaticTax < Stripe::RequestParams
1038
+ class Liability < Stripe::RequestParams
1039
+ # The connected account being referenced when `type` is `account`.
1040
+ attr_accessor :account
1041
+ # Type of the account referenced in the request.
1042
+ attr_accessor :type
1043
+
1044
+ def initialize(account: nil, type: nil)
1045
+ @account = account
1046
+ @type = type
1047
+ end
1048
+ end
1049
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
1050
+ attr_accessor :enabled
1051
+ # The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
1052
+ attr_accessor :liability
1053
+
1054
+ def initialize(enabled: nil, liability: nil)
1055
+ @enabled = enabled
1056
+ @liability = liability
1057
+ end
1058
+ end
1059
+
1060
+ class BillingThresholds < Stripe::RequestParams
1061
+ # Monetary threshold that triggers the subscription to advance to a new billing period
1062
+ attr_accessor :amount_gte
1063
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
1064
+ attr_accessor :reset_billing_cycle_anchor
1065
+
1066
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
1067
+ @amount_gte = amount_gte
1068
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
1069
+ end
1070
+ end
1071
+
1072
+ class Discount < Stripe::RequestParams
1073
+ # ID of the coupon to create a new discount for.
1074
+ attr_accessor :coupon
1075
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
1076
+ attr_accessor :discount
1077
+ # ID of the promotion code to create a new discount for.
1078
+ attr_accessor :promotion_code
1079
+
1080
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
1081
+ @coupon = coupon
1082
+ @discount = discount
1083
+ @promotion_code = promotion_code
1084
+ end
1085
+ end
1086
+
1087
+ class InvoiceSettings < Stripe::RequestParams
1088
+ class Issuer < Stripe::RequestParams
1089
+ # The connected account being referenced when `type` is `account`.
1090
+ attr_accessor :account
1091
+ # Type of the account referenced in the request.
1092
+ attr_accessor :type
1093
+
1094
+ def initialize(account: nil, type: nil)
1095
+ @account = account
1096
+ @type = type
1097
+ end
1098
+ end
1099
+ # The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
1100
+ attr_accessor :account_tax_ids
1101
+ # Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
1102
+ attr_accessor :days_until_due
1103
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
1104
+ attr_accessor :issuer
1105
+
1106
+ def initialize(account_tax_ids: nil, days_until_due: nil, issuer: nil)
1107
+ @account_tax_ids = account_tax_ids
1108
+ @days_until_due = days_until_due
1109
+ @issuer = issuer
1110
+ end
1111
+ end
1112
+
1113
+ class Item < Stripe::RequestParams
1114
+ class BillingThresholds < Stripe::RequestParams
1115
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
1116
+ attr_accessor :usage_gte
1117
+
1118
+ def initialize(usage_gte: nil)
1119
+ @usage_gte = usage_gte
1120
+ end
1121
+ end
1122
+
1123
+ class Discount < Stripe::RequestParams
1124
+ # ID of the coupon to create a new discount for.
1125
+ attr_accessor :coupon
1126
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
1127
+ attr_accessor :discount
1128
+ # ID of the promotion code to create a new discount for.
1129
+ attr_accessor :promotion_code
1130
+
1131
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
1132
+ @coupon = coupon
1133
+ @discount = discount
1134
+ @promotion_code = promotion_code
1135
+ end
1136
+ end
1137
+
1138
+ class PriceData < Stripe::RequestParams
1139
+ class Recurring < Stripe::RequestParams
1140
+ # Specifies billing frequency. Either `day`, `week`, `month` or `year`.
1141
+ attr_accessor :interval
1142
+ # The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
1143
+ attr_accessor :interval_count
1144
+
1145
+ def initialize(interval: nil, interval_count: nil)
1146
+ @interval = interval
1147
+ @interval_count = interval_count
1148
+ end
1149
+ end
1150
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1151
+ attr_accessor :currency
1152
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
1153
+ attr_accessor :product
1154
+ # The recurring components of a price such as `interval` and `interval_count`.
1155
+ attr_accessor :recurring
1156
+ # Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1157
+ attr_accessor :tax_behavior
1158
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1159
+ attr_accessor :unit_amount
1160
+ # Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
1161
+ attr_accessor :unit_amount_decimal
1162
+
1163
+ def initialize(
1164
+ currency: nil,
1165
+ product: nil,
1166
+ recurring: nil,
1167
+ tax_behavior: nil,
1168
+ unit_amount: nil,
1169
+ unit_amount_decimal: nil
1170
+ )
1171
+ @currency = currency
1172
+ @product = product
1173
+ @recurring = recurring
1174
+ @tax_behavior = tax_behavior
1175
+ @unit_amount = unit_amount
1176
+ @unit_amount_decimal = unit_amount_decimal
1177
+ end
1178
+ end
1179
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
1180
+ attr_accessor :billing_thresholds
1181
+ # The coupons to redeem into discounts for the subscription item.
1182
+ attr_accessor :discounts
1183
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
1184
+ attr_accessor :metadata
1185
+ # The plan ID to subscribe to. You may specify the same ID in `plan` and `price`.
1186
+ attr_accessor :plan
1187
+ # The ID of the price object.
1188
+ attr_accessor :price
1189
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
1190
+ attr_accessor :price_data
1191
+ # Quantity for the given price. Can be set only if the price's `usage_type` is `licensed` and not `metered`.
1192
+ attr_accessor :quantity
1193
+ # A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
1194
+ attr_accessor :tax_rates
1195
+
1196
+ def initialize(
1197
+ billing_thresholds: nil,
1198
+ discounts: nil,
1199
+ metadata: nil,
1200
+ plan: nil,
1201
+ price: nil,
1202
+ price_data: nil,
1203
+ quantity: nil,
1204
+ tax_rates: nil
1205
+ )
1206
+ @billing_thresholds = billing_thresholds
1207
+ @discounts = discounts
1208
+ @metadata = metadata
1209
+ @plan = plan
1210
+ @price = price
1211
+ @price_data = price_data
1212
+ @quantity = quantity
1213
+ @tax_rates = tax_rates
1214
+ end
1215
+ end
1216
+
1217
+ class TransferData < Stripe::RequestParams
1218
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
1219
+ attr_accessor :amount_percent
1220
+ # ID of an existing, connected Stripe account.
1221
+ attr_accessor :destination
1222
+
1223
+ def initialize(amount_percent: nil, destination: nil)
1224
+ @amount_percent = amount_percent
1225
+ @destination = destination
1226
+ end
1227
+ end
1228
+ # A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
1229
+ attr_accessor :add_invoice_items
1230
+ # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
1231
+ attr_accessor :application_fee_percent
1232
+ # Automatic tax settings for this phase.
1233
+ attr_accessor :automatic_tax
1234
+ # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
1235
+ attr_accessor :billing_cycle_anchor
1236
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
1237
+ attr_accessor :billing_thresholds
1238
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically` on creation.
1239
+ attr_accessor :collection_method
1240
+ # Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1241
+ attr_accessor :currency
1242
+ # ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
1243
+ attr_accessor :default_payment_method
1244
+ # A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
1245
+ attr_accessor :default_tax_rates
1246
+ # Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
1247
+ attr_accessor :description
1248
+ # The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
1249
+ attr_accessor :discounts
1250
+ # The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set.
1251
+ attr_accessor :end_date
1252
+ # All invoices will be billed using the specified settings.
1253
+ attr_accessor :invoice_settings
1254
+ # List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
1255
+ attr_accessor :items
1256
+ # Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set.
1257
+ attr_accessor :iterations
1258
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`. Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`. To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
1259
+ attr_accessor :metadata
1260
+ # The account on behalf of which to charge, for each of the associated subscription's invoices.
1261
+ attr_accessor :on_behalf_of
1262
+ # Controls whether the subscription schedule should create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase if there is a difference in billing configuration. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration (item price, quantity, etc.) of the current phase.
1263
+ attr_accessor :proration_behavior
1264
+ # The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase.
1265
+ attr_accessor :start_date
1266
+ # The data with which to automatically create a Transfer for each of the associated subscription's invoices.
1267
+ attr_accessor :transfer_data
1268
+ # If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
1269
+ attr_accessor :trial
1270
+ # Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial`
1271
+ attr_accessor :trial_end
1272
+
1273
+ def initialize(
1274
+ add_invoice_items: nil,
1275
+ application_fee_percent: nil,
1276
+ automatic_tax: nil,
1277
+ billing_cycle_anchor: nil,
1278
+ billing_thresholds: nil,
1279
+ collection_method: nil,
1280
+ currency: nil,
1281
+ default_payment_method: nil,
1282
+ default_tax_rates: nil,
1283
+ description: nil,
1284
+ discounts: nil,
1285
+ end_date: nil,
1286
+ invoice_settings: nil,
1287
+ items: nil,
1288
+ iterations: nil,
1289
+ metadata: nil,
1290
+ on_behalf_of: nil,
1291
+ proration_behavior: nil,
1292
+ start_date: nil,
1293
+ transfer_data: nil,
1294
+ trial: nil,
1295
+ trial_end: nil
1296
+ )
1297
+ @add_invoice_items = add_invoice_items
1298
+ @application_fee_percent = application_fee_percent
1299
+ @automatic_tax = automatic_tax
1300
+ @billing_cycle_anchor = billing_cycle_anchor
1301
+ @billing_thresholds = billing_thresholds
1302
+ @collection_method = collection_method
1303
+ @currency = currency
1304
+ @default_payment_method = default_payment_method
1305
+ @default_tax_rates = default_tax_rates
1306
+ @description = description
1307
+ @discounts = discounts
1308
+ @end_date = end_date
1309
+ @invoice_settings = invoice_settings
1310
+ @items = items
1311
+ @iterations = iterations
1312
+ @metadata = metadata
1313
+ @on_behalf_of = on_behalf_of
1314
+ @proration_behavior = proration_behavior
1315
+ @start_date = start_date
1316
+ @transfer_data = transfer_data
1317
+ @trial = trial
1318
+ @trial_end = trial_end
1319
+ end
1320
+ end
1321
+ # Object representing the subscription schedule's default settings.
1322
+ attr_accessor :default_settings
1323
+ # Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running. `cancel` will end the subscription schedule and cancel the underlying subscription.
1324
+ attr_accessor :end_behavior
1325
+ # Specifies which fields in the response should be expanded.
1326
+ attr_accessor :expand
1327
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
1328
+ attr_accessor :metadata
1329
+ # List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. Note that past phases can be omitted.
1330
+ attr_accessor :phases
1331
+ # If the update changes the billing configuration (item price, quantity, etc.) of the current phase, indicates how prorations from this change should be handled. The default value is `create_prorations`.
1332
+ attr_accessor :proration_behavior
1333
+
1334
+ def initialize(
1335
+ default_settings: nil,
1336
+ end_behavior: nil,
1337
+ expand: nil,
1338
+ metadata: nil,
1339
+ phases: nil,
1340
+ proration_behavior: nil
1341
+ )
1342
+ @default_settings = default_settings
1343
+ @end_behavior = end_behavior
1344
+ @expand = expand
1345
+ @metadata = metadata
1346
+ @phases = phases
1347
+ @proration_behavior = proration_behavior
1348
+ end
1349
+ end
1350
+
1351
+ class CancelParams < Stripe::RequestParams
1352
+ # Specifies which fields in the response should be expanded.
1353
+ attr_accessor :expand
1354
+ # If the subscription schedule is `active`, indicates if a final invoice will be generated that contains any un-invoiced metered usage and new/pending proration invoice items. Defaults to `true`.
1355
+ attr_accessor :invoice_now
1356
+ # If the subscription schedule is `active`, indicates if the cancellation should be prorated. Defaults to `true`.
1357
+ attr_accessor :prorate
1358
+
1359
+ def initialize(expand: nil, invoice_now: nil, prorate: nil)
1360
+ @expand = expand
1361
+ @invoice_now = invoice_now
1362
+ @prorate = prorate
1363
+ end
1364
+ end
1365
+
1366
+ class ReleaseParams < Stripe::RequestParams
1367
+ # Specifies which fields in the response should be expanded.
1368
+ attr_accessor :expand
1369
+ # Keep any cancellation on the subscription that the schedule has set
1370
+ attr_accessor :preserve_cancel_date
1371
+
1372
+ def initialize(expand: nil, preserve_cancel_date: nil)
1373
+ @expand = expand
1374
+ @preserve_cancel_date = preserve_cancel_date
1375
+ end
1376
+ end
1377
+ # ID of the Connect Application that created the schedule.
1378
+ attr_reader :application
1379
+ # Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.
1380
+ attr_reader :canceled_at
1381
+ # Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch.
1382
+ attr_reader :completed_at
1383
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
1384
+ attr_reader :created
1385
+ # Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`.
1386
+ attr_reader :current_phase
1387
+ # ID of the customer who owns the subscription schedule.
1388
+ attr_reader :customer
1389
+ # Attribute for field default_settings
1390
+ attr_reader :default_settings
1391
+ # Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running. `cancel` will end the subscription schedule and cancel the underlying subscription.
1392
+ attr_reader :end_behavior
1393
+ # Unique identifier for the object.
1394
+ attr_reader :id
1395
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
1396
+ attr_reader :livemode
1397
+ # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
1398
+ attr_reader :metadata
1399
+ # String representing the object's type. Objects of the same type share the same value.
1400
+ attr_reader :object
1401
+ # Configuration for the subscription schedule's phases.
1402
+ attr_reader :phases
1403
+ # Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.
1404
+ attr_reader :released_at
1405
+ # ID of the subscription once managed by the subscription schedule (if it is released).
1406
+ attr_reader :released_subscription
1407
+ # The present status of the subscription schedule. Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`. You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules).
1408
+ attr_reader :status
1409
+ # ID of the subscription managed by the subscription schedule.
1410
+ attr_reader :subscription
1411
+ # ID of the test clock this subscription schedule belongs to.
1412
+ attr_reader :test_clock
1413
+
1414
+ # Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
15
1415
  def cancel(params = {}, opts = {})
16
1416
  request_stripe_object(
17
1417
  method: :post,
18
- path: resource_url + "/cancel",
1418
+ path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(self["id"]) }),
1419
+ params: params,
1420
+ opts: opts
1421
+ )
1422
+ end
1423
+
1424
+ # Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
1425
+ def self.cancel(schedule, params = {}, opts = {})
1426
+ request_stripe_object(
1427
+ method: :post,
1428
+ path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(schedule) }),
1429
+ params: params,
1430
+ opts: opts
1431
+ )
1432
+ end
1433
+
1434
+ # Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.
1435
+ def self.create(params = {}, opts = {})
1436
+ request_stripe_object(
1437
+ method: :post,
1438
+ path: "/v1/subscription_schedules",
1439
+ params: params,
1440
+ opts: opts
1441
+ )
1442
+ end
1443
+
1444
+ # Retrieves the list of your subscription schedules.
1445
+ def self.list(params = {}, opts = {})
1446
+ request_stripe_object(
1447
+ method: :get,
1448
+ path: "/v1/subscription_schedules",
19
1449
  params: params,
20
1450
  opts: opts
21
1451
  )
22
1452
  end
23
1453
 
1454
+ # Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property.
24
1455
  def release(params = {}, opts = {})
25
1456
  request_stripe_object(
26
1457
  method: :post,
27
- path: resource_url + "/release",
1458
+ path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(self["id"]) }),
1459
+ params: params,
1460
+ opts: opts
1461
+ )
1462
+ end
1463
+
1464
+ # Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property.
1465
+ def self.release(schedule, params = {}, opts = {})
1466
+ request_stripe_object(
1467
+ method: :post,
1468
+ path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }),
1469
+ params: params,
1470
+ opts: opts
1471
+ )
1472
+ end
1473
+
1474
+ # Updates an existing subscription schedule.
1475
+ def self.update(schedule, params = {}, opts = {})
1476
+ request_stripe_object(
1477
+ method: :post,
1478
+ path: format("/v1/subscription_schedules/%<schedule>s", { schedule: CGI.escape(schedule) }),
28
1479
  params: params,
29
1480
  opts: opts
30
1481
  )