stripe 12.5.0 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (688) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +197 -9
  3. data/Gemfile +4 -0
  4. data/Makefile +2 -0
  5. data/OPENAPI_VERSION +1 -1
  6. data/README.md +48 -13
  7. data/Rakefile +0 -5
  8. data/VERSION +1 -1
  9. data/examples/README.md +16 -0
  10. data/examples/example_template.rb +36 -0
  11. data/examples/meter_event_stream.rb +57 -0
  12. data/examples/thinevent_webhook_handler.rb +39 -0
  13. data/justfile +43 -0
  14. data/lib/stripe/api_operations/nested_resource.rb +1 -21
  15. data/lib/stripe/api_operations/request.rb +20 -69
  16. data/lib/stripe/api_operations/save.rb +5 -3
  17. data/lib/stripe/api_operations/singleton_save.rb +6 -2
  18. data/lib/stripe/api_requestor.rb +1136 -0
  19. data/lib/stripe/api_resource.rb +38 -17
  20. data/lib/stripe/api_version.rb +1 -1
  21. data/lib/stripe/connection_manager.rb +1 -1
  22. data/lib/stripe/errors.rb +8 -9
  23. data/lib/stripe/event_types.rb +14 -0
  24. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  25. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  26. data/lib/stripe/list_object.rb +2 -3
  27. data/lib/stripe/oauth.rb +8 -15
  28. data/lib/stripe/object_types.rb +26 -3
  29. data/lib/stripe/request_options.rb +129 -0
  30. data/lib/stripe/request_params.rb +24 -0
  31. data/lib/stripe/resources/account.rb +4642 -8
  32. data/lib/stripe/resources/account_link.rb +54 -0
  33. data/lib/stripe/resources/account_session.rb +739 -0
  34. data/lib/stripe/resources/apple_pay_domain.rb +58 -9
  35. data/lib/stripe/resources/application.rb +20 -0
  36. data/lib/stripe/resources/application_fee.rb +89 -2
  37. data/lib/stripe/resources/application_fee_refund.rb +17 -0
  38. data/lib/stripe/resources/apps/secret.rb +143 -2
  39. data/lib/stripe/resources/balance.rb +122 -0
  40. data/lib/stripe/resources/balance_transaction.rb +105 -2
  41. data/lib/stripe/resources/bank_account.rb +85 -3
  42. data/lib/stripe/resources/billing/alert.rb +137 -2
  43. data/lib/stripe/resources/billing/alert_triggered.rb +26 -0
  44. data/lib/stripe/resources/billing/credit_balance_summary.rb +54 -0
  45. data/lib/stripe/resources/billing/credit_balance_transaction.rb +133 -0
  46. data/lib/stripe/resources/billing/credit_grant.rb +307 -0
  47. data/lib/stripe/resources/billing/meter.rb +180 -9
  48. data/lib/stripe/resources/billing/meter_event.rb +37 -3
  49. data/lib/stripe/resources/billing/meter_event_adjustment.rb +44 -1
  50. data/lib/stripe/resources/billing/meter_event_summary.rb +17 -0
  51. data/lib/stripe/resources/billing_portal/configuration.rb +557 -4
  52. data/lib/stripe/resources/billing_portal/session.rb +271 -0
  53. data/lib/stripe/resources/capability.rb +84 -0
  54. data/lib/stripe/resources/card.rb +78 -1
  55. data/lib/stripe/resources/cash_balance.rb +17 -0
  56. data/lib/stripe/resources/charge.rb +1616 -4
  57. data/lib/stripe/resources/checkout/session.rb +3534 -10
  58. data/lib/stripe/resources/climate/order.rb +171 -4
  59. data/lib/stripe/resources/climate/product.rb +49 -2
  60. data/lib/stripe/resources/climate/supplier.rb +47 -2
  61. data/lib/stripe/resources/confirmation_token.rb +1448 -0
  62. data/lib/stripe/resources/connect_collection_transfer.rb +24 -0
  63. data/lib/stripe/resources/country_spec.rb +56 -2
  64. data/lib/stripe/resources/coupon.rb +195 -6
  65. data/lib/stripe/resources/credit_note.rb +641 -2
  66. data/lib/stripe/resources/credit_note_line_item.rb +67 -0
  67. data/lib/stripe/resources/customer.rb +832 -9
  68. data/lib/stripe/resources/customer_balance_transaction.rb +29 -0
  69. data/lib/stripe/resources/customer_cash_balance_transaction.rb +109 -0
  70. data/lib/stripe/resources/customer_session.rb +163 -0
  71. data/lib/stripe/resources/discount.rb +29 -0
  72. data/lib/stripe/resources/dispute.rb +614 -4
  73. data/lib/stripe/resources/entitlements/active_entitlement.rb +39 -2
  74. data/lib/stripe/resources/entitlements/active_entitlement_summary.rb +23 -0
  75. data/lib/stripe/resources/entitlements/feature.rb +83 -2
  76. data/lib/stripe/resources/ephemeral_key.rb +23 -2
  77. data/lib/stripe/resources/event.rb +92 -2
  78. data/lib/stripe/resources/exchange_rate.rb +26 -2
  79. data/lib/stripe/resources/file.rb +123 -15
  80. data/lib/stripe/resources/file_link.rb +107 -4
  81. data/lib/stripe/resources/financial_connections/account.rb +239 -2
  82. data/lib/stripe/resources/financial_connections/account_owner.rb +17 -0
  83. data/lib/stripe/resources/financial_connections/account_ownership.rb +9 -0
  84. data/lib/stripe/resources/financial_connections/session.rb +95 -0
  85. data/lib/stripe/resources/financial_connections/transaction.rb +94 -2
  86. data/lib/stripe/resources/forwarding/request.rb +158 -2
  87. data/lib/stripe/resources/funding_instructions.rb +308 -0
  88. data/lib/stripe/resources/identity/verification_report.rb +259 -2
  89. data/lib/stripe/resources/identity/verification_session.rb +356 -4
  90. data/lib/stripe/resources/invoice.rb +3210 -27
  91. data/lib/stripe/resources/invoice_item.rb +406 -6
  92. data/lib/stripe/resources/invoice_line_item.rb +356 -3
  93. data/lib/stripe/resources/invoice_payment.rb +105 -0
  94. data/lib/stripe/resources/invoice_rendering_template.rb +120 -0
  95. data/lib/stripe/resources/issuing/authorization.rb +1132 -6
  96. data/lib/stripe/resources/issuing/card.rb +682 -5
  97. data/lib/stripe/resources/issuing/cardholder.rb +653 -5
  98. data/lib/stripe/resources/issuing/dispute.rb +785 -4
  99. data/lib/stripe/resources/issuing/personalization_design.rb +280 -4
  100. data/lib/stripe/resources/issuing/physical_bundle.rb +56 -2
  101. data/lib/stripe/resources/issuing/token.rb +170 -4
  102. data/lib/stripe/resources/issuing/transaction.rb +916 -4
  103. data/lib/stripe/resources/line_item.rb +47 -0
  104. data/lib/stripe/resources/login_link.rb +7 -0
  105. data/lib/stripe/resources/mandate.rb +142 -0
  106. data/lib/stripe/resources/payment_intent.rb +8660 -4
  107. data/lib/stripe/resources/payment_link.rb +1636 -4
  108. data/lib/stripe/resources/payment_method.rb +1546 -4
  109. data/lib/stripe/resources/payment_method_configuration.rb +2780 -4
  110. data/lib/stripe/resources/payment_method_domain.rb +154 -10
  111. data/lib/stripe/resources/payout.rb +213 -4
  112. data/lib/stripe/resources/person.rb +264 -1
  113. data/lib/stripe/resources/plan.rb +308 -6
  114. data/lib/stripe/resources/price.rb +609 -5
  115. data/lib/stripe/resources/product.rb +474 -2
  116. data/lib/stripe/resources/product_feature.rb +12 -0
  117. data/lib/stripe/resources/promotion_code.rb +216 -4
  118. data/lib/stripe/resources/quote.rb +927 -10
  119. data/lib/stripe/resources/radar/early_fraud_warning.rb +70 -2
  120. data/lib/stripe/resources/radar/value_list.rb +122 -6
  121. data/lib/stripe/resources/radar/value_list_item.rb +90 -4
  122. data/lib/stripe/resources/refund.rb +396 -4
  123. data/lib/stripe/resources/reporting/report_run.rb +143 -2
  124. data/lib/stripe/resources/reporting/report_type.rb +29 -2
  125. data/lib/stripe/resources/reserve_transaction.rb +22 -0
  126. data/lib/stripe/resources/reversal.rb +21 -0
  127. data/lib/stripe/resources/review.rb +101 -2
  128. data/lib/stripe/resources/setup_attempt.rb +370 -2
  129. data/lib/stripe/resources/setup_intent.rb +3477 -4
  130. data/lib/stripe/resources/shipping_rate.rb +254 -4
  131. data/lib/stripe/resources/sigma/scheduled_query_run.rb +47 -2
  132. data/lib/stripe/resources/source.rb +1203 -4
  133. data/lib/stripe/resources/source_mandate_notification.rb +66 -0
  134. data/lib/stripe/resources/source_transaction.rb +85 -0
  135. data/lib/stripe/resources/subscription.rb +1697 -11
  136. data/lib/stripe/resources/subscription_item.rb +319 -11
  137. data/lib/stripe/resources/subscription_schedule.rb +1285 -4
  138. data/lib/stripe/resources/tax/calculation.rb +378 -0
  139. data/lib/stripe/resources/tax/calculation_line_item.rb +56 -0
  140. data/lib/stripe/resources/tax/registration.rb +2375 -2
  141. data/lib/stripe/resources/tax/settings.rb +117 -0
  142. data/lib/stripe/resources/tax/transaction.rb +258 -0
  143. data/lib/stripe/resources/tax/transaction_line_item.rb +31 -0
  144. data/lib/stripe/resources/tax_code.rb +28 -2
  145. data/lib/stripe/resources/tax_deducted_at_source.rb +22 -0
  146. data/lib/stripe/resources/tax_id.rb +114 -2
  147. data/lib/stripe/resources/tax_rate.rb +197 -6
  148. data/lib/stripe/resources/terminal/configuration.rb +1266 -6
  149. data/lib/stripe/resources/terminal/connection_token.rb +18 -0
  150. data/lib/stripe/resources/terminal/location.rb +172 -6
  151. data/lib/stripe/resources/terminal/reader.rb +433 -6
  152. data/lib/stripe/resources/test_helpers/test_clock.rb +81 -4
  153. data/lib/stripe/resources/token.rb +1160 -1
  154. data/lib/stripe/resources/topup.rb +169 -4
  155. data/lib/stripe/resources/transfer.rb +148 -4
  156. data/lib/stripe/resources/treasury/credit_reversal.rb +85 -2
  157. data/lib/stripe/resources/treasury/debit_reversal.rb +96 -2
  158. data/lib/stripe/resources/treasury/financial_account.rb +749 -5
  159. data/lib/stripe/resources/treasury/financial_account_features.rb +189 -0
  160. data/lib/stripe/resources/treasury/inbound_transfer.rb +231 -3
  161. data/lib/stripe/resources/treasury/outbound_payment.rb +491 -3
  162. data/lib/stripe/resources/treasury/outbound_transfer.rb +346 -3
  163. data/lib/stripe/resources/treasury/received_credit.rb +239 -2
  164. data/lib/stripe/resources/treasury/received_debit.rb +198 -2
  165. data/lib/stripe/resources/treasury/transaction.rb +169 -2
  166. data/lib/stripe/resources/treasury/transaction_entry.rb +150 -2
  167. data/lib/stripe/resources/v2/amount.rb +9 -0
  168. data/lib/stripe/resources/v2/billing/meter_event.rb +34 -0
  169. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +36 -0
  170. data/lib/stripe/resources/v2/billing/meter_event_session.rb +29 -0
  171. data/lib/stripe/resources/v2/event.rb +41 -0
  172. data/lib/stripe/resources/v2/event_destination.rb +73 -0
  173. data/lib/stripe/resources/webhook_endpoint.rb +119 -11
  174. data/lib/stripe/resources.rb +19 -2
  175. data/lib/stripe/search_result_object.rb +1 -1
  176. data/lib/stripe/services/account_capability_service.rb +71 -0
  177. data/lib/stripe/services/account_external_account_service.rb +318 -0
  178. data/lib/stripe/services/account_link_service.rb +63 -0
  179. data/lib/stripe/services/account_login_link_service.rb +28 -0
  180. data/lib/stripe/services/account_person_service.rb +936 -0
  181. data/lib/stripe/services/account_service.rb +4100 -0
  182. data/lib/stripe/services/account_session_service.rb +501 -0
  183. data/lib/stripe/services/apple_pay_domain_service.rb +101 -0
  184. data/lib/stripe/services/application_fee_refund_service.rb +114 -0
  185. data/lib/stripe/services/application_fee_service.rb +92 -0
  186. data/lib/stripe/services/apps/secret_service.rb +168 -0
  187. data/lib/stripe/services/apps_service.rb +13 -0
  188. data/lib/stripe/services/balance_service.rb +21 -0
  189. data/lib/stripe/services/balance_transaction_service.rb +101 -0
  190. data/lib/stripe/services/billing/alert_service.rb +187 -0
  191. data/lib/stripe/services/billing/credit_balance_summary_service.rb +67 -0
  192. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +70 -0
  193. data/lib/stripe/services/billing/credit_grant_service.rb +240 -0
  194. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +45 -0
  195. data/lib/stripe/services/billing/meter_event_service.rb +40 -0
  196. data/lib/stripe/services/billing/meter_event_summary_service.rb +58 -0
  197. data/lib/stripe/services/billing/meter_service.rb +211 -0
  198. data/lib/stripe/services/billing_portal/configuration_service.rb +496 -0
  199. data/lib/stripe/services/billing_portal/session_service.rb +192 -0
  200. data/lib/stripe/services/billing_portal_service.rb +14 -0
  201. data/lib/stripe/services/billing_service.rb +20 -0
  202. data/lib/stripe/services/charge_service.rb +471 -0
  203. data/lib/stripe/services/checkout/session_line_item_service.rb +37 -0
  204. data/lib/stripe/services/checkout/session_service.rb +2466 -0
  205. data/lib/stripe/services/checkout_service.rb +13 -0
  206. data/lib/stripe/services/climate/order_service.rb +170 -0
  207. data/lib/stripe/services/climate/product_service.rb +57 -0
  208. data/lib/stripe/services/climate/supplier_service.rb +57 -0
  209. data/lib/stripe/services/climate_service.rb +15 -0
  210. data/lib/stripe/services/confirmation_token_service.rb +26 -0
  211. data/lib/stripe/services/country_spec_service.rb +55 -0
  212. data/lib/stripe/services/coupon_service.rb +203 -0
  213. data/lib/stripe/services/credit_note_line_item_service.rb +35 -0
  214. data/lib/stripe/services/credit_note_preview_lines_service.rb +169 -0
  215. data/lib/stripe/services/credit_note_service.rb +458 -0
  216. data/lib/stripe/services/customer_balance_transaction_service.rb +113 -0
  217. data/lib/stripe/services/customer_cash_balance_service.rb +57 -0
  218. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +55 -0
  219. data/lib/stripe/services/customer_funding_instructions_service.rb +61 -0
  220. data/lib/stripe/services/customer_payment_method_service.rb +68 -0
  221. data/lib/stripe/services/customer_payment_source_service.rb +255 -0
  222. data/lib/stripe/services/customer_service.rb +666 -0
  223. data/lib/stripe/services/customer_session_service.rb +113 -0
  224. data/lib/stripe/services/customer_tax_id_service.rb +95 -0
  225. data/lib/stripe/services/dispute_service.rb +422 -0
  226. data/lib/stripe/services/entitlements/active_entitlement_service.rb +66 -0
  227. data/lib/stripe/services/entitlements/feature_service.rb +128 -0
  228. data/lib/stripe/services/entitlements_service.rb +14 -0
  229. data/lib/stripe/services/ephemeral_key_service.rb +64 -0
  230. data/lib/stripe/services/event_service.rb +87 -0
  231. data/lib/stripe/services/exchange_rate_service.rb +55 -0
  232. data/lib/stripe/services/file_link_service.rb +132 -0
  233. data/lib/stripe/services/file_service.rb +124 -0
  234. data/lib/stripe/services/financial_connections/account_owner_service.rb +46 -0
  235. data/lib/stripe/services/financial_connections/account_service.rb +177 -0
  236. data/lib/stripe/services/financial_connections/session_service.rb +98 -0
  237. data/lib/stripe/services/financial_connections/transaction_service.rb +100 -0
  238. data/lib/stripe/services/financial_connections_service.rb +15 -0
  239. data/lib/stripe/services/forwarding/request_service.rb +147 -0
  240. data/lib/stripe/services/forwarding_service.rb +13 -0
  241. data/lib/stripe/services/identity/verification_report_service.rb +95 -0
  242. data/lib/stripe/services/identity/verification_session_service.rb +337 -0
  243. data/lib/stripe/services/identity_service.rb +14 -0
  244. data/lib/stripe/services/invoice_item_service.rb +395 -0
  245. data/lib/stripe/services/invoice_line_item_service.rb +252 -0
  246. data/lib/stripe/services/invoice_payment_service.rb +83 -0
  247. data/lib/stripe/services/invoice_rendering_template_service.rb +101 -0
  248. data/lib/stripe/services/invoice_service.rb +2831 -0
  249. data/lib/stripe/services/issuing/authorization_service.rb +169 -0
  250. data/lib/stripe/services/issuing/card_service.rb +507 -0
  251. data/lib/stripe/services/issuing/cardholder_service.rb +577 -0
  252. data/lib/stripe/services/issuing/dispute_service.rb +696 -0
  253. data/lib/stripe/services/issuing/personalization_design_service.rb +245 -0
  254. data/lib/stripe/services/issuing/physical_bundle_service.rb +70 -0
  255. data/lib/stripe/services/issuing/token_service.rb +114 -0
  256. data/lib/stripe/services/issuing/transaction_service.rb +118 -0
  257. data/lib/stripe/services/issuing_service.rb +20 -0
  258. data/lib/stripe/services/mandate_service.rb +26 -0
  259. data/lib/stripe/services/oauth_service.rb +63 -0
  260. data/lib/stripe/services/payment_intent_service.rb +7258 -0
  261. data/lib/stripe/services/payment_link_line_item_service.rb +35 -0
  262. data/lib/stripe/services/payment_link_service.rb +1333 -0
  263. data/lib/stripe/services/payment_method_configuration_service.rb +2054 -0
  264. data/lib/stripe/services/payment_method_domain_service.rb +142 -0
  265. data/lib/stripe/services/payment_method_service.rb +894 -0
  266. data/lib/stripe/services/payout_service.rb +225 -0
  267. data/lib/stripe/services/plan_service.rb +298 -0
  268. data/lib/stripe/services/price_service.rb +545 -0
  269. data/lib/stripe/services/product_feature_service.rb +92 -0
  270. data/lib/stripe/services/product_service.rb +495 -0
  271. data/lib/stripe/services/promotion_code_service.rb +228 -0
  272. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +35 -0
  273. data/lib/stripe/services/quote_line_item_service.rb +35 -0
  274. data/lib/stripe/services/quote_service.rb +703 -0
  275. data/lib/stripe/services/radar/early_fraud_warning_service.rb +93 -0
  276. data/lib/stripe/services/radar/value_list_item_service.rb +131 -0
  277. data/lib/stripe/services/radar/value_list_service.rb +166 -0
  278. data/lib/stripe/services/radar_service.rb +15 -0
  279. data/lib/stripe/services/refund_service.rb +200 -0
  280. data/lib/stripe/services/reporting/report_run_service.rb +147 -0
  281. data/lib/stripe/services/reporting/report_type_service.rb +48 -0
  282. data/lib/stripe/services/reporting_service.rb +14 -0
  283. data/lib/stripe/services/review_service.rb +89 -0
  284. data/lib/stripe/services/setup_attempt_service.rb +68 -0
  285. data/lib/stripe/services/setup_intent_service.rb +3268 -0
  286. data/lib/stripe/services/shipping_rate_service.rb +250 -0
  287. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +57 -0
  288. data/lib/stripe/services/sigma_service.rb +13 -0
  289. data/lib/stripe/services/source_service.rb +665 -0
  290. data/lib/stripe/services/source_transaction_service.rb +35 -0
  291. data/lib/stripe/services/subscription_item_service.rb +346 -0
  292. data/lib/stripe/services/subscription_schedule_service.rb +1134 -0
  293. data/lib/stripe/services/subscription_service.rb +1539 -0
  294. data/lib/stripe/services/tax/calculation_line_item_service.rb +37 -0
  295. data/lib/stripe/services/tax/calculation_service.rb +242 -0
  296. data/lib/stripe/services/tax/registration_service.rb +1618 -0
  297. data/lib/stripe/services/tax/settings_service.rb +104 -0
  298. data/lib/stripe/services/tax/transaction_line_item_service.rb +37 -0
  299. data/lib/stripe/services/tax/transaction_service.rb +159 -0
  300. data/lib/stripe/services/tax_code_service.rb +49 -0
  301. data/lib/stripe/services/tax_id_service.rb +117 -0
  302. data/lib/stripe/services/tax_rate_service.rb +193 -0
  303. data/lib/stripe/services/tax_service.rb +16 -0
  304. data/lib/stripe/services/terminal/configuration_service.rb +1060 -0
  305. data/lib/stripe/services/terminal/connection_token_service.rb +31 -0
  306. data/lib/stripe/services/terminal/location_service.rb +208 -0
  307. data/lib/stripe/services/terminal/reader_service.rb +384 -0
  308. data/lib/stripe/services/terminal_service.rb +16 -0
  309. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +661 -0
  310. data/lib/stripe/services/test_helpers/customer_service.rb +37 -0
  311. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +832 -0
  312. data/lib/stripe/services/test_helpers/issuing/card_service.rb +110 -0
  313. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +84 -0
  314. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +675 -0
  315. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  316. data/lib/stripe/services/test_helpers/refund_service.rb +28 -0
  317. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +65 -0
  318. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  319. data/lib/stripe/services/test_helpers/test_clock_service.rb +120 -0
  320. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +81 -0
  321. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +141 -0
  322. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +141 -0
  323. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +81 -0
  324. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +81 -0
  325. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  326. data/lib/stripe/services/test_helpers_service.rb +19 -0
  327. data/lib/stripe/services/token_service.rb +1163 -0
  328. data/lib/stripe/services/topup_service.rb +191 -0
  329. data/lib/stripe/services/transfer_reversal_service.rb +122 -0
  330. data/lib/stripe/services/transfer_service.rb +166 -0
  331. data/lib/stripe/services/treasury/credit_reversal_service.rb +100 -0
  332. data/lib/stripe/services/treasury/debit_reversal_service.rb +104 -0
  333. data/lib/stripe/services/treasury/financial_account_features_service.rb +196 -0
  334. data/lib/stripe/services/treasury/financial_account_service.rb +554 -0
  335. data/lib/stripe/services/treasury/inbound_transfer_service.rb +140 -0
  336. data/lib/stripe/services/treasury/outbound_payment_service.rb +310 -0
  337. data/lib/stripe/services/treasury/outbound_transfer_service.rb +176 -0
  338. data/lib/stripe/services/treasury/received_credit_service.rb +82 -0
  339. data/lib/stripe/services/treasury/received_debit_service.rb +70 -0
  340. data/lib/stripe/services/treasury/transaction_entry_service.rb +117 -0
  341. data/lib/stripe/services/treasury/transaction_service.rb +125 -0
  342. data/lib/stripe/services/treasury_service.rb +22 -0
  343. data/lib/stripe/services/v1_services.rb +90 -0
  344. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +44 -0
  345. data/lib/stripe/services/v2/billing/meter_event_service.rb +46 -0
  346. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +24 -0
  347. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +56 -0
  348. data/lib/stripe/services/v2/billing_service.rb +18 -0
  349. data/lib/stripe/services/v2/core/event_destination_service.rb +241 -0
  350. data/lib/stripe/services/v2/core/event_service.rb +49 -0
  351. data/lib/stripe/services/v2/core_service.rb +16 -0
  352. data/lib/stripe/services/v2_services.rb +14 -0
  353. data/lib/stripe/services/webhook_endpoint_service.rb +157 -0
  354. data/lib/stripe/services.rb +180 -0
  355. data/lib/stripe/singleton_api_resource.rb +1 -18
  356. data/lib/stripe/stripe_client.rb +53 -1031
  357. data/lib/stripe/stripe_configuration.rb +52 -19
  358. data/lib/stripe/stripe_object.rb +54 -20
  359. data/lib/stripe/stripe_service.rb +32 -0
  360. data/lib/stripe/thin_event.rb +37 -0
  361. data/lib/stripe/util.rb +78 -37
  362. data/lib/stripe/v2_list_object.rb +84 -0
  363. data/lib/stripe/version.rb +1 -1
  364. data/lib/stripe/webhook.rb +1 -1
  365. data/lib/stripe.rb +38 -25
  366. data/rbi/stripe/resources/account.rbi +4840 -0
  367. data/rbi/stripe/resources/account_link.rbi +74 -0
  368. data/rbi/stripe/resources/account_session.rbi +894 -0
  369. data/rbi/stripe/resources/apple_pay_domain.rbi +90 -0
  370. data/rbi/stripe/resources/application.rbi +20 -0
  371. data/rbi/stripe/resources/application_fee.rbi +118 -0
  372. data/rbi/stripe/resources/application_fee_refund.rbi +37 -0
  373. data/rbi/stripe/resources/apps/secret.rbi +195 -0
  374. data/rbi/stripe/resources/balance.rbi +180 -0
  375. data/rbi/stripe/resources/balance_transaction.rbi +144 -0
  376. data/rbi/stripe/resources/bank_account.rbi +127 -0
  377. data/rbi/stripe/resources/billing/alert.rbi +201 -0
  378. data/rbi/stripe/resources/billing/alert_triggered.rbi +28 -0
  379. data/rbi/stripe/resources/billing/credit_balance_summary.rbi +63 -0
  380. data/rbi/stripe/resources/billing/credit_balance_transaction.rbi +147 -0
  381. data/rbi/stripe/resources/billing/credit_grant.rbi +291 -0
  382. data/rbi/stripe/resources/billing/meter.rbi +226 -0
  383. data/rbi/stripe/resources/billing/meter_event.rbi +64 -0
  384. data/rbi/stripe/resources/billing/meter_event_adjustment.rbi +64 -0
  385. data/rbi/stripe/resources/billing/meter_event_summary.rbi +35 -0
  386. data/rbi/stripe/resources/billing_portal/configuration.rbi +645 -0
  387. data/rbi/stripe/resources/billing_portal/session.rbi +345 -0
  388. data/rbi/stripe/resources/capability.rbi +125 -0
  389. data/rbi/stripe/resources/card.rbi +125 -0
  390. data/rbi/stripe/resources/cash_balance.rbi +32 -0
  391. data/rbi/stripe/resources/charge.rbi +2054 -0
  392. data/rbi/stripe/resources/checkout/session.rbi +3951 -0
  393. data/rbi/stripe/resources/climate/order.rbi +245 -0
  394. data/rbi/stripe/resources/climate/product.rbi +75 -0
  395. data/rbi/stripe/resources/climate/supplier.rbi +72 -0
  396. data/rbi/stripe/resources/confirmation_token.rbi +1793 -0
  397. data/rbi/stripe/resources/connect_collection_transfer.rbi +26 -0
  398. data/rbi/stripe/resources/country_spec.rbi +85 -0
  399. data/rbi/stripe/resources/coupon.rbi +252 -0
  400. data/rbi/stripe/resources/credit_note.rbi +747 -0
  401. data/rbi/stripe/resources/credit_note_line_item.rbi +101 -0
  402. data/rbi/stripe/resources/customer.rbi +1009 -0
  403. data/rbi/stripe/resources/customer_balance_transaction.rbi +56 -0
  404. data/rbi/stripe/resources/customer_cash_balance_transaction.rbi +151 -0
  405. data/rbi/stripe/resources/customer_session.rbi +200 -0
  406. data/rbi/stripe/resources/discount.rbi +53 -0
  407. data/rbi/stripe/resources/dispute.rbi +761 -0
  408. data/rbi/stripe/resources/entitlements/active_entitlement.rbi +58 -0
  409. data/rbi/stripe/resources/entitlements/active_entitlement_summary.rbi +23 -0
  410. data/rbi/stripe/resources/entitlements/feature.rbi +117 -0
  411. data/rbi/stripe/resources/ephemeral_key.rbi +44 -0
  412. data/rbi/stripe/resources/event.rbi +146 -0
  413. data/rbi/stripe/resources/exchange_rate.rbi +66 -0
  414. data/rbi/stripe/resources/file.rbi +143 -0
  415. data/rbi/stripe/resources/file_link.rbi +141 -0
  416. data/rbi/stripe/resources/financial_connections/account.rbi +339 -0
  417. data/rbi/stripe/resources/financial_connections/account_owner.rbi +35 -0
  418. data/rbi/stripe/resources/financial_connections/account_ownership.rbi +23 -0
  419. data/rbi/stripe/resources/financial_connections/session.rbi +123 -0
  420. data/rbi/stripe/resources/financial_connections/transaction.rbi +124 -0
  421. data/rbi/stripe/resources/forwarding/request.rbi +216 -0
  422. data/rbi/stripe/resources/funding_instructions.rbi +437 -0
  423. data/rbi/stripe/resources/identity/verification_report.rbi +351 -0
  424. data/rbi/stripe/resources/identity/verification_session.rbi +517 -0
  425. data/rbi/stripe/resources/invoice.rbi +3733 -0
  426. data/rbi/stripe/resources/invoice_item.rbi +475 -0
  427. data/rbi/stripe/resources/invoice_line_item.rbi +432 -0
  428. data/rbi/stripe/resources/invoice_payment.rbi +114 -0
  429. data/rbi/stripe/resources/invoice_rendering_template.rbi +104 -0
  430. data/rbi/stripe/resources/issuing/authorization.rbi +1283 -0
  431. data/rbi/stripe/resources/issuing/card.rbi +741 -0
  432. data/rbi/stripe/resources/issuing/cardholder.rbi +744 -0
  433. data/rbi/stripe/resources/issuing/dispute.rbi +913 -0
  434. data/rbi/stripe/resources/issuing/personalization_design.rbi +338 -0
  435. data/rbi/stripe/resources/issuing/physical_bundle.rbi +79 -0
  436. data/rbi/stripe/resources/issuing/token.rbi +226 -0
  437. data/rbi/stripe/resources/issuing/transaction.rbi +1061 -0
  438. data/rbi/stripe/resources/line_item.rbi +72 -0
  439. data/rbi/stripe/resources/login_link.rbi +18 -0
  440. data/rbi/stripe/resources/mandate.rbi +187 -0
  441. data/rbi/stripe/resources/payment_intent.rbi +9731 -0
  442. data/rbi/stripe/resources/payment_link.rbi +1801 -0
  443. data/rbi/stripe/resources/payment_method.rbi +1822 -0
  444. data/rbi/stripe/resources/payment_method_configuration.rbi +3154 -0
  445. data/rbi/stripe/resources/payment_method_domain.rbi +212 -0
  446. data/rbi/stripe/resources/payout.rbi +300 -0
  447. data/rbi/stripe/resources/person.rbi +371 -0
  448. data/rbi/stripe/resources/plan.rbi +373 -0
  449. data/rbi/stripe/resources/price.rbi +694 -0
  450. data/rbi/stripe/resources/product.rbi +557 -0
  451. data/rbi/stripe/resources/product_feature.rbi +26 -0
  452. data/rbi/stripe/resources/promotion_code.rbi +261 -0
  453. data/rbi/stripe/resources/quote.rbi +1123 -0
  454. data/rbi/stripe/resources/radar/early_fraud_warning.rbi +98 -0
  455. data/rbi/stripe/resources/radar/value_list.rbi +170 -0
  456. data/rbi/stripe/resources/radar/value_list_item.rbi +131 -0
  457. data/rbi/stripe/resources/refund.rbi +516 -0
  458. data/rbi/stripe/resources/reporting/report_run.rbi +191 -0
  459. data/rbi/stripe/resources/reporting/report_type.rbi +57 -0
  460. data/rbi/stripe/resources/reserve_transaction.rbi +23 -0
  461. data/rbi/stripe/resources/reversal.rbi +51 -0
  462. data/rbi/stripe/resources/review.rbi +154 -0
  463. data/rbi/stripe/resources/setup_attempt.rbi +477 -0
  464. data/rbi/stripe/resources/setup_intent.rbi +3860 -0
  465. data/rbi/stripe/resources/shipping_rate.rbi +305 -0
  466. data/rbi/stripe/resources/sigma/scheduled_query_run.rbi +75 -0
  467. data/rbi/stripe/resources/source.rbi +1496 -0
  468. data/rbi/stripe/resources/source_mandate_notification.rbi +77 -0
  469. data/rbi/stripe/resources/source_transaction.rbi +127 -0
  470. data/rbi/stripe/resources/subscription.rbi +1964 -0
  471. data/rbi/stripe/resources/subscription_item.rbi +370 -0
  472. data/rbi/stripe/resources/subscription_schedule.rbi +1495 -0
  473. data/rbi/stripe/resources/tax/calculation.rbi +474 -0
  474. data/rbi/stripe/resources/tax/calculation_line_item.rbi +88 -0
  475. data/rbi/stripe/resources/tax/registration.rbi +2485 -0
  476. data/rbi/stripe/resources/tax/settings.rbi +141 -0
  477. data/rbi/stripe/resources/tax/transaction.rbi +351 -0
  478. data/rbi/stripe/resources/tax/transaction_line_item.rbi +54 -0
  479. data/rbi/stripe/resources/tax_code.rbi +44 -0
  480. data/rbi/stripe/resources/tax_deducted_at_source.rbi +23 -0
  481. data/rbi/stripe/resources/tax_id.rbi +167 -0
  482. data/rbi/stripe/resources/tax_rate.rbi +239 -0
  483. data/rbi/stripe/resources/terminal/configuration.rbi +1388 -0
  484. data/rbi/stripe/resources/terminal/connection_token.rbi +37 -0
  485. data/rbi/stripe/resources/terminal/location.rbi +224 -0
  486. data/rbi/stripe/resources/terminal/reader.rbi +587 -0
  487. data/rbi/stripe/resources/test_helpers/test_clock.rbi +134 -0
  488. data/rbi/stripe/resources/token.rbi +1217 -0
  489. data/rbi/stripe/resources/topup.rbi +222 -0
  490. data/rbi/stripe/resources/transfer.rbi +199 -0
  491. data/rbi/stripe/resources/treasury/credit_reversal.rbi +119 -0
  492. data/rbi/stripe/resources/treasury/debit_reversal.rbi +131 -0
  493. data/rbi/stripe/resources/treasury/financial_account.rbi +865 -0
  494. data/rbi/stripe/resources/treasury/financial_account_features.rbi +260 -0
  495. data/rbi/stripe/resources/treasury/inbound_transfer.rbi +295 -0
  496. data/rbi/stripe/resources/treasury/outbound_payment.rbi +592 -0
  497. data/rbi/stripe/resources/treasury/outbound_transfer.rbi +431 -0
  498. data/rbi/stripe/resources/treasury/received_credit.rbi +302 -0
  499. data/rbi/stripe/resources/treasury/received_debit.rbi +256 -0
  500. data/rbi/stripe/resources/treasury/transaction.rbi +215 -0
  501. data/rbi/stripe/resources/treasury/transaction_entry.rbi +192 -0
  502. data/rbi/stripe/resources/v2/amount.rbi +14 -0
  503. data/rbi/stripe/resources/v2/billing/meter_event.rbi +37 -0
  504. data/rbi/stripe/resources/v2/billing/meter_event_adjustment.rbi +41 -0
  505. data/rbi/stripe/resources/v2/billing/meter_event_session.rbi +31 -0
  506. data/rbi/stripe/resources/v2/event.rbi +48 -0
  507. data/rbi/stripe/resources/v2/event_destination.rbi +91 -0
  508. data/rbi/stripe/resources/webhook_endpoint.rbi +170 -0
  509. data/rbi/stripe/services/account_capability_service.rbi +51 -0
  510. data/rbi/stripe/services/account_external_account_service.rbi +306 -0
  511. data/rbi/stripe/services/account_link_service.rbi +58 -0
  512. data/rbi/stripe/services/account_login_link_service.rbi +22 -0
  513. data/rbi/stripe/services/account_person_service.rbi +923 -0
  514. data/rbi/stripe/services/account_service.rbi +4143 -0
  515. data/rbi/stripe/services/account_session_service.rbi +572 -0
  516. data/rbi/stripe/services/apple_pay_domain_service.rbi +78 -0
  517. data/rbi/stripe/services/application_fee_refund_service.rbi +93 -0
  518. data/rbi/stripe/services/application_fee_service.rbi +78 -0
  519. data/rbi/stripe/services/apps/secret_service.rbi +151 -0
  520. data/rbi/stripe/services/apps_service.rbi +9 -0
  521. data/rbi/stripe/services/balance_service.rbi +21 -0
  522. data/rbi/stripe/services/balance_transaction_service.rbi +93 -0
  523. data/rbi/stripe/services/billing/alert_service.rbi +152 -0
  524. data/rbi/stripe/services/billing/credit_balance_summary_service.rbi +68 -0
  525. data/rbi/stripe/services/billing/credit_balance_transaction_service.rbi +59 -0
  526. data/rbi/stripe/services/billing/credit_grant_service.rbi +211 -0
  527. data/rbi/stripe/services/billing/meter_event_adjustment_service.rbi +42 -0
  528. data/rbi/stripe/services/billing/meter_event_service.rbi +42 -0
  529. data/rbi/stripe/services/billing/meter_event_summary_service.rbi +54 -0
  530. data/rbi/stripe/services/billing/meter_service.rbi +163 -0
  531. data/rbi/stripe/services/billing_portal/configuration_service.rbi +511 -0
  532. data/rbi/stripe/services/billing_portal/session_service.rbi +204 -0
  533. data/rbi/stripe/services/billing_portal_service.rbi +10 -0
  534. data/rbi/stripe/services/billing_service.rbi +15 -0
  535. data/rbi/stripe/services/charge_service.rbi +448 -0
  536. data/rbi/stripe/services/checkout/session_line_item_service.rbi +33 -0
  537. data/rbi/stripe/services/checkout/session_service.rbi +2585 -0
  538. data/rbi/stripe/services/checkout_service.rbi +9 -0
  539. data/rbi/stripe/services/climate/order_service.rbi +142 -0
  540. data/rbi/stripe/services/climate/product_service.rbi +46 -0
  541. data/rbi/stripe/services/climate/supplier_service.rbi +46 -0
  542. data/rbi/stripe/services/climate_service.rbi +11 -0
  543. data/rbi/stripe/services/confirmation_token_service.rbi +20 -0
  544. data/rbi/stripe/services/country_spec_service.rbi +44 -0
  545. data/rbi/stripe/services/coupon_service.rbi +196 -0
  546. data/rbi/stripe/services/credit_note_line_item_service.rbi +31 -0
  547. data/rbi/stripe/services/credit_note_preview_lines_service.rbi +167 -0
  548. data/rbi/stripe/services/credit_note_service.rbi +416 -0
  549. data/rbi/stripe/services/customer_balance_transaction_service.rbi +92 -0
  550. data/rbi/stripe/services/customer_cash_balance_service.rbi +45 -0
  551. data/rbi/stripe/services/customer_cash_balance_transaction_service.rbi +44 -0
  552. data/rbi/stripe/services/customer_funding_instructions_service.rbi +59 -0
  553. data/rbi/stripe/services/customer_payment_method_service.rbi +57 -0
  554. data/rbi/stripe/services/customer_payment_source_service.rbi +232 -0
  555. data/rbi/stripe/services/customer_service.rbi +651 -0
  556. data/rbi/stripe/services/customer_session_service.rbi +116 -0
  557. data/rbi/stripe/services/customer_tax_id_service.rbi +72 -0
  558. data/rbi/stripe/services/dispute_service.rbi +424 -0
  559. data/rbi/stripe/services/entitlements/active_entitlement_service.rbi +55 -0
  560. data/rbi/stripe/services/entitlements/feature_service.rbi +107 -0
  561. data/rbi/stripe/services/entitlements_service.rbi +10 -0
  562. data/rbi/stripe/services/ephemeral_key_service.rbi +53 -0
  563. data/rbi/stripe/services/event_service.rbi +83 -0
  564. data/rbi/stripe/services/exchange_rate_service.rbi +44 -0
  565. data/rbi/stripe/services/file_link_service.rbi +124 -0
  566. data/rbi/stripe/services/file_service.rbi +116 -0
  567. data/rbi/stripe/services/financial_connections/account_owner_service.rbi +42 -0
  568. data/rbi/stripe/services/financial_connections/account_service.rbi +133 -0
  569. data/rbi/stripe/services/financial_connections/session_service.rbi +88 -0
  570. data/rbi/stripe/services/financial_connections/transaction_service.rbi +92 -0
  571. data/rbi/stripe/services/financial_connections_service.rbi +11 -0
  572. data/rbi/stripe/services/forwarding/request_service.rbi +134 -0
  573. data/rbi/stripe/services/forwarding_service.rbi +9 -0
  574. data/rbi/stripe/services/identity/verification_report_service.rbi +87 -0
  575. data/rbi/stripe/services/identity/verification_session_service.rbi +323 -0
  576. data/rbi/stripe/services/identity_service.rbi +10 -0
  577. data/rbi/stripe/services/invoice_item_service.rbi +368 -0
  578. data/rbi/stripe/services/invoice_line_item_service.rbi +259 -0
  579. data/rbi/stripe/services/invoice_payment_service.rbi +71 -0
  580. data/rbi/stripe/services/invoice_rendering_template_service.rbi +82 -0
  581. data/rbi/stripe/services/invoice_service.rbi +2920 -0
  582. data/rbi/stripe/services/issuing/authorization_service.rbi +146 -0
  583. data/rbi/stripe/services/issuing/card_service.rbi +495 -0
  584. data/rbi/stripe/services/issuing/cardholder_service.rbi +587 -0
  585. data/rbi/stripe/services/issuing/dispute_service.rbi +707 -0
  586. data/rbi/stripe/services/issuing/personalization_design_service.rbi +243 -0
  587. data/rbi/stripe/services/issuing/physical_bundle_service.rbi +59 -0
  588. data/rbi/stripe/services/issuing/token_service.rbi +99 -0
  589. data/rbi/stripe/services/issuing/transaction_service.rbi +105 -0
  590. data/rbi/stripe/services/issuing_service.rbi +16 -0
  591. data/rbi/stripe/services/mandate_service.rbi +20 -0
  592. data/rbi/stripe/services/payment_intent_service.rbi +7759 -0
  593. data/rbi/stripe/services/payment_link_line_item_service.rbi +31 -0
  594. data/rbi/stripe/services/payment_link_service.rbi +1352 -0
  595. data/rbi/stripe/services/payment_method_configuration_service.rbi +2211 -0
  596. data/rbi/stripe/services/payment_method_domain_service.rbi +112 -0
  597. data/rbi/stripe/services/payment_method_service.rbi +840 -0
  598. data/rbi/stripe/services/payout_service.rbi +205 -0
  599. data/rbi/stripe/services/plan_service.rbi +284 -0
  600. data/rbi/stripe/services/price_service.rbi +546 -0
  601. data/rbi/stripe/services/product_feature_service.rbi +69 -0
  602. data/rbi/stripe/services/product_service.rbi +479 -0
  603. data/rbi/stripe/services/promotion_code_service.rbi +214 -0
  604. data/rbi/stripe/services/quote_computed_upfront_line_items_service.rbi +31 -0
  605. data/rbi/stripe/services/quote_line_item_service.rbi +31 -0
  606. data/rbi/stripe/services/quote_service.rbi +686 -0
  607. data/rbi/stripe/services/radar/early_fraud_warning_service.rbi +85 -0
  608. data/rbi/stripe/services/radar/value_list_item_service.rbi +111 -0
  609. data/rbi/stripe/services/radar/value_list_service.rbi +143 -0
  610. data/rbi/stripe/services/radar_service.rbi +11 -0
  611. data/rbi/stripe/services/refund_service.rbi +185 -0
  612. data/rbi/stripe/services/reporting/report_run_service.rbi +135 -0
  613. data/rbi/stripe/services/reporting/report_type_service.rbi +35 -0
  614. data/rbi/stripe/services/reporting_service.rbi +10 -0
  615. data/rbi/stripe/services/review_service.rbi +84 -0
  616. data/rbi/stripe/services/setup_attempt_service.rbi +65 -0
  617. data/rbi/stripe/services/setup_intent_service.rbi +3596 -0
  618. data/rbi/stripe/services/shipping_rate_service.rbi +241 -0
  619. data/rbi/stripe/services/sigma/scheduled_query_run_service.rbi +46 -0
  620. data/rbi/stripe/services/sigma_service.rbi +9 -0
  621. data/rbi/stripe/services/source_service.rbi +663 -0
  622. data/rbi/stripe/services/source_transaction_service.rbi +31 -0
  623. data/rbi/stripe/services/subscription_item_service.rbi +324 -0
  624. data/rbi/stripe/services/subscription_schedule_service.rbi +1192 -0
  625. data/rbi/stripe/services/subscription_service.rbi +1596 -0
  626. data/rbi/stripe/services/tax/calculation_line_item_service.rbi +33 -0
  627. data/rbi/stripe/services/tax/calculation_service.rbi +230 -0
  628. data/rbi/stripe/services/tax/registration_service.rbi +1689 -0
  629. data/rbi/stripe/services/tax/settings_service.rbi +93 -0
  630. data/rbi/stripe/services/tax/transaction_line_item_service.rbi +33 -0
  631. data/rbi/stripe/services/tax/transaction_service.rbi +146 -0
  632. data/rbi/stripe/services/tax_code_service.rbi +44 -0
  633. data/rbi/stripe/services/tax_id_service.rbi +112 -0
  634. data/rbi/stripe/services/tax_rate_service.rbi +185 -0
  635. data/rbi/stripe/services/tax_service.rbi +12 -0
  636. data/rbi/stripe/services/terminal/configuration_service.rbi +1120 -0
  637. data/rbi/stripe/services/terminal/connection_token_service.rbi +25 -0
  638. data/rbi/stripe/services/terminal/location_service.rbi +184 -0
  639. data/rbi/stripe/services/terminal/reader_service.rbi +344 -0
  640. data/rbi/stripe/services/terminal_service.rbi +12 -0
  641. data/rbi/stripe/services/test_helpers/confirmation_token_service.rbi +746 -0
  642. data/rbi/stripe/services/test_helpers/customer_service.rbi +33 -0
  643. data/rbi/stripe/services/test_helpers/issuing/authorization_service.rbi +848 -0
  644. data/rbi/stripe/services/test_helpers/issuing/card_service.rbi +76 -0
  645. data/rbi/stripe/services/test_helpers/issuing/personalization_design_service.rbi +69 -0
  646. data/rbi/stripe/services/test_helpers/issuing/transaction_service.rbi +711 -0
  647. data/rbi/stripe/services/test_helpers/issuing_service.rbi +14 -0
  648. data/rbi/stripe/services/test_helpers/refund_service.rbi +22 -0
  649. data/rbi/stripe/services/test_helpers/terminal/reader_service.rbi +62 -0
  650. data/rbi/stripe/services/test_helpers/terminal_service.rbi +11 -0
  651. data/rbi/stripe/services/test_helpers/test_clock_service.rbi +92 -0
  652. data/rbi/stripe/services/test_helpers/treasury/inbound_transfer_service.rbi +64 -0
  653. data/rbi/stripe/services/test_helpers/treasury/outbound_payment_service.rbi +125 -0
  654. data/rbi/stripe/services/test_helpers/treasury/outbound_transfer_service.rbi +125 -0
  655. data/rbi/stripe/services/test_helpers/treasury/received_credit_service.rbi +87 -0
  656. data/rbi/stripe/services/test_helpers/treasury/received_debit_service.rbi +87 -0
  657. data/rbi/stripe/services/test_helpers/treasury_service.rbi +15 -0
  658. data/rbi/stripe/services/test_helpers_service.rbi +15 -0
  659. data/rbi/stripe/services/token_service.rbi +1189 -0
  660. data/rbi/stripe/services/topup_service.rbi +176 -0
  661. data/rbi/stripe/services/transfer_reversal_service.rbi +101 -0
  662. data/rbi/stripe/services/transfer_service.rbi +152 -0
  663. data/rbi/stripe/services/treasury/credit_reversal_service.rbi +84 -0
  664. data/rbi/stripe/services/treasury/debit_reversal_service.rbi +88 -0
  665. data/rbi/stripe/services/treasury/financial_account_features_service.rbi +198 -0
  666. data/rbi/stripe/services/treasury/financial_account_service.rbi +562 -0
  667. data/rbi/stripe/services/treasury/inbound_transfer_service.rbi +117 -0
  668. data/rbi/stripe/services/treasury/outbound_payment_service.rbi +304 -0
  669. data/rbi/stripe/services/treasury/outbound_transfer_service.rbi +157 -0
  670. data/rbi/stripe/services/treasury/received_credit_service.rbi +72 -0
  671. data/rbi/stripe/services/treasury/received_debit_service.rbi +59 -0
  672. data/rbi/stripe/services/treasury/transaction_entry_service.rbi +111 -0
  673. data/rbi/stripe/services/treasury/transaction_service.rbi +122 -0
  674. data/rbi/stripe/services/treasury_service.rbi +18 -0
  675. data/rbi/stripe/services/v1_services.rbi +77 -0
  676. data/rbi/stripe/services/v2/billing/meter_event_adjustment_service.rbi +39 -0
  677. data/rbi/stripe/services/v2/billing/meter_event_service.rbi +42 -0
  678. data/rbi/stripe/services/v2/billing/meter_event_session_service.rbi +20 -0
  679. data/rbi/stripe/services/v2/billing/meter_event_stream_service.rbi +55 -0
  680. data/rbi/stripe/services/v2/billing_service.rbi +14 -0
  681. data/rbi/stripe/services/v2/core/event_destination_service.rbi +200 -0
  682. data/rbi/stripe/services/v2/core/event_service.rbi +38 -0
  683. data/rbi/stripe/services/v2/core_service.rbi +12 -0
  684. data/rbi/stripe/services/v2_services.rbi +10 -0
  685. data/rbi/stripe/services/webhook_endpoint_service.rbi +131 -0
  686. metadata +533 -4
  687. data/lib/stripe/resources/usage_record.rb +0 -17
  688. data/lib/stripe/resources/usage_record_summary.rb +0 -11
@@ -0,0 +1,1539 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SubscriptionService < StripeService
6
+ class CancelParams < Stripe::RequestParams
7
+ class CancellationDetails < Stripe::RequestParams
8
+ # Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
9
+ attr_accessor :comment
10
+ # The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user.
11
+ attr_accessor :feedback
12
+
13
+ def initialize(comment: nil, feedback: nil)
14
+ @comment = comment
15
+ @feedback = feedback
16
+ end
17
+ end
18
+ # Details about why this subscription was cancelled
19
+ attr_accessor :cancellation_details
20
+ # Specifies which fields in the response should be expanded.
21
+ attr_accessor :expand
22
+ # Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. Defaults to `false`.
23
+ attr_accessor :invoice_now
24
+ # Will generate a proration invoice item that credits remaining unused time until the subscription period end. Defaults to `false`.
25
+ attr_accessor :prorate
26
+
27
+ def initialize(cancellation_details: nil, expand: nil, invoice_now: nil, prorate: nil)
28
+ @cancellation_details = cancellation_details
29
+ @expand = expand
30
+ @invoice_now = invoice_now
31
+ @prorate = prorate
32
+ end
33
+ end
34
+
35
+ class RetrieveParams < Stripe::RequestParams
36
+ # Specifies which fields in the response should be expanded.
37
+ attr_accessor :expand
38
+
39
+ def initialize(expand: nil)
40
+ @expand = expand
41
+ end
42
+ end
43
+
44
+ class UpdateParams < Stripe::RequestParams
45
+ class AddInvoiceItem < Stripe::RequestParams
46
+ class Discount < Stripe::RequestParams
47
+ # ID of the coupon to create a new discount for.
48
+ attr_accessor :coupon
49
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
50
+ attr_accessor :discount
51
+ # ID of the promotion code to create a new discount for.
52
+ attr_accessor :promotion_code
53
+
54
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
55
+ @coupon = coupon
56
+ @discount = discount
57
+ @promotion_code = promotion_code
58
+ end
59
+ end
60
+
61
+ class PriceData < Stripe::RequestParams
62
+ # 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).
63
+ attr_accessor :currency
64
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
65
+ attr_accessor :product
66
+ # 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.
67
+ attr_accessor :tax_behavior
68
+ # 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.
69
+ attr_accessor :unit_amount
70
+ # 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.
71
+ attr_accessor :unit_amount_decimal
72
+
73
+ def initialize(
74
+ currency: nil,
75
+ product: nil,
76
+ tax_behavior: nil,
77
+ unit_amount: nil,
78
+ unit_amount_decimal: nil
79
+ )
80
+ @currency = currency
81
+ @product = product
82
+ @tax_behavior = tax_behavior
83
+ @unit_amount = unit_amount
84
+ @unit_amount_decimal = unit_amount_decimal
85
+ end
86
+ end
87
+ # The coupons to redeem into discounts for the item.
88
+ attr_accessor :discounts
89
+ # The ID of the price object. One of `price` or `price_data` is required.
90
+ attr_accessor :price
91
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
92
+ attr_accessor :price_data
93
+ # Quantity for this item. Defaults to 1.
94
+ attr_accessor :quantity
95
+ # The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
96
+ attr_accessor :tax_rates
97
+
98
+ def initialize(discounts: nil, price: nil, price_data: nil, quantity: nil, tax_rates: nil)
99
+ @discounts = discounts
100
+ @price = price
101
+ @price_data = price_data
102
+ @quantity = quantity
103
+ @tax_rates = tax_rates
104
+ end
105
+ end
106
+
107
+ class AutomaticTax < Stripe::RequestParams
108
+ class Liability < Stripe::RequestParams
109
+ # The connected account being referenced when `type` is `account`.
110
+ attr_accessor :account
111
+ # Type of the account referenced in the request.
112
+ attr_accessor :type
113
+
114
+ def initialize(account: nil, type: nil)
115
+ @account = account
116
+ @type = type
117
+ end
118
+ end
119
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
120
+ attr_accessor :enabled
121
+ # 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.
122
+ attr_accessor :liability
123
+
124
+ def initialize(enabled: nil, liability: nil)
125
+ @enabled = enabled
126
+ @liability = liability
127
+ end
128
+ end
129
+
130
+ class CancellationDetails < Stripe::RequestParams
131
+ # Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
132
+ attr_accessor :comment
133
+ # The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user.
134
+ attr_accessor :feedback
135
+
136
+ def initialize(comment: nil, feedback: nil)
137
+ @comment = comment
138
+ @feedback = feedback
139
+ end
140
+ end
141
+
142
+ class Discount < Stripe::RequestParams
143
+ # ID of the coupon to create a new discount for.
144
+ attr_accessor :coupon
145
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
146
+ attr_accessor :discount
147
+ # ID of the promotion code to create a new discount for.
148
+ attr_accessor :promotion_code
149
+
150
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
151
+ @coupon = coupon
152
+ @discount = discount
153
+ @promotion_code = promotion_code
154
+ end
155
+ end
156
+
157
+ class InvoiceSettings < Stripe::RequestParams
158
+ class Issuer < Stripe::RequestParams
159
+ # The connected account being referenced when `type` is `account`.
160
+ attr_accessor :account
161
+ # Type of the account referenced in the request.
162
+ attr_accessor :type
163
+
164
+ def initialize(account: nil, type: nil)
165
+ @account = account
166
+ @type = type
167
+ end
168
+ end
169
+ # The account tax IDs associated with the subscription. Will be set on invoices generated by the subscription.
170
+ attr_accessor :account_tax_ids
171
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
172
+ attr_accessor :issuer
173
+
174
+ def initialize(account_tax_ids: nil, issuer: nil)
175
+ @account_tax_ids = account_tax_ids
176
+ @issuer = issuer
177
+ end
178
+ end
179
+
180
+ class Item < Stripe::RequestParams
181
+ class Discount < Stripe::RequestParams
182
+ # ID of the coupon to create a new discount for.
183
+ attr_accessor :coupon
184
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
185
+ attr_accessor :discount
186
+ # ID of the promotion code to create a new discount for.
187
+ attr_accessor :promotion_code
188
+
189
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
190
+ @coupon = coupon
191
+ @discount = discount
192
+ @promotion_code = promotion_code
193
+ end
194
+ end
195
+
196
+ class PriceData < Stripe::RequestParams
197
+ class Recurring < Stripe::RequestParams
198
+ # Specifies billing frequency. Either `day`, `week`, `month` or `year`.
199
+ attr_accessor :interval
200
+ # 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).
201
+ attr_accessor :interval_count
202
+
203
+ def initialize(interval: nil, interval_count: nil)
204
+ @interval = interval
205
+ @interval_count = interval_count
206
+ end
207
+ end
208
+ # 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).
209
+ attr_accessor :currency
210
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
211
+ attr_accessor :product
212
+ # The recurring components of a price such as `interval` and `interval_count`.
213
+ attr_accessor :recurring
214
+ # 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.
215
+ attr_accessor :tax_behavior
216
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
217
+ attr_accessor :unit_amount
218
+ # 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.
219
+ attr_accessor :unit_amount_decimal
220
+
221
+ def initialize(
222
+ currency: nil,
223
+ product: nil,
224
+ recurring: nil,
225
+ tax_behavior: nil,
226
+ unit_amount: nil,
227
+ unit_amount_decimal: nil
228
+ )
229
+ @currency = currency
230
+ @product = product
231
+ @recurring = recurring
232
+ @tax_behavior = tax_behavior
233
+ @unit_amount = unit_amount
234
+ @unit_amount_decimal = unit_amount_decimal
235
+ end
236
+ end
237
+ # Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached.
238
+ attr_accessor :clear_usage
239
+ # A flag that, if set to `true`, will delete the specified item.
240
+ attr_accessor :deleted
241
+ # The coupons to redeem into discounts for the subscription item.
242
+ attr_accessor :discounts
243
+ # Subscription item to update.
244
+ attr_accessor :id
245
+ # 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`.
246
+ attr_accessor :metadata
247
+ # Plan ID for this item, as a string.
248
+ attr_accessor :plan
249
+ # The ID of the price object. One of `price` or `price_data` is required. When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided.
250
+ attr_accessor :price
251
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
252
+ attr_accessor :price_data
253
+ # Quantity for this item.
254
+ attr_accessor :quantity
255
+ # 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.
256
+ attr_accessor :tax_rates
257
+
258
+ def initialize(
259
+ clear_usage: nil,
260
+ deleted: nil,
261
+ discounts: nil,
262
+ id: nil,
263
+ metadata: nil,
264
+ plan: nil,
265
+ price: nil,
266
+ price_data: nil,
267
+ quantity: nil,
268
+ tax_rates: nil
269
+ )
270
+ @clear_usage = clear_usage
271
+ @deleted = deleted
272
+ @discounts = discounts
273
+ @id = id
274
+ @metadata = metadata
275
+ @plan = plan
276
+ @price = price
277
+ @price_data = price_data
278
+ @quantity = quantity
279
+ @tax_rates = tax_rates
280
+ end
281
+ end
282
+
283
+ class PauseCollection < Stripe::RequestParams
284
+ # The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
285
+ attr_accessor :behavior
286
+ # The time after which the subscription will resume collecting payments.
287
+ attr_accessor :resumes_at
288
+
289
+ def initialize(behavior: nil, resumes_at: nil)
290
+ @behavior = behavior
291
+ @resumes_at = resumes_at
292
+ end
293
+ end
294
+
295
+ class PaymentSettings < Stripe::RequestParams
296
+ class PaymentMethodOptions < Stripe::RequestParams
297
+ class AcssDebit < Stripe::RequestParams
298
+ class MandateOptions < Stripe::RequestParams
299
+ # Transaction type of the mandate.
300
+ attr_accessor :transaction_type
301
+
302
+ def initialize(transaction_type: nil)
303
+ @transaction_type = transaction_type
304
+ end
305
+ end
306
+ # Additional fields for Mandate creation
307
+ attr_accessor :mandate_options
308
+ # Verification method for the intent
309
+ attr_accessor :verification_method
310
+
311
+ def initialize(mandate_options: nil, verification_method: nil)
312
+ @mandate_options = mandate_options
313
+ @verification_method = verification_method
314
+ end
315
+ end
316
+
317
+ class Bancontact < Stripe::RequestParams
318
+ # Preferred language of the Bancontact authorization page that the customer is redirected to.
319
+ attr_accessor :preferred_language
320
+
321
+ def initialize(preferred_language: nil)
322
+ @preferred_language = preferred_language
323
+ end
324
+ end
325
+
326
+ class Card < Stripe::RequestParams
327
+ class MandateOptions < Stripe::RequestParams
328
+ # Amount to be charged for future payments.
329
+ attr_accessor :amount
330
+ # One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param.
331
+ attr_accessor :amount_type
332
+ # A description of the mandate or subscription that is meant to be displayed to the customer.
333
+ attr_accessor :description
334
+
335
+ def initialize(amount: nil, amount_type: nil, description: nil)
336
+ @amount = amount
337
+ @amount_type = amount_type
338
+ @description = description
339
+ end
340
+ end
341
+ # Configuration options for setting up an eMandate for cards issued in India.
342
+ attr_accessor :mandate_options
343
+ # Selected network to process this Subscription on. Depends on the available networks of the card attached to the Subscription. Can be only set confirm-time.
344
+ attr_accessor :network
345
+ # We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
346
+ attr_accessor :request_three_d_secure
347
+
348
+ def initialize(mandate_options: nil, network: nil, request_three_d_secure: nil)
349
+ @mandate_options = mandate_options
350
+ @network = network
351
+ @request_three_d_secure = request_three_d_secure
352
+ end
353
+ end
354
+
355
+ class CustomerBalance < Stripe::RequestParams
356
+ class BankTransfer < Stripe::RequestParams
357
+ class EuBankTransfer < Stripe::RequestParams
358
+ # The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
359
+ attr_accessor :country
360
+
361
+ def initialize(country: nil)
362
+ @country = country
363
+ end
364
+ end
365
+ # Configuration for eu_bank_transfer funding type.
366
+ attr_accessor :eu_bank_transfer
367
+ # The bank transfer type that can be used for funding. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
368
+ attr_accessor :type
369
+
370
+ def initialize(eu_bank_transfer: nil, type: nil)
371
+ @eu_bank_transfer = eu_bank_transfer
372
+ @type = type
373
+ end
374
+ end
375
+ # Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
376
+ attr_accessor :bank_transfer
377
+ # The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
378
+ attr_accessor :funding_type
379
+
380
+ def initialize(bank_transfer: nil, funding_type: nil)
381
+ @bank_transfer = bank_transfer
382
+ @funding_type = funding_type
383
+ end
384
+ end
385
+
386
+ class Konbini < Stripe::RequestParams
387
+ end
388
+
389
+ class SepaDebit < Stripe::RequestParams
390
+ end
391
+
392
+ class UsBankAccount < Stripe::RequestParams
393
+ class FinancialConnections < Stripe::RequestParams
394
+ class Filters < Stripe::RequestParams
395
+ # The account subcategories to use to filter for selectable accounts. Valid subcategories are `checking` and `savings`.
396
+ attr_accessor :account_subcategories
397
+
398
+ def initialize(account_subcategories: nil)
399
+ @account_subcategories = account_subcategories
400
+ end
401
+ end
402
+ # Provide filters for the linked accounts that the customer can select for the payment method.
403
+ attr_accessor :filters
404
+ # The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
405
+ attr_accessor :permissions
406
+ # List of data features that you would like to retrieve upon account creation.
407
+ attr_accessor :prefetch
408
+
409
+ def initialize(filters: nil, permissions: nil, prefetch: nil)
410
+ @filters = filters
411
+ @permissions = permissions
412
+ @prefetch = prefetch
413
+ end
414
+ end
415
+ # Additional fields for Financial Connections Session creation
416
+ attr_accessor :financial_connections
417
+ # Verification method for the intent
418
+ attr_accessor :verification_method
419
+
420
+ def initialize(financial_connections: nil, verification_method: nil)
421
+ @financial_connections = financial_connections
422
+ @verification_method = verification_method
423
+ end
424
+ end
425
+ # This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
426
+ attr_accessor :acss_debit
427
+ # This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent.
428
+ attr_accessor :bancontact
429
+ # This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent.
430
+ attr_accessor :card
431
+ # This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent.
432
+ attr_accessor :customer_balance
433
+ # This sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent.
434
+ attr_accessor :konbini
435
+ # This sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice’s PaymentIntent.
436
+ attr_accessor :sepa_debit
437
+ # This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent.
438
+ attr_accessor :us_bank_account
439
+
440
+ def initialize(
441
+ acss_debit: nil,
442
+ bancontact: nil,
443
+ card: nil,
444
+ customer_balance: nil,
445
+ konbini: nil,
446
+ sepa_debit: nil,
447
+ us_bank_account: nil
448
+ )
449
+ @acss_debit = acss_debit
450
+ @bancontact = bancontact
451
+ @card = card
452
+ @customer_balance = customer_balance
453
+ @konbini = konbini
454
+ @sepa_debit = sepa_debit
455
+ @us_bank_account = us_bank_account
456
+ end
457
+ end
458
+ # Payment-method-specific configuration to provide to invoices created by the subscription.
459
+ attr_accessor :payment_method_options
460
+ # The list of payment method types (e.g. card) to provide to the invoice’s PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration
461
+ attr_accessor :payment_method_types
462
+ # Configure whether Stripe updates `subscription.default_payment_method` when payment succeeds. Defaults to `off` if unspecified.
463
+ attr_accessor :save_default_payment_method
464
+
465
+ def initialize(
466
+ payment_method_options: nil,
467
+ payment_method_types: nil,
468
+ save_default_payment_method: nil
469
+ )
470
+ @payment_method_options = payment_method_options
471
+ @payment_method_types = payment_method_types
472
+ @save_default_payment_method = save_default_payment_method
473
+ end
474
+ end
475
+
476
+ class PendingInvoiceItemInterval < Stripe::RequestParams
477
+ # Specifies invoicing frequency. Either `day`, `week`, `month` or `year`.
478
+ attr_accessor :interval
479
+ # The number of intervals between invoices. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks).
480
+ attr_accessor :interval_count
481
+
482
+ def initialize(interval: nil, interval_count: nil)
483
+ @interval = interval
484
+ @interval_count = interval_count
485
+ end
486
+ end
487
+
488
+ class TransferData < Stripe::RequestParams
489
+ # 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.
490
+ attr_accessor :amount_percent
491
+ # ID of an existing, connected Stripe account.
492
+ attr_accessor :destination
493
+
494
+ def initialize(amount_percent: nil, destination: nil)
495
+ @amount_percent = amount_percent
496
+ @destination = destination
497
+ end
498
+ end
499
+
500
+ class TrialSettings < Stripe::RequestParams
501
+ class EndBehavior < Stripe::RequestParams
502
+ # Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
503
+ attr_accessor :missing_payment_method
504
+
505
+ def initialize(missing_payment_method: nil)
506
+ @missing_payment_method = missing_payment_method
507
+ end
508
+ end
509
+ # Defines how the subscription should behave when the user's free trial ends.
510
+ attr_accessor :end_behavior
511
+
512
+ def initialize(end_behavior: nil)
513
+ @end_behavior = end_behavior
514
+ end
515
+ end
516
+ # A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. You may pass up to 20 items.
517
+ attr_accessor :add_invoice_items
518
+ # 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).
519
+ attr_accessor :application_fee_percent
520
+ # Automatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed.
521
+ attr_accessor :automatic_tax
522
+ # Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
523
+ attr_accessor :billing_cycle_anchor
524
+ # A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period.
525
+ attr_accessor :cancel_at
526
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
527
+ attr_accessor :cancel_at_period_end
528
+ # Details about why this subscription was cancelled
529
+ attr_accessor :cancellation_details
530
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the 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`.
531
+ attr_accessor :collection_method
532
+ # Number of days a customer has to pay invoices generated by this subscription. Valid only for subscriptions where `collection_method` is set to `send_invoice`.
533
+ attr_accessor :days_until_due
534
+ # ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over `default_source`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).
535
+ attr_accessor :default_payment_method
536
+ # ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If `default_payment_method` is also set, `default_payment_method` will take precedence. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).
537
+ attr_accessor :default_source
538
+ # The tax rates that will apply to any subscription item that does not have `tax_rates` set. Invoices created will have their `default_tax_rates` populated from the subscription. Pass an empty string to remove previously-defined tax rates.
539
+ attr_accessor :default_tax_rates
540
+ # The subscription's 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.
541
+ attr_accessor :description
542
+ # The coupons to redeem into discounts for the subscription. If not specified or empty, inherits the discount from the subscription's customer.
543
+ attr_accessor :discounts
544
+ # Specifies which fields in the response should be expanded.
545
+ attr_accessor :expand
546
+ # All invoices will be billed using the specified settings.
547
+ attr_accessor :invoice_settings
548
+ # A list of up to 20 subscription items, each with an attached price.
549
+ attr_accessor :items
550
+ # 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`.
551
+ attr_accessor :metadata
552
+ # Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `false` (on-session).
553
+ attr_accessor :off_session
554
+ # The account on behalf of which to charge, for each of the subscription's invoices.
555
+ attr_accessor :on_behalf_of
556
+ # If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment).
557
+ attr_accessor :pause_collection
558
+ # Use `allow_incomplete` to transition the subscription to `status=past_due` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior.
559
+ #
560
+ # Use `default_incomplete` to transition the subscription to `status=past_due` when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method.
561
+ #
562
+ # Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes).
563
+ #
564
+ # Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
565
+ attr_accessor :payment_behavior
566
+ # Payment settings to pass to invoices created by the subscription.
567
+ attr_accessor :payment_settings
568
+ # Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval.
569
+ attr_accessor :pending_invoice_item_interval
570
+ # Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`.
571
+ attr_accessor :proration_behavior
572
+ # If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#upcoming_invoice) endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations.
573
+ attr_accessor :proration_date
574
+ # If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. This will be unset if you POST an empty value.
575
+ attr_accessor :transfer_data
576
+ # Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`.
577
+ attr_accessor :trial_end
578
+ # Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
579
+ attr_accessor :trial_from_plan
580
+ # Settings related to subscription trials.
581
+ attr_accessor :trial_settings
582
+
583
+ def initialize(
584
+ add_invoice_items: nil,
585
+ application_fee_percent: nil,
586
+ automatic_tax: nil,
587
+ billing_cycle_anchor: nil,
588
+ cancel_at: nil,
589
+ cancel_at_period_end: nil,
590
+ cancellation_details: nil,
591
+ collection_method: nil,
592
+ days_until_due: nil,
593
+ default_payment_method: nil,
594
+ default_source: nil,
595
+ default_tax_rates: nil,
596
+ description: nil,
597
+ discounts: nil,
598
+ expand: nil,
599
+ invoice_settings: nil,
600
+ items: nil,
601
+ metadata: nil,
602
+ off_session: nil,
603
+ on_behalf_of: nil,
604
+ pause_collection: nil,
605
+ payment_behavior: nil,
606
+ payment_settings: nil,
607
+ pending_invoice_item_interval: nil,
608
+ proration_behavior: nil,
609
+ proration_date: nil,
610
+ transfer_data: nil,
611
+ trial_end: nil,
612
+ trial_from_plan: nil,
613
+ trial_settings: nil
614
+ )
615
+ @add_invoice_items = add_invoice_items
616
+ @application_fee_percent = application_fee_percent
617
+ @automatic_tax = automatic_tax
618
+ @billing_cycle_anchor = billing_cycle_anchor
619
+ @cancel_at = cancel_at
620
+ @cancel_at_period_end = cancel_at_period_end
621
+ @cancellation_details = cancellation_details
622
+ @collection_method = collection_method
623
+ @days_until_due = days_until_due
624
+ @default_payment_method = default_payment_method
625
+ @default_source = default_source
626
+ @default_tax_rates = default_tax_rates
627
+ @description = description
628
+ @discounts = discounts
629
+ @expand = expand
630
+ @invoice_settings = invoice_settings
631
+ @items = items
632
+ @metadata = metadata
633
+ @off_session = off_session
634
+ @on_behalf_of = on_behalf_of
635
+ @pause_collection = pause_collection
636
+ @payment_behavior = payment_behavior
637
+ @payment_settings = payment_settings
638
+ @pending_invoice_item_interval = pending_invoice_item_interval
639
+ @proration_behavior = proration_behavior
640
+ @proration_date = proration_date
641
+ @transfer_data = transfer_data
642
+ @trial_end = trial_end
643
+ @trial_from_plan = trial_from_plan
644
+ @trial_settings = trial_settings
645
+ end
646
+ end
647
+
648
+ class DeleteDiscountParams < Stripe::RequestParams
649
+ end
650
+
651
+ class ListParams < Stripe::RequestParams
652
+ class AutomaticTax < Stripe::RequestParams
653
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
654
+ attr_accessor :enabled
655
+
656
+ def initialize(enabled: nil)
657
+ @enabled = enabled
658
+ end
659
+ end
660
+
661
+ class Created < Stripe::RequestParams
662
+ # Minimum value to filter by (exclusive)
663
+ attr_accessor :gt
664
+ # Minimum value to filter by (inclusive)
665
+ attr_accessor :gte
666
+ # Maximum value to filter by (exclusive)
667
+ attr_accessor :lt
668
+ # Maximum value to filter by (inclusive)
669
+ attr_accessor :lte
670
+
671
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
672
+ @gt = gt
673
+ @gte = gte
674
+ @lt = lt
675
+ @lte = lte
676
+ end
677
+ end
678
+
679
+ class CurrentPeriodEnd < Stripe::RequestParams
680
+ # Minimum value to filter by (exclusive)
681
+ attr_accessor :gt
682
+ # Minimum value to filter by (inclusive)
683
+ attr_accessor :gte
684
+ # Maximum value to filter by (exclusive)
685
+ attr_accessor :lt
686
+ # Maximum value to filter by (inclusive)
687
+ attr_accessor :lte
688
+
689
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
690
+ @gt = gt
691
+ @gte = gte
692
+ @lt = lt
693
+ @lte = lte
694
+ end
695
+ end
696
+
697
+ class CurrentPeriodStart < Stripe::RequestParams
698
+ # Minimum value to filter by (exclusive)
699
+ attr_accessor :gt
700
+ # Minimum value to filter by (inclusive)
701
+ attr_accessor :gte
702
+ # Maximum value to filter by (exclusive)
703
+ attr_accessor :lt
704
+ # Maximum value to filter by (inclusive)
705
+ attr_accessor :lte
706
+
707
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
708
+ @gt = gt
709
+ @gte = gte
710
+ @lt = lt
711
+ @lte = lte
712
+ end
713
+ end
714
+ # Filter subscriptions by their automatic tax settings.
715
+ attr_accessor :automatic_tax
716
+ # The collection method of the subscriptions to retrieve. Either `charge_automatically` or `send_invoice`.
717
+ attr_accessor :collection_method
718
+ # Only return subscriptions that were created during the given date interval.
719
+ attr_accessor :created
720
+ # Only return subscriptions whose current_period_end falls within the given date interval.
721
+ attr_accessor :current_period_end
722
+ # Only return subscriptions whose current_period_start falls within the given date interval.
723
+ attr_accessor :current_period_start
724
+ # The ID of the customer whose subscriptions will be retrieved.
725
+ attr_accessor :customer
726
+ # 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.
727
+ attr_accessor :ending_before
728
+ # Specifies which fields in the response should be expanded.
729
+ attr_accessor :expand
730
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
731
+ attr_accessor :limit
732
+ # The ID of the plan whose subscriptions will be retrieved.
733
+ attr_accessor :plan
734
+ # Filter for subscriptions that contain this recurring price ID.
735
+ attr_accessor :price
736
+ # 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.
737
+ attr_accessor :starting_after
738
+ # The status of the subscriptions to retrieve. Passing in a value of `canceled` will return all canceled subscriptions, including those belonging to deleted customers. Pass `ended` to find subscriptions that are canceled and subscriptions that are expired due to [incomplete payment](https://stripe.com/docs/billing/subscriptions/overview#subscription-statuses). Passing in a value of `all` will return subscriptions of all statuses. If no value is supplied, all subscriptions that have not been canceled are returned.
739
+ attr_accessor :status
740
+ # Filter for subscriptions that are associated with the specified test clock. The response will not include subscriptions with test clocks if this and the customer parameter is not set.
741
+ attr_accessor :test_clock
742
+
743
+ def initialize(
744
+ automatic_tax: nil,
745
+ collection_method: nil,
746
+ created: nil,
747
+ current_period_end: nil,
748
+ current_period_start: nil,
749
+ customer: nil,
750
+ ending_before: nil,
751
+ expand: nil,
752
+ limit: nil,
753
+ plan: nil,
754
+ price: nil,
755
+ starting_after: nil,
756
+ status: nil,
757
+ test_clock: nil
758
+ )
759
+ @automatic_tax = automatic_tax
760
+ @collection_method = collection_method
761
+ @created = created
762
+ @current_period_end = current_period_end
763
+ @current_period_start = current_period_start
764
+ @customer = customer
765
+ @ending_before = ending_before
766
+ @expand = expand
767
+ @limit = limit
768
+ @plan = plan
769
+ @price = price
770
+ @starting_after = starting_after
771
+ @status = status
772
+ @test_clock = test_clock
773
+ end
774
+ end
775
+
776
+ class CreateParams < Stripe::RequestParams
777
+ class AddInvoiceItem < Stripe::RequestParams
778
+ class Discount < Stripe::RequestParams
779
+ # ID of the coupon to create a new discount for.
780
+ attr_accessor :coupon
781
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
782
+ attr_accessor :discount
783
+ # ID of the promotion code to create a new discount for.
784
+ attr_accessor :promotion_code
785
+
786
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
787
+ @coupon = coupon
788
+ @discount = discount
789
+ @promotion_code = promotion_code
790
+ end
791
+ end
792
+
793
+ class PriceData < Stripe::RequestParams
794
+ # 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).
795
+ attr_accessor :currency
796
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
797
+ attr_accessor :product
798
+ # 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.
799
+ attr_accessor :tax_behavior
800
+ # 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.
801
+ attr_accessor :unit_amount
802
+ # 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.
803
+ attr_accessor :unit_amount_decimal
804
+
805
+ def initialize(
806
+ currency: nil,
807
+ product: nil,
808
+ tax_behavior: nil,
809
+ unit_amount: nil,
810
+ unit_amount_decimal: nil
811
+ )
812
+ @currency = currency
813
+ @product = product
814
+ @tax_behavior = tax_behavior
815
+ @unit_amount = unit_amount
816
+ @unit_amount_decimal = unit_amount_decimal
817
+ end
818
+ end
819
+ # The coupons to redeem into discounts for the item.
820
+ attr_accessor :discounts
821
+ # The ID of the price object. One of `price` or `price_data` is required.
822
+ attr_accessor :price
823
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
824
+ attr_accessor :price_data
825
+ # Quantity for this item. Defaults to 1.
826
+ attr_accessor :quantity
827
+ # The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
828
+ attr_accessor :tax_rates
829
+
830
+ def initialize(discounts: nil, price: nil, price_data: nil, quantity: nil, tax_rates: nil)
831
+ @discounts = discounts
832
+ @price = price
833
+ @price_data = price_data
834
+ @quantity = quantity
835
+ @tax_rates = tax_rates
836
+ end
837
+ end
838
+
839
+ class AutomaticTax < Stripe::RequestParams
840
+ class Liability < Stripe::RequestParams
841
+ # The connected account being referenced when `type` is `account`.
842
+ attr_accessor :account
843
+ # Type of the account referenced in the request.
844
+ attr_accessor :type
845
+
846
+ def initialize(account: nil, type: nil)
847
+ @account = account
848
+ @type = type
849
+ end
850
+ end
851
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
852
+ attr_accessor :enabled
853
+ # 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.
854
+ attr_accessor :liability
855
+
856
+ def initialize(enabled: nil, liability: nil)
857
+ @enabled = enabled
858
+ @liability = liability
859
+ end
860
+ end
861
+
862
+ class BillingCycleAnchorConfig < Stripe::RequestParams
863
+ # The day of the month the billing_cycle_anchor should be. Ranges from 1 to 31.
864
+ attr_accessor :day_of_month
865
+ # The hour of the day the billing_cycle_anchor should be. Ranges from 0 to 23.
866
+ attr_accessor :hour
867
+ # The minute of the hour the billing_cycle_anchor should be. Ranges from 0 to 59.
868
+ attr_accessor :minute
869
+ # The month to start full cycle billing periods. Ranges from 1 to 12.
870
+ attr_accessor :month
871
+ # The second of the minute the billing_cycle_anchor should be. Ranges from 0 to 59.
872
+ attr_accessor :second
873
+
874
+ def initialize(day_of_month: nil, hour: nil, minute: nil, month: nil, second: nil)
875
+ @day_of_month = day_of_month
876
+ @hour = hour
877
+ @minute = minute
878
+ @month = month
879
+ @second = second
880
+ end
881
+ end
882
+
883
+ class Discount < Stripe::RequestParams
884
+ # ID of the coupon to create a new discount for.
885
+ attr_accessor :coupon
886
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
887
+ attr_accessor :discount
888
+ # ID of the promotion code to create a new discount for.
889
+ attr_accessor :promotion_code
890
+
891
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
892
+ @coupon = coupon
893
+ @discount = discount
894
+ @promotion_code = promotion_code
895
+ end
896
+ end
897
+
898
+ class InvoiceSettings < Stripe::RequestParams
899
+ class Issuer < Stripe::RequestParams
900
+ # The connected account being referenced when `type` is `account`.
901
+ attr_accessor :account
902
+ # Type of the account referenced in the request.
903
+ attr_accessor :type
904
+
905
+ def initialize(account: nil, type: nil)
906
+ @account = account
907
+ @type = type
908
+ end
909
+ end
910
+ # The account tax IDs associated with the subscription. Will be set on invoices generated by the subscription.
911
+ attr_accessor :account_tax_ids
912
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
913
+ attr_accessor :issuer
914
+
915
+ def initialize(account_tax_ids: nil, issuer: nil)
916
+ @account_tax_ids = account_tax_ids
917
+ @issuer = issuer
918
+ end
919
+ end
920
+
921
+ class Item < Stripe::RequestParams
922
+ class Discount < Stripe::RequestParams
923
+ # ID of the coupon to create a new discount for.
924
+ attr_accessor :coupon
925
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
926
+ attr_accessor :discount
927
+ # ID of the promotion code to create a new discount for.
928
+ attr_accessor :promotion_code
929
+
930
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
931
+ @coupon = coupon
932
+ @discount = discount
933
+ @promotion_code = promotion_code
934
+ end
935
+ end
936
+
937
+ class PriceData < Stripe::RequestParams
938
+ class Recurring < Stripe::RequestParams
939
+ # Specifies billing frequency. Either `day`, `week`, `month` or `year`.
940
+ attr_accessor :interval
941
+ # 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).
942
+ attr_accessor :interval_count
943
+
944
+ def initialize(interval: nil, interval_count: nil)
945
+ @interval = interval
946
+ @interval_count = interval_count
947
+ end
948
+ end
949
+ # 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).
950
+ attr_accessor :currency
951
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
952
+ attr_accessor :product
953
+ # The recurring components of a price such as `interval` and `interval_count`.
954
+ attr_accessor :recurring
955
+ # 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.
956
+ attr_accessor :tax_behavior
957
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
958
+ attr_accessor :unit_amount
959
+ # 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.
960
+ attr_accessor :unit_amount_decimal
961
+
962
+ def initialize(
963
+ currency: nil,
964
+ product: nil,
965
+ recurring: nil,
966
+ tax_behavior: nil,
967
+ unit_amount: nil,
968
+ unit_amount_decimal: nil
969
+ )
970
+ @currency = currency
971
+ @product = product
972
+ @recurring = recurring
973
+ @tax_behavior = tax_behavior
974
+ @unit_amount = unit_amount
975
+ @unit_amount_decimal = unit_amount_decimal
976
+ end
977
+ end
978
+ # The coupons to redeem into discounts for the subscription item.
979
+ attr_accessor :discounts
980
+ # 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`.
981
+ attr_accessor :metadata
982
+ # Plan ID for this item, as a string.
983
+ attr_accessor :plan
984
+ # The ID of the price object.
985
+ attr_accessor :price
986
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
987
+ attr_accessor :price_data
988
+ # Quantity for this item.
989
+ attr_accessor :quantity
990
+ # 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.
991
+ attr_accessor :tax_rates
992
+
993
+ def initialize(
994
+ discounts: nil,
995
+ metadata: nil,
996
+ plan: nil,
997
+ price: nil,
998
+ price_data: nil,
999
+ quantity: nil,
1000
+ tax_rates: nil
1001
+ )
1002
+ @discounts = discounts
1003
+ @metadata = metadata
1004
+ @plan = plan
1005
+ @price = price
1006
+ @price_data = price_data
1007
+ @quantity = quantity
1008
+ @tax_rates = tax_rates
1009
+ end
1010
+ end
1011
+
1012
+ class PaymentSettings < Stripe::RequestParams
1013
+ class PaymentMethodOptions < Stripe::RequestParams
1014
+ class AcssDebit < Stripe::RequestParams
1015
+ class MandateOptions < Stripe::RequestParams
1016
+ # Transaction type of the mandate.
1017
+ attr_accessor :transaction_type
1018
+
1019
+ def initialize(transaction_type: nil)
1020
+ @transaction_type = transaction_type
1021
+ end
1022
+ end
1023
+ # Additional fields for Mandate creation
1024
+ attr_accessor :mandate_options
1025
+ # Verification method for the intent
1026
+ attr_accessor :verification_method
1027
+
1028
+ def initialize(mandate_options: nil, verification_method: nil)
1029
+ @mandate_options = mandate_options
1030
+ @verification_method = verification_method
1031
+ end
1032
+ end
1033
+
1034
+ class Bancontact < Stripe::RequestParams
1035
+ # Preferred language of the Bancontact authorization page that the customer is redirected to.
1036
+ attr_accessor :preferred_language
1037
+
1038
+ def initialize(preferred_language: nil)
1039
+ @preferred_language = preferred_language
1040
+ end
1041
+ end
1042
+
1043
+ class Card < Stripe::RequestParams
1044
+ class MandateOptions < Stripe::RequestParams
1045
+ # Amount to be charged for future payments.
1046
+ attr_accessor :amount
1047
+ # One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param.
1048
+ attr_accessor :amount_type
1049
+ # A description of the mandate or subscription that is meant to be displayed to the customer.
1050
+ attr_accessor :description
1051
+
1052
+ def initialize(amount: nil, amount_type: nil, description: nil)
1053
+ @amount = amount
1054
+ @amount_type = amount_type
1055
+ @description = description
1056
+ end
1057
+ end
1058
+ # Configuration options for setting up an eMandate for cards issued in India.
1059
+ attr_accessor :mandate_options
1060
+ # Selected network to process this Subscription on. Depends on the available networks of the card attached to the Subscription. Can be only set confirm-time.
1061
+ attr_accessor :network
1062
+ # We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
1063
+ attr_accessor :request_three_d_secure
1064
+
1065
+ def initialize(mandate_options: nil, network: nil, request_three_d_secure: nil)
1066
+ @mandate_options = mandate_options
1067
+ @network = network
1068
+ @request_three_d_secure = request_three_d_secure
1069
+ end
1070
+ end
1071
+
1072
+ class CustomerBalance < Stripe::RequestParams
1073
+ class BankTransfer < Stripe::RequestParams
1074
+ class EuBankTransfer < Stripe::RequestParams
1075
+ # The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
1076
+ attr_accessor :country
1077
+
1078
+ def initialize(country: nil)
1079
+ @country = country
1080
+ end
1081
+ end
1082
+ # Configuration for eu_bank_transfer funding type.
1083
+ attr_accessor :eu_bank_transfer
1084
+ # The bank transfer type that can be used for funding. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
1085
+ attr_accessor :type
1086
+
1087
+ def initialize(eu_bank_transfer: nil, type: nil)
1088
+ @eu_bank_transfer = eu_bank_transfer
1089
+ @type = type
1090
+ end
1091
+ end
1092
+ # Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
1093
+ attr_accessor :bank_transfer
1094
+ # The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
1095
+ attr_accessor :funding_type
1096
+
1097
+ def initialize(bank_transfer: nil, funding_type: nil)
1098
+ @bank_transfer = bank_transfer
1099
+ @funding_type = funding_type
1100
+ end
1101
+ end
1102
+
1103
+ class Konbini < Stripe::RequestParams
1104
+ end
1105
+
1106
+ class SepaDebit < Stripe::RequestParams
1107
+ end
1108
+
1109
+ class UsBankAccount < Stripe::RequestParams
1110
+ class FinancialConnections < Stripe::RequestParams
1111
+ class Filters < Stripe::RequestParams
1112
+ # The account subcategories to use to filter for selectable accounts. Valid subcategories are `checking` and `savings`.
1113
+ attr_accessor :account_subcategories
1114
+
1115
+ def initialize(account_subcategories: nil)
1116
+ @account_subcategories = account_subcategories
1117
+ end
1118
+ end
1119
+ # Provide filters for the linked accounts that the customer can select for the payment method.
1120
+ attr_accessor :filters
1121
+ # The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
1122
+ attr_accessor :permissions
1123
+ # List of data features that you would like to retrieve upon account creation.
1124
+ attr_accessor :prefetch
1125
+
1126
+ def initialize(filters: nil, permissions: nil, prefetch: nil)
1127
+ @filters = filters
1128
+ @permissions = permissions
1129
+ @prefetch = prefetch
1130
+ end
1131
+ end
1132
+ # Additional fields for Financial Connections Session creation
1133
+ attr_accessor :financial_connections
1134
+ # Verification method for the intent
1135
+ attr_accessor :verification_method
1136
+
1137
+ def initialize(financial_connections: nil, verification_method: nil)
1138
+ @financial_connections = financial_connections
1139
+ @verification_method = verification_method
1140
+ end
1141
+ end
1142
+ # This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
1143
+ attr_accessor :acss_debit
1144
+ # This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent.
1145
+ attr_accessor :bancontact
1146
+ # This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent.
1147
+ attr_accessor :card
1148
+ # This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent.
1149
+ attr_accessor :customer_balance
1150
+ # This sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent.
1151
+ attr_accessor :konbini
1152
+ # This sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice’s PaymentIntent.
1153
+ attr_accessor :sepa_debit
1154
+ # This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent.
1155
+ attr_accessor :us_bank_account
1156
+
1157
+ def initialize(
1158
+ acss_debit: nil,
1159
+ bancontact: nil,
1160
+ card: nil,
1161
+ customer_balance: nil,
1162
+ konbini: nil,
1163
+ sepa_debit: nil,
1164
+ us_bank_account: nil
1165
+ )
1166
+ @acss_debit = acss_debit
1167
+ @bancontact = bancontact
1168
+ @card = card
1169
+ @customer_balance = customer_balance
1170
+ @konbini = konbini
1171
+ @sepa_debit = sepa_debit
1172
+ @us_bank_account = us_bank_account
1173
+ end
1174
+ end
1175
+ # Payment-method-specific configuration to provide to invoices created by the subscription.
1176
+ attr_accessor :payment_method_options
1177
+ # The list of payment method types (e.g. card) to provide to the invoice’s PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration
1178
+ attr_accessor :payment_method_types
1179
+ # Configure whether Stripe updates `subscription.default_payment_method` when payment succeeds. Defaults to `off` if unspecified.
1180
+ attr_accessor :save_default_payment_method
1181
+
1182
+ def initialize(
1183
+ payment_method_options: nil,
1184
+ payment_method_types: nil,
1185
+ save_default_payment_method: nil
1186
+ )
1187
+ @payment_method_options = payment_method_options
1188
+ @payment_method_types = payment_method_types
1189
+ @save_default_payment_method = save_default_payment_method
1190
+ end
1191
+ end
1192
+
1193
+ class PendingInvoiceItemInterval < Stripe::RequestParams
1194
+ # Specifies invoicing frequency. Either `day`, `week`, `month` or `year`.
1195
+ attr_accessor :interval
1196
+ # The number of intervals between invoices. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks).
1197
+ attr_accessor :interval_count
1198
+
1199
+ def initialize(interval: nil, interval_count: nil)
1200
+ @interval = interval
1201
+ @interval_count = interval_count
1202
+ end
1203
+ end
1204
+
1205
+ class TransferData < Stripe::RequestParams
1206
+ # 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.
1207
+ attr_accessor :amount_percent
1208
+ # ID of an existing, connected Stripe account.
1209
+ attr_accessor :destination
1210
+
1211
+ def initialize(amount_percent: nil, destination: nil)
1212
+ @amount_percent = amount_percent
1213
+ @destination = destination
1214
+ end
1215
+ end
1216
+
1217
+ class TrialSettings < Stripe::RequestParams
1218
+ class EndBehavior < Stripe::RequestParams
1219
+ # Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
1220
+ attr_accessor :missing_payment_method
1221
+
1222
+ def initialize(missing_payment_method: nil)
1223
+ @missing_payment_method = missing_payment_method
1224
+ end
1225
+ end
1226
+ # Defines how the subscription should behave when the user's free trial ends.
1227
+ attr_accessor :end_behavior
1228
+
1229
+ def initialize(end_behavior: nil)
1230
+ @end_behavior = end_behavior
1231
+ end
1232
+ end
1233
+ # A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. You may pass up to 20 items.
1234
+ attr_accessor :add_invoice_items
1235
+ # 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).
1236
+ attr_accessor :application_fee_percent
1237
+ # Automatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed.
1238
+ attr_accessor :automatic_tax
1239
+ # For new subscriptions, a past timestamp to backdate the subscription's start date to. If set, the first invoice will contain a proration for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor.
1240
+ attr_accessor :backdate_start_date
1241
+ # A future timestamp in UTC format to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). The anchor is the reference point that aligns future billing cycle dates. It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals.
1242
+ attr_accessor :billing_cycle_anchor
1243
+ # Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC.
1244
+ attr_accessor :billing_cycle_anchor_config
1245
+ # A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period.
1246
+ attr_accessor :cancel_at
1247
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
1248
+ attr_accessor :cancel_at_period_end
1249
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the 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`.
1250
+ attr_accessor :collection_method
1251
+ # 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).
1252
+ attr_accessor :currency
1253
+ # The identifier of the customer to subscribe.
1254
+ attr_accessor :customer
1255
+ # Number of days a customer has to pay invoices generated by this subscription. Valid only for subscriptions where `collection_method` is set to `send_invoice`.
1256
+ attr_accessor :days_until_due
1257
+ # ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over `default_source`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).
1258
+ attr_accessor :default_payment_method
1259
+ # ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If `default_payment_method` is also set, `default_payment_method` will take precedence. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).
1260
+ attr_accessor :default_source
1261
+ # The tax rates that will apply to any subscription item that does not have `tax_rates` set. Invoices created will have their `default_tax_rates` populated from the subscription.
1262
+ attr_accessor :default_tax_rates
1263
+ # The subscription's 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.
1264
+ attr_accessor :description
1265
+ # The coupons to redeem into discounts for the subscription. If not specified or empty, inherits the discount from the subscription's customer.
1266
+ attr_accessor :discounts
1267
+ # Specifies which fields in the response should be expanded.
1268
+ attr_accessor :expand
1269
+ # All invoices will be billed using the specified settings.
1270
+ attr_accessor :invoice_settings
1271
+ # A list of up to 20 subscription items, each with an attached price.
1272
+ attr_accessor :items
1273
+ # 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`.
1274
+ attr_accessor :metadata
1275
+ # Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `false` (on-session).
1276
+ attr_accessor :off_session
1277
+ # The account on behalf of which to charge, for each of the subscription's invoices.
1278
+ attr_accessor :on_behalf_of
1279
+ # Only applies to subscriptions with `collection_method=charge_automatically`.
1280
+ #
1281
+ # Use `allow_incomplete` to create Subscriptions with `status=incomplete` if the first invoice can't be paid. Creating Subscriptions with this status allows you to manage scenarios where additional customer actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior.
1282
+ #
1283
+ # Use `default_incomplete` to create Subscriptions with `status=incomplete` when the first invoice requires payment, otherwise start as active. Subscriptions transition to `status=active` when successfully confirming the PaymentIntent on the first invoice. This allows simpler management of scenarios where additional customer actions are needed to pay a subscription’s invoice, such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. If the PaymentIntent is not confirmed within 23 hours Subscriptions transition to `status=incomplete_expired`, which is a terminal state.
1284
+ #
1285
+ # Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's first invoice can't be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further customer action is needed, this parameter doesn't create a Subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
1286
+ #
1287
+ # `pending_if_incomplete` is only used with updates and cannot be passed when creating a Subscription.
1288
+ #
1289
+ # Subscriptions with `collection_method=send_invoice` are automatically activated regardless of the first Invoice status.
1290
+ attr_accessor :payment_behavior
1291
+ # Payment settings to pass to invoices created by the subscription.
1292
+ attr_accessor :payment_settings
1293
+ # Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval.
1294
+ attr_accessor :pending_invoice_item_interval
1295
+ # Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) resulting from the `billing_cycle_anchor`. If no value is passed, the default is `create_prorations`.
1296
+ attr_accessor :proration_behavior
1297
+ # If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges.
1298
+ attr_accessor :transfer_data
1299
+ # Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
1300
+ attr_accessor :trial_end
1301
+ # Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
1302
+ attr_accessor :trial_from_plan
1303
+ # Integer representing the number of trial period days before the customer is charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
1304
+ attr_accessor :trial_period_days
1305
+ # Settings related to subscription trials.
1306
+ attr_accessor :trial_settings
1307
+
1308
+ def initialize(
1309
+ add_invoice_items: nil,
1310
+ application_fee_percent: nil,
1311
+ automatic_tax: nil,
1312
+ backdate_start_date: nil,
1313
+ billing_cycle_anchor: nil,
1314
+ billing_cycle_anchor_config: nil,
1315
+ cancel_at: nil,
1316
+ cancel_at_period_end: nil,
1317
+ collection_method: nil,
1318
+ currency: nil,
1319
+ customer: nil,
1320
+ days_until_due: nil,
1321
+ default_payment_method: nil,
1322
+ default_source: nil,
1323
+ default_tax_rates: nil,
1324
+ description: nil,
1325
+ discounts: nil,
1326
+ expand: nil,
1327
+ invoice_settings: nil,
1328
+ items: nil,
1329
+ metadata: nil,
1330
+ off_session: nil,
1331
+ on_behalf_of: nil,
1332
+ payment_behavior: nil,
1333
+ payment_settings: nil,
1334
+ pending_invoice_item_interval: nil,
1335
+ proration_behavior: nil,
1336
+ transfer_data: nil,
1337
+ trial_end: nil,
1338
+ trial_from_plan: nil,
1339
+ trial_period_days: nil,
1340
+ trial_settings: nil
1341
+ )
1342
+ @add_invoice_items = add_invoice_items
1343
+ @application_fee_percent = application_fee_percent
1344
+ @automatic_tax = automatic_tax
1345
+ @backdate_start_date = backdate_start_date
1346
+ @billing_cycle_anchor = billing_cycle_anchor
1347
+ @billing_cycle_anchor_config = billing_cycle_anchor_config
1348
+ @cancel_at = cancel_at
1349
+ @cancel_at_period_end = cancel_at_period_end
1350
+ @collection_method = collection_method
1351
+ @currency = currency
1352
+ @customer = customer
1353
+ @days_until_due = days_until_due
1354
+ @default_payment_method = default_payment_method
1355
+ @default_source = default_source
1356
+ @default_tax_rates = default_tax_rates
1357
+ @description = description
1358
+ @discounts = discounts
1359
+ @expand = expand
1360
+ @invoice_settings = invoice_settings
1361
+ @items = items
1362
+ @metadata = metadata
1363
+ @off_session = off_session
1364
+ @on_behalf_of = on_behalf_of
1365
+ @payment_behavior = payment_behavior
1366
+ @payment_settings = payment_settings
1367
+ @pending_invoice_item_interval = pending_invoice_item_interval
1368
+ @proration_behavior = proration_behavior
1369
+ @transfer_data = transfer_data
1370
+ @trial_end = trial_end
1371
+ @trial_from_plan = trial_from_plan
1372
+ @trial_period_days = trial_period_days
1373
+ @trial_settings = trial_settings
1374
+ end
1375
+ end
1376
+
1377
+ class SearchParams < Stripe::RequestParams
1378
+ # Specifies which fields in the response should be expanded.
1379
+ attr_accessor :expand
1380
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
1381
+ attr_accessor :limit
1382
+ # A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
1383
+ attr_accessor :page
1384
+ # The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for subscriptions](https://stripe.com/docs/search#query-fields-for-subscriptions).
1385
+ attr_accessor :query
1386
+
1387
+ def initialize(expand: nil, limit: nil, page: nil, query: nil)
1388
+ @expand = expand
1389
+ @limit = limit
1390
+ @page = page
1391
+ @query = query
1392
+ end
1393
+ end
1394
+
1395
+ class ResumeParams < Stripe::RequestParams
1396
+ # The billing cycle anchor that applies when the subscription is resumed. Either `now` or `unchanged`. The default is `now`. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
1397
+ attr_accessor :billing_cycle_anchor
1398
+ # Specifies which fields in the response should be expanded.
1399
+ attr_accessor :expand
1400
+ # Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`.
1401
+ attr_accessor :proration_behavior
1402
+ # If set, the proration will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint.
1403
+ attr_accessor :proration_date
1404
+
1405
+ def initialize(
1406
+ billing_cycle_anchor: nil,
1407
+ expand: nil,
1408
+ proration_behavior: nil,
1409
+ proration_date: nil
1410
+ )
1411
+ @billing_cycle_anchor = billing_cycle_anchor
1412
+ @expand = expand
1413
+ @proration_behavior = proration_behavior
1414
+ @proration_date = proration_date
1415
+ end
1416
+ end
1417
+
1418
+ # Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
1419
+ #
1420
+ # Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed.
1421
+ #
1422
+ # By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
1423
+ def cancel(subscription_exposed_id, params = {}, opts = {})
1424
+ request(
1425
+ method: :delete,
1426
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
1427
+ params: params,
1428
+ opts: opts,
1429
+ base_address: :api
1430
+ )
1431
+ end
1432
+
1433
+ # Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.
1434
+ #
1435
+ # When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
1436
+ # The payment_behavior parameter determines the exact behavior of the initial payment.
1437
+ #
1438
+ # To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
1439
+ # Schedules provide the flexibility to model more complex billing configurations that change over time.
1440
+ def create(params = {}, opts = {})
1441
+ request(
1442
+ method: :post,
1443
+ path: "/v1/subscriptions",
1444
+ params: params,
1445
+ opts: opts,
1446
+ base_address: :api
1447
+ )
1448
+ end
1449
+
1450
+ # Removes the currently applied discount on a subscription.
1451
+ def delete_discount(subscription_exposed_id, params = {}, opts = {})
1452
+ request(
1453
+ method: :delete,
1454
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
1455
+ params: params,
1456
+ opts: opts,
1457
+ base_address: :api
1458
+ )
1459
+ end
1460
+
1461
+ # By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled.
1462
+ def list(params = {}, opts = {})
1463
+ request(
1464
+ method: :get,
1465
+ path: "/v1/subscriptions",
1466
+ params: params,
1467
+ opts: opts,
1468
+ base_address: :api
1469
+ )
1470
+ end
1471
+
1472
+ # Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
1473
+ def resume(subscription, params = {}, opts = {})
1474
+ request(
1475
+ method: :post,
1476
+ path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(subscription) }),
1477
+ params: params,
1478
+ opts: opts,
1479
+ base_address: :api
1480
+ )
1481
+ end
1482
+
1483
+ # Retrieves the subscription with the given ID.
1484
+ def retrieve(subscription_exposed_id, params = {}, opts = {})
1485
+ request(
1486
+ method: :get,
1487
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
1488
+ params: params,
1489
+ opts: opts,
1490
+ base_address: :api
1491
+ )
1492
+ end
1493
+
1494
+ # Search for subscriptions you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
1495
+ # Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
1496
+ # conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
1497
+ # to an hour behind during outages. Search functionality is not available to merchants in India.
1498
+ def search(params = {}, opts = {})
1499
+ request(
1500
+ method: :get,
1501
+ path: "/v1/subscriptions/search",
1502
+ params: params,
1503
+ opts: opts,
1504
+ base_address: :api
1505
+ )
1506
+ end
1507
+
1508
+ # Updates an existing subscription to match the specified parameters.
1509
+ # When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes.
1510
+ # To preview how the proration is calculated, use the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint.
1511
+ #
1512
+ # By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they'll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they'll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month's 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
1513
+ #
1514
+ # Switching prices does not normally change the billing date or generate an immediate charge unless:
1515
+ #
1516
+ #
1517
+ # The billing interval is changed (for example, from monthly to yearly).
1518
+ # The subscription moves from free to paid.
1519
+ # A trial starts or ends.
1520
+ #
1521
+ #
1522
+ # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment).
1523
+ #
1524
+ # If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create).
1525
+ #
1526
+ # If you don't want to prorate, set the proration_behavior option to none. With this option, the customer is billed 100 on May 1 and 200 on June 1. Similarly, if you set proration_behavior to none when switching between different billing intervals (for example, from monthly to yearly), we don't generate any credits for the old subscription's unused time. We still reset the billing date and bill immediately for the new subscription.
1527
+ #
1528
+ # Updating the quantity on a subscription many times in an hour may result in [rate limiting. If you need to bill for a frequently changing quantity, consider integrating <a href="/docs/billing/subscriptions/usage-based">usage-based billing](https://stripe.com/docs/rate-limits) instead.
1529
+ def update(subscription_exposed_id, params = {}, opts = {})
1530
+ request(
1531
+ method: :post,
1532
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
1533
+ params: params,
1534
+ opts: opts,
1535
+ base_address: :api
1536
+ )
1537
+ end
1538
+ end
1539
+ end