stripe 5.38.0 → 15.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (708) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +742 -0
  3. data/CONTRIBUTING.md +25 -0
  4. data/Gemfile +12 -4
  5. data/Makefile +22 -0
  6. data/OPENAPI_VERSION +1 -0
  7. data/README.md +137 -27
  8. data/Rakefile +3 -6
  9. data/VERSION +1 -1
  10. data/examples/README.md +16 -0
  11. data/examples/example_template.rb +36 -0
  12. data/examples/meter_event_stream.rb +57 -0
  13. data/examples/thinevent_webhook_handler.rb +39 -0
  14. data/{bin → exe}/stripe-console +1 -1
  15. data/justfile +43 -0
  16. data/lib/data/ca-certificates.crt +1241 -1937
  17. data/lib/stripe/api_operations/create.rb +6 -2
  18. data/lib/stripe/api_operations/delete.rb +12 -7
  19. data/lib/stripe/api_operations/list.rb +6 -9
  20. data/lib/stripe/api_operations/nested_resource.rb +59 -31
  21. data/lib/stripe/api_operations/request.rb +30 -65
  22. data/lib/stripe/api_operations/save.rb +20 -10
  23. data/lib/stripe/api_operations/search.rb +21 -0
  24. data/lib/stripe/api_operations/singleton_save.rb +90 -0
  25. data/lib/stripe/api_requestor.rb +1136 -0
  26. data/lib/stripe/api_resource.rb +49 -34
  27. data/lib/stripe/api_resource_test_helpers.rb +53 -0
  28. data/lib/stripe/{resources/usage_record.rb → api_version.rb} +2 -2
  29. data/lib/stripe/connection_manager.rb +28 -11
  30. data/lib/stripe/errors.rb +11 -20
  31. data/lib/stripe/event_types.rb +15 -0
  32. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  33. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  34. data/lib/stripe/events/v2_core_event_destination_ping_event.rb +21 -0
  35. data/lib/stripe/instrumentation.rb +37 -15
  36. data/lib/stripe/list_object.rb +5 -3
  37. data/lib/stripe/multipart_encoder.rb +7 -7
  38. data/lib/stripe/oauth.rb +14 -21
  39. data/lib/stripe/object_types.rb +157 -91
  40. data/lib/stripe/request_options.rb +129 -0
  41. data/lib/stripe/request_params.rb +24 -0
  42. data/lib/stripe/resources/account.rb +4854 -30
  43. data/lib/stripe/resources/account_link.rb +66 -0
  44. data/lib/stripe/resources/account_session.rb +868 -0
  45. data/lib/stripe/resources/alipay_account.rb +1 -1
  46. data/lib/stripe/resources/apple_pay_domain.rb +91 -0
  47. data/lib/stripe/resources/application.rb +20 -0
  48. data/lib/stripe/resources/application_fee.rb +96 -2
  49. data/lib/stripe/resources/application_fee_refund.rb +26 -2
  50. data/lib/stripe/resources/apps/secret.rb +196 -0
  51. data/lib/stripe/resources/balance.rb +178 -0
  52. data/lib/stripe/resources/balance_transaction.rb +124 -0
  53. data/lib/stripe/resources/bank_account.rb +137 -6
  54. data/lib/stripe/resources/billing/alert.rb +222 -0
  55. data/lib/stripe/resources/billing/alert_triggered.rb +26 -0
  56. data/lib/stripe/resources/billing/credit_balance_summary.rb +54 -0
  57. data/lib/stripe/resources/billing/credit_balance_transaction.rb +133 -0
  58. data/lib/stripe/resources/billing/credit_grant.rb +307 -0
  59. data/lib/stripe/resources/billing/meter.rb +254 -0
  60. data/lib/stripe/resources/billing/meter_event.rb +61 -0
  61. data/lib/stripe/resources/billing/meter_event_adjustment.rb +69 -0
  62. data/lib/stripe/resources/billing/meter_event_summary.rb +32 -0
  63. data/lib/stripe/resources/billing_portal/configuration.rb +587 -0
  64. data/lib/stripe/resources/billing_portal/session.rb +298 -0
  65. data/lib/stripe/resources/capability.rb +91 -2
  66. data/lib/stripe/resources/card.rb +111 -3
  67. data/lib/stripe/resources/cash_balance.rb +43 -0
  68. data/lib/stripe/resources/charge.rb +1682 -2
  69. data/lib/stripe/resources/checkout/session.rb +3666 -2
  70. data/lib/stripe/resources/climate/order.rb +234 -0
  71. data/lib/stripe/resources/climate/product.rb +74 -0
  72. data/lib/stripe/resources/climate/supplier.rb +71 -0
  73. data/lib/stripe/resources/confirmation_token.rb +1498 -0
  74. data/lib/stripe/resources/connect_collection_transfer.rb +24 -0
  75. data/lib/stripe/resources/country_spec.rb +68 -0
  76. data/lib/stripe/resources/coupon.rb +236 -0
  77. data/lib/stripe/resources/credit_note.rb +709 -9
  78. data/lib/stripe/resources/credit_note_line_item.rb +71 -0
  79. data/lib/stripe/resources/customer.rb +1015 -16
  80. data/lib/stripe/resources/customer_balance_transaction.rb +38 -1
  81. data/lib/stripe/resources/customer_cash_balance_transaction.rb +124 -0
  82. data/lib/stripe/resources/customer_session.rb +188 -0
  83. data/lib/stripe/resources/discount.rb +37 -0
  84. data/lib/stripe/resources/dispute.rb +650 -2
  85. data/lib/stripe/resources/entitlements/active_entitlement.rb +63 -0
  86. data/lib/stripe/resources/entitlements/active_entitlement_summary.rb +23 -0
  87. data/lib/stripe/resources/entitlements/feature.rb +130 -0
  88. data/lib/stripe/resources/ephemeral_key.rb +44 -0
  89. data/lib/stripe/resources/event.rb +130 -0
  90. data/lib/stripe/resources/exchange_rate.rb +58 -0
  91. data/lib/stripe/resources/file.rb +139 -15
  92. data/lib/stripe/resources/file_link.rb +129 -0
  93. data/lib/stripe/resources/financial_connections/account.rb +363 -0
  94. data/lib/stripe/resources/financial_connections/account_owner.rb +31 -0
  95. data/lib/stripe/resources/financial_connections/account_ownership.rb +23 -0
  96. data/lib/stripe/resources/financial_connections/session.rb +121 -0
  97. data/lib/stripe/resources/financial_connections/transaction.rb +118 -0
  98. data/lib/stripe/resources/forwarding/request.rb +208 -0
  99. data/lib/stripe/resources/funding_instructions.rb +332 -0
  100. data/lib/stripe/resources/identity/verification_report.rb +287 -0
  101. data/lib/stripe/resources/identity/verification_session.rb +474 -4
  102. data/lib/stripe/resources/invoice.rb +3525 -17
  103. data/lib/stripe/resources/invoice_item.rb +453 -0
  104. data/lib/stripe/resources/invoice_line_item.rb +372 -1
  105. data/lib/stripe/resources/invoice_payment.rb +112 -0
  106. data/lib/stripe/resources/invoice_rendering_template.rb +120 -0
  107. data/lib/stripe/resources/issuing/authorization.rb +1313 -4
  108. data/lib/stripe/resources/issuing/card.rb +785 -4
  109. data/lib/stripe/resources/issuing/cardholder.rb +684 -0
  110. data/lib/stripe/resources/issuing/dispute.rb +828 -2
  111. data/lib/stripe/resources/issuing/personalization_design.rb +395 -0
  112. data/lib/stripe/resources/issuing/physical_bundle.rb +80 -0
  113. data/lib/stripe/resources/issuing/token.rb +198 -0
  114. data/lib/stripe/resources/issuing/transaction.rb +991 -0
  115. data/lib/stripe/resources/line_item.rb +51 -0
  116. data/lib/stripe/resources/login_link.rb +12 -0
  117. data/lib/stripe/resources/mandate.rb +146 -0
  118. data/lib/stripe/resources/payment_intent.rb +8876 -6
  119. data/lib/stripe/resources/payment_link.rb +1692 -0
  120. data/lib/stripe/resources/payment_method.rb +1570 -4
  121. data/lib/stripe/resources/payment_method_configuration.rb +3189 -0
  122. data/lib/stripe/resources/payment_method_domain.rb +236 -0
  123. data/lib/stripe/resources/payout.rb +271 -4
  124. data/lib/stripe/resources/person.rb +295 -1
  125. data/lib/stripe/resources/plan.rb +352 -0
  126. data/lib/stripe/resources/price.rb +642 -0
  127. data/lib/stripe/resources/product.rb +534 -0
  128. data/lib/stripe/resources/product_feature.rb +25 -0
  129. data/lib/stripe/resources/promotion_code.rb +237 -0
  130. data/lib/stripe/resources/quote.rb +1015 -38
  131. data/lib/stripe/resources/radar/early_fraud_warning.rb +85 -0
  132. data/lib/stripe/resources/radar/value_list.rb +171 -0
  133. data/lib/stripe/resources/radar/value_list_item.rb +131 -0
  134. data/lib/stripe/resources/refund.rb +494 -0
  135. data/lib/stripe/resources/reporting/report_run.rb +172 -0
  136. data/lib/stripe/resources/reporting/report_type.rb +48 -1
  137. data/lib/stripe/resources/reserve_transaction.rb +22 -0
  138. data/lib/stripe/resources/reversal.rb +38 -2
  139. data/lib/stripe/resources/review.rb +122 -2
  140. data/lib/stripe/resources/setup_attempt.rb +380 -0
  141. data/lib/stripe/resources/setup_intent.rb +3432 -4
  142. data/lib/stripe/resources/shipping_rate.rb +287 -0
  143. data/lib/stripe/resources/sigma/scheduled_query_run.rb +62 -0
  144. data/lib/stripe/resources/source.rb +1250 -10
  145. data/lib/stripe/resources/source_mandate_notification.rb +66 -0
  146. data/lib/stripe/resources/source_transaction.rb +93 -0
  147. data/lib/stripe/resources/subscription.rb +1871 -3
  148. data/lib/stripe/resources/subscription_item.rb +399 -10
  149. data/lib/stripe/resources/subscription_schedule.rb +1455 -4
  150. data/lib/stripe/resources/tax/calculation.rb +430 -0
  151. data/lib/stripe/resources/tax/calculation_line_item.rb +71 -0
  152. data/lib/stripe/resources/tax/registration.rb +2667 -0
  153. data/lib/stripe/resources/tax/settings.rb +134 -0
  154. data/lib/stripe/resources/tax/transaction.rb +314 -0
  155. data/lib/stripe/resources/tax/transaction_line_item.rb +44 -0
  156. data/lib/stripe/resources/tax_code.rb +35 -0
  157. data/lib/stripe/resources/tax_deducted_at_source.rb +22 -0
  158. data/lib/stripe/resources/tax_id.rb +144 -11
  159. data/lib/stripe/resources/tax_rate.rb +217 -0
  160. data/lib/stripe/resources/terminal/configuration.rb +1328 -0
  161. data/lib/stripe/resources/terminal/connection_token.rb +34 -0
  162. data/lib/stripe/resources/terminal/location.rb +222 -0
  163. data/lib/stripe/resources/terminal/reader.rb +886 -0
  164. data/lib/stripe/resources/test_helpers/test_clock.rb +156 -0
  165. data/lib/stripe/resources/token.rb +1249 -0
  166. data/lib/stripe/resources/topup.rb +204 -2
  167. data/lib/stripe/resources/transfer.rb +173 -6
  168. data/lib/stripe/resources/treasury/credit_reversal.rb +120 -0
  169. data/lib/stripe/resources/treasury/debit_reversal.rb +131 -0
  170. data/lib/stripe/resources/treasury/financial_account.rb +833 -0
  171. data/lib/stripe/resources/treasury/financial_account_features.rb +204 -0
  172. data/lib/stripe/resources/treasury/inbound_transfer.rb +356 -0
  173. data/lib/stripe/resources/treasury/outbound_payment.rb +638 -0
  174. data/lib/stripe/resources/treasury/outbound_transfer.rb +493 -0
  175. data/lib/stripe/resources/treasury/received_credit.rb +284 -0
  176. data/lib/stripe/resources/treasury/received_debit.rb +243 -0
  177. data/lib/stripe/resources/treasury/transaction.rb +193 -0
  178. data/lib/stripe/resources/treasury/transaction_entry.rb +178 -0
  179. data/lib/stripe/resources/v2/amount.rb +9 -0
  180. data/lib/stripe/resources/v2/billing/meter_event.rb +34 -0
  181. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +36 -0
  182. data/lib/stripe/resources/v2/billing/meter_event_session.rb +29 -0
  183. data/lib/stripe/resources/v2/event.rb +41 -0
  184. data/lib/stripe/resources/v2/event_destination.rb +73 -0
  185. data/lib/stripe/resources/webhook_endpoint.rb +167 -0
  186. data/lib/stripe/resources.rb +70 -12
  187. data/lib/stripe/search_result_object.rb +89 -0
  188. data/lib/stripe/services/account_capability_service.rb +71 -0
  189. data/lib/stripe/services/account_external_account_service.rb +317 -0
  190. data/lib/stripe/services/account_link_service.rb +63 -0
  191. data/lib/stripe/services/account_login_link_service.rb +28 -0
  192. data/lib/stripe/services/account_person_service.rb +1019 -0
  193. data/lib/stripe/services/account_service.rb +4171 -0
  194. data/lib/stripe/services/account_session_service.rb +569 -0
  195. data/lib/stripe/services/apple_pay_domain_service.rb +100 -0
  196. data/lib/stripe/services/application_fee_refund_service.rb +114 -0
  197. data/lib/stripe/services/application_fee_service.rb +92 -0
  198. data/lib/stripe/services/apps/secret_service.rb +168 -0
  199. data/lib/stripe/services/apps_service.rb +13 -0
  200. data/lib/stripe/services/balance_service.rb +21 -0
  201. data/lib/stripe/services/balance_transaction_service.rb +101 -0
  202. data/lib/stripe/services/billing/alert_service.rb +187 -0
  203. data/lib/stripe/services/billing/credit_balance_summary_service.rb +67 -0
  204. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +70 -0
  205. data/lib/stripe/services/billing/credit_grant_service.rb +240 -0
  206. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +45 -0
  207. data/lib/stripe/services/billing/meter_event_service.rb +40 -0
  208. data/lib/stripe/services/billing/meter_event_summary_service.rb +58 -0
  209. data/lib/stripe/services/billing/meter_service.rb +211 -0
  210. data/lib/stripe/services/billing_portal/configuration_service.rb +496 -0
  211. data/lib/stripe/services/billing_portal/session_service.rb +192 -0
  212. data/lib/stripe/services/billing_portal_service.rb +14 -0
  213. data/lib/stripe/services/billing_service.rb +20 -0
  214. data/lib/stripe/services/charge_service.rb +471 -0
  215. data/lib/stripe/services/checkout/session_line_item_service.rb +37 -0
  216. data/lib/stripe/services/checkout/session_service.rb +2495 -0
  217. data/lib/stripe/services/checkout_service.rb +13 -0
  218. data/lib/stripe/services/climate/order_service.rb +170 -0
  219. data/lib/stripe/services/climate/product_service.rb +57 -0
  220. data/lib/stripe/services/climate/supplier_service.rb +57 -0
  221. data/lib/stripe/services/climate_service.rb +15 -0
  222. data/lib/stripe/services/confirmation_token_service.rb +26 -0
  223. data/lib/stripe/services/country_spec_service.rb +55 -0
  224. data/lib/stripe/services/coupon_service.rb +202 -0
  225. data/lib/stripe/services/credit_note_line_item_service.rb +35 -0
  226. data/lib/stripe/services/credit_note_preview_lines_service.rb +169 -0
  227. data/lib/stripe/services/credit_note_service.rb +457 -0
  228. data/lib/stripe/services/customer_balance_transaction_service.rb +113 -0
  229. data/lib/stripe/services/customer_cash_balance_service.rb +57 -0
  230. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +55 -0
  231. data/lib/stripe/services/customer_funding_instructions_service.rb +61 -0
  232. data/lib/stripe/services/customer_payment_method_service.rb +68 -0
  233. data/lib/stripe/services/customer_payment_source_service.rb +255 -0
  234. data/lib/stripe/services/customer_service.rb +664 -0
  235. data/lib/stripe/services/customer_session_service.rb +113 -0
  236. data/lib/stripe/services/customer_tax_id_service.rb +94 -0
  237. data/lib/stripe/services/dispute_service.rb +422 -0
  238. data/lib/stripe/services/entitlements/active_entitlement_service.rb +66 -0
  239. data/lib/stripe/services/entitlements/feature_service.rb +128 -0
  240. data/lib/stripe/services/entitlements_service.rb +14 -0
  241. data/lib/stripe/services/ephemeral_key_service.rb +64 -0
  242. data/lib/stripe/services/event_service.rb +87 -0
  243. data/lib/stripe/services/exchange_rate_service.rb +55 -0
  244. data/lib/stripe/services/file_link_service.rb +132 -0
  245. data/lib/stripe/services/file_service.rb +124 -0
  246. data/lib/stripe/services/financial_connections/account_owner_service.rb +46 -0
  247. data/lib/stripe/services/financial_connections/account_service.rb +177 -0
  248. data/lib/stripe/services/financial_connections/session_service.rb +98 -0
  249. data/lib/stripe/services/financial_connections/transaction_service.rb +100 -0
  250. data/lib/stripe/services/financial_connections_service.rb +15 -0
  251. data/lib/stripe/services/forwarding/request_service.rb +147 -0
  252. data/lib/stripe/services/forwarding_service.rb +13 -0
  253. data/lib/stripe/services/identity/verification_report_service.rb +95 -0
  254. data/lib/stripe/services/identity/verification_session_service.rb +337 -0
  255. data/lib/stripe/services/identity_service.rb +14 -0
  256. data/lib/stripe/services/invoice_item_service.rb +394 -0
  257. data/lib/stripe/services/invoice_line_item_service.rb +252 -0
  258. data/lib/stripe/services/invoice_payment_service.rb +83 -0
  259. data/lib/stripe/services/invoice_rendering_template_service.rb +101 -0
  260. data/lib/stripe/services/invoice_service.rb +2900 -0
  261. data/lib/stripe/services/issuing/authorization_service.rb +169 -0
  262. data/lib/stripe/services/issuing/card_service.rb +507 -0
  263. data/lib/stripe/services/issuing/cardholder_service.rb +577 -0
  264. data/lib/stripe/services/issuing/dispute_service.rb +696 -0
  265. data/lib/stripe/services/issuing/personalization_design_service.rb +245 -0
  266. data/lib/stripe/services/issuing/physical_bundle_service.rb +70 -0
  267. data/lib/stripe/services/issuing/token_service.rb +114 -0
  268. data/lib/stripe/services/issuing/transaction_service.rb +118 -0
  269. data/lib/stripe/services/issuing_service.rb +20 -0
  270. data/lib/stripe/services/mandate_service.rb +26 -0
  271. data/lib/stripe/services/oauth_service.rb +63 -0
  272. data/lib/stripe/services/payment_intent_service.rb +7202 -0
  273. data/lib/stripe/services/payment_link_line_item_service.rb +35 -0
  274. data/lib/stripe/services/payment_link_service.rb +1333 -0
  275. data/lib/stripe/services/payment_method_configuration_service.rb +2306 -0
  276. data/lib/stripe/services/payment_method_domain_service.rb +142 -0
  277. data/lib/stripe/services/payment_method_service.rb +843 -0
  278. data/lib/stripe/services/payout_service.rb +225 -0
  279. data/lib/stripe/services/plan_service.rb +297 -0
  280. data/lib/stripe/services/price_service.rb +545 -0
  281. data/lib/stripe/services/product_feature_service.rb +91 -0
  282. data/lib/stripe/services/product_service.rb +494 -0
  283. data/lib/stripe/services/promotion_code_service.rb +228 -0
  284. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +35 -0
  285. data/lib/stripe/services/quote_line_item_service.rb +35 -0
  286. data/lib/stripe/services/quote_service.rb +703 -0
  287. data/lib/stripe/services/radar/early_fraud_warning_service.rb +93 -0
  288. data/lib/stripe/services/radar/value_list_item_service.rb +130 -0
  289. data/lib/stripe/services/radar/value_list_service.rb +165 -0
  290. data/lib/stripe/services/radar_service.rb +15 -0
  291. data/lib/stripe/services/refund_service.rb +200 -0
  292. data/lib/stripe/services/reporting/report_run_service.rb +147 -0
  293. data/lib/stripe/services/reporting/report_type_service.rb +48 -0
  294. data/lib/stripe/services/reporting_service.rb +14 -0
  295. data/lib/stripe/services/review_service.rb +89 -0
  296. data/lib/stripe/services/setup_attempt_service.rb +68 -0
  297. data/lib/stripe/services/setup_intent_service.rb +3107 -0
  298. data/lib/stripe/services/shipping_rate_service.rb +250 -0
  299. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +57 -0
  300. data/lib/stripe/services/sigma_service.rb +13 -0
  301. data/lib/stripe/services/source_service.rb +665 -0
  302. data/lib/stripe/services/source_transaction_service.rb +35 -0
  303. data/lib/stripe/services/subscription_item_service.rb +372 -0
  304. data/lib/stripe/services/subscription_schedule_service.rb +1224 -0
  305. data/lib/stripe/services/subscription_service.rb +1590 -0
  306. data/lib/stripe/services/tax/calculation_line_item_service.rb +37 -0
  307. data/lib/stripe/services/tax/calculation_service.rb +246 -0
  308. data/lib/stripe/services/tax/registration_service.rb +1774 -0
  309. data/lib/stripe/services/tax/settings_service.rb +104 -0
  310. data/lib/stripe/services/tax/transaction_line_item_service.rb +37 -0
  311. data/lib/stripe/services/tax/transaction_service.rb +159 -0
  312. data/lib/stripe/services/tax_code_service.rb +49 -0
  313. data/lib/stripe/services/tax_id_service.rb +116 -0
  314. data/lib/stripe/services/tax_rate_service.rb +193 -0
  315. data/lib/stripe/services/tax_service.rb +16 -0
  316. data/lib/stripe/services/terminal/configuration_service.rb +1059 -0
  317. data/lib/stripe/services/terminal/connection_token_service.rb +31 -0
  318. data/lib/stripe/services/terminal/location_service.rb +207 -0
  319. data/lib/stripe/services/terminal/reader_service.rb +488 -0
  320. data/lib/stripe/services/terminal_service.rb +16 -0
  321. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +655 -0
  322. data/lib/stripe/services/test_helpers/customer_service.rb +37 -0
  323. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +832 -0
  324. data/lib/stripe/services/test_helpers/issuing/card_service.rb +110 -0
  325. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +84 -0
  326. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +675 -0
  327. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  328. data/lib/stripe/services/test_helpers/refund_service.rb +28 -0
  329. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +108 -0
  330. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  331. data/lib/stripe/services/test_helpers/test_clock_service.rb +119 -0
  332. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +81 -0
  333. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +141 -0
  334. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +141 -0
  335. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +81 -0
  336. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +81 -0
  337. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  338. data/lib/stripe/services/test_helpers_service.rb +19 -0
  339. data/lib/stripe/services/token_service.rb +1224 -0
  340. data/lib/stripe/services/topup_service.rb +191 -0
  341. data/lib/stripe/services/transfer_reversal_service.rb +122 -0
  342. data/lib/stripe/services/transfer_service.rb +166 -0
  343. data/lib/stripe/services/treasury/credit_reversal_service.rb +100 -0
  344. data/lib/stripe/services/treasury/debit_reversal_service.rb +104 -0
  345. data/lib/stripe/services/treasury/financial_account_features_service.rb +196 -0
  346. data/lib/stripe/services/treasury/financial_account_service.rb +554 -0
  347. data/lib/stripe/services/treasury/inbound_transfer_service.rb +140 -0
  348. data/lib/stripe/services/treasury/outbound_payment_service.rb +310 -0
  349. data/lib/stripe/services/treasury/outbound_transfer_service.rb +176 -0
  350. data/lib/stripe/services/treasury/received_credit_service.rb +82 -0
  351. data/lib/stripe/services/treasury/received_debit_service.rb +70 -0
  352. data/lib/stripe/services/treasury/transaction_entry_service.rb +117 -0
  353. data/lib/stripe/services/treasury/transaction_service.rb +125 -0
  354. data/lib/stripe/services/treasury_service.rb +22 -0
  355. data/lib/stripe/services/v1_services.rb +90 -0
  356. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +44 -0
  357. data/lib/stripe/services/v2/billing/meter_event_service.rb +46 -0
  358. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +23 -0
  359. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +56 -0
  360. data/lib/stripe/services/v2/billing_service.rb +18 -0
  361. data/lib/stripe/services/v2/core/event_destination_service.rb +235 -0
  362. data/lib/stripe/services/v2/core/event_service.rb +48 -0
  363. data/lib/stripe/services/v2/core_service.rb +16 -0
  364. data/lib/stripe/services/v2_services.rb +14 -0
  365. data/lib/stripe/services/webhook_endpoint_service.rb +156 -0
  366. data/lib/stripe/services.rb +180 -0
  367. data/lib/stripe/singleton_api_resource.rb +3 -3
  368. data/lib/stripe/stripe_client.rb +56 -1021
  369. data/lib/stripe/stripe_configuration.rb +63 -42
  370. data/lib/stripe/stripe_object.rb +75 -39
  371. data/lib/stripe/stripe_response.rb +1 -3
  372. data/lib/stripe/stripe_service.rb +32 -0
  373. data/lib/stripe/thin_event.rb +37 -0
  374. data/lib/stripe/util.rb +161 -39
  375. data/lib/stripe/v2_list_object.rb +84 -0
  376. data/lib/stripe/version.rb +1 -1
  377. data/lib/stripe/webhook.rb +3 -2
  378. data/lib/stripe.rb +44 -1
  379. data/rbi/stripe/resources/account.rbi +4926 -0
  380. data/rbi/stripe/resources/account_link.rbi +74 -0
  381. data/rbi/stripe/resources/account_session.rbi +1013 -0
  382. data/rbi/stripe/resources/apple_pay_domain.rbi +88 -0
  383. data/rbi/stripe/resources/application.rbi +20 -0
  384. data/rbi/stripe/resources/application_fee.rbi +118 -0
  385. data/rbi/stripe/resources/application_fee_refund.rbi +37 -0
  386. data/rbi/stripe/resources/apps/secret.rbi +195 -0
  387. data/rbi/stripe/resources/balance.rbi +235 -0
  388. data/rbi/stripe/resources/balance_transaction.rbi +147 -0
  389. data/rbi/stripe/resources/bank_account.rbi +127 -0
  390. data/rbi/stripe/resources/billing/alert.rbi +201 -0
  391. data/rbi/stripe/resources/billing/alert_triggered.rbi +28 -0
  392. data/rbi/stripe/resources/billing/credit_balance_summary.rbi +63 -0
  393. data/rbi/stripe/resources/billing/credit_balance_transaction.rbi +147 -0
  394. data/rbi/stripe/resources/billing/credit_grant.rbi +291 -0
  395. data/rbi/stripe/resources/billing/meter.rbi +226 -0
  396. data/rbi/stripe/resources/billing/meter_event.rbi +64 -0
  397. data/rbi/stripe/resources/billing/meter_event_adjustment.rbi +64 -0
  398. data/rbi/stripe/resources/billing/meter_event_summary.rbi +35 -0
  399. data/rbi/stripe/resources/billing_portal/configuration.rbi +645 -0
  400. data/rbi/stripe/resources/billing_portal/session.rbi +345 -0
  401. data/rbi/stripe/resources/capability.rbi +125 -0
  402. data/rbi/stripe/resources/card.rbi +125 -0
  403. data/rbi/stripe/resources/cash_balance.rbi +32 -0
  404. data/rbi/stripe/resources/charge.rbi +2069 -0
  405. data/rbi/stripe/resources/checkout/session.rbi +4004 -0
  406. data/rbi/stripe/resources/climate/order.rbi +245 -0
  407. data/rbi/stripe/resources/climate/product.rbi +75 -0
  408. data/rbi/stripe/resources/climate/supplier.rbi +72 -0
  409. data/rbi/stripe/resources/confirmation_token.rbi +1807 -0
  410. data/rbi/stripe/resources/connect_collection_transfer.rbi +26 -0
  411. data/rbi/stripe/resources/country_spec.rbi +85 -0
  412. data/rbi/stripe/resources/coupon.rbi +250 -0
  413. data/rbi/stripe/resources/credit_note.rbi +752 -0
  414. data/rbi/stripe/resources/credit_note_line_item.rbi +101 -0
  415. data/rbi/stripe/resources/customer.rbi +1005 -0
  416. data/rbi/stripe/resources/customer_balance_transaction.rbi +56 -0
  417. data/rbi/stripe/resources/customer_cash_balance_transaction.rbi +151 -0
  418. data/rbi/stripe/resources/customer_session.rbi +200 -0
  419. data/rbi/stripe/resources/discount.rbi +53 -0
  420. data/rbi/stripe/resources/dispute.rbi +761 -0
  421. data/rbi/stripe/resources/entitlements/active_entitlement.rbi +58 -0
  422. data/rbi/stripe/resources/entitlements/active_entitlement_summary.rbi +23 -0
  423. data/rbi/stripe/resources/entitlements/feature.rbi +117 -0
  424. data/rbi/stripe/resources/ephemeral_key.rbi +44 -0
  425. data/rbi/stripe/resources/event.rbi +149 -0
  426. data/rbi/stripe/resources/exchange_rate.rbi +66 -0
  427. data/rbi/stripe/resources/file.rbi +143 -0
  428. data/rbi/stripe/resources/file_link.rbi +141 -0
  429. data/rbi/stripe/resources/financial_connections/account.rbi +339 -0
  430. data/rbi/stripe/resources/financial_connections/account_owner.rbi +35 -0
  431. data/rbi/stripe/resources/financial_connections/account_ownership.rbi +23 -0
  432. data/rbi/stripe/resources/financial_connections/session.rbi +123 -0
  433. data/rbi/stripe/resources/financial_connections/transaction.rbi +124 -0
  434. data/rbi/stripe/resources/forwarding/request.rbi +216 -0
  435. data/rbi/stripe/resources/funding_instructions.rbi +437 -0
  436. data/rbi/stripe/resources/identity/verification_report.rbi +360 -0
  437. data/rbi/stripe/resources/identity/verification_session.rbi +526 -0
  438. data/rbi/stripe/resources/invoice.rbi +3812 -0
  439. data/rbi/stripe/resources/invoice_item.rbi +473 -0
  440. data/rbi/stripe/resources/invoice_line_item.rbi +432 -0
  441. data/rbi/stripe/resources/invoice_payment.rbi +121 -0
  442. data/rbi/stripe/resources/invoice_rendering_template.rbi +104 -0
  443. data/rbi/stripe/resources/issuing/authorization.rbi +1283 -0
  444. data/rbi/stripe/resources/issuing/card.rbi +741 -0
  445. data/rbi/stripe/resources/issuing/cardholder.rbi +744 -0
  446. data/rbi/stripe/resources/issuing/dispute.rbi +913 -0
  447. data/rbi/stripe/resources/issuing/personalization_design.rbi +338 -0
  448. data/rbi/stripe/resources/issuing/physical_bundle.rbi +79 -0
  449. data/rbi/stripe/resources/issuing/token.rbi +226 -0
  450. data/rbi/stripe/resources/issuing/transaction.rbi +1061 -0
  451. data/rbi/stripe/resources/line_item.rbi +72 -0
  452. data/rbi/stripe/resources/login_link.rbi +19 -0
  453. data/rbi/stripe/resources/mandate.rbi +187 -0
  454. data/rbi/stripe/resources/payment_intent.rbi +9647 -0
  455. data/rbi/stripe/resources/payment_link.rbi +1801 -0
  456. data/rbi/stripe/resources/payment_method.rbi +1761 -0
  457. data/rbi/stripe/resources/payment_method_configuration.rbi +3550 -0
  458. data/rbi/stripe/resources/payment_method_domain.rbi +228 -0
  459. data/rbi/stripe/resources/payout.rbi +300 -0
  460. data/rbi/stripe/resources/person.rbi +401 -0
  461. data/rbi/stripe/resources/plan.rbi +371 -0
  462. data/rbi/stripe/resources/price.rbi +694 -0
  463. data/rbi/stripe/resources/product.rbi +555 -0
  464. data/rbi/stripe/resources/product_feature.rbi +26 -0
  465. data/rbi/stripe/resources/promotion_code.rbi +261 -0
  466. data/rbi/stripe/resources/quote.rbi +1126 -0
  467. data/rbi/stripe/resources/radar/early_fraud_warning.rbi +98 -0
  468. data/rbi/stripe/resources/radar/value_list.rbi +168 -0
  469. data/rbi/stripe/resources/radar/value_list_item.rbi +129 -0
  470. data/rbi/stripe/resources/refund.rbi +523 -0
  471. data/rbi/stripe/resources/reporting/report_run.rbi +191 -0
  472. data/rbi/stripe/resources/reporting/report_type.rbi +57 -0
  473. data/rbi/stripe/resources/reserve_transaction.rbi +23 -0
  474. data/rbi/stripe/resources/reversal.rbi +51 -0
  475. data/rbi/stripe/resources/review.rbi +154 -0
  476. data/rbi/stripe/resources/setup_attempt.rbi +477 -0
  477. data/rbi/stripe/resources/setup_intent.rbi +3655 -0
  478. data/rbi/stripe/resources/shipping_rate.rbi +305 -0
  479. data/rbi/stripe/resources/sigma/scheduled_query_run.rbi +75 -0
  480. data/rbi/stripe/resources/source.rbi +1496 -0
  481. data/rbi/stripe/resources/source_mandate_notification.rbi +77 -0
  482. data/rbi/stripe/resources/source_transaction.rbi +127 -0
  483. data/rbi/stripe/resources/subscription.rbi +2027 -0
  484. data/rbi/stripe/resources/subscription_item.rbi +404 -0
  485. data/rbi/stripe/resources/subscription_schedule.rbi +1623 -0
  486. data/rbi/stripe/resources/tax/calculation.rbi +478 -0
  487. data/rbi/stripe/resources/tax/calculation_line_item.rbi +91 -0
  488. data/rbi/stripe/resources/tax/registration.rbi +2713 -0
  489. data/rbi/stripe/resources/tax/settings.rbi +141 -0
  490. data/rbi/stripe/resources/tax/transaction.rbi +351 -0
  491. data/rbi/stripe/resources/tax/transaction_line_item.rbi +54 -0
  492. data/rbi/stripe/resources/tax_code.rbi +44 -0
  493. data/rbi/stripe/resources/tax_deducted_at_source.rbi +23 -0
  494. data/rbi/stripe/resources/tax_id.rbi +165 -0
  495. data/rbi/stripe/resources/tax_rate.rbi +239 -0
  496. data/rbi/stripe/resources/terminal/configuration.rbi +1386 -0
  497. data/rbi/stripe/resources/terminal/connection_token.rbi +37 -0
  498. data/rbi/stripe/resources/terminal/location.rbi +222 -0
  499. data/rbi/stripe/resources/terminal/reader.rbi +847 -0
  500. data/rbi/stripe/resources/test_helpers/test_clock.rbi +132 -0
  501. data/rbi/stripe/resources/token.rbi +1283 -0
  502. data/rbi/stripe/resources/topup.rbi +222 -0
  503. data/rbi/stripe/resources/transfer.rbi +199 -0
  504. data/rbi/stripe/resources/treasury/credit_reversal.rbi +119 -0
  505. data/rbi/stripe/resources/treasury/debit_reversal.rbi +131 -0
  506. data/rbi/stripe/resources/treasury/financial_account.rbi +865 -0
  507. data/rbi/stripe/resources/treasury/financial_account_features.rbi +260 -0
  508. data/rbi/stripe/resources/treasury/inbound_transfer.rbi +295 -0
  509. data/rbi/stripe/resources/treasury/outbound_payment.rbi +592 -0
  510. data/rbi/stripe/resources/treasury/outbound_transfer.rbi +431 -0
  511. data/rbi/stripe/resources/treasury/received_credit.rbi +302 -0
  512. data/rbi/stripe/resources/treasury/received_debit.rbi +256 -0
  513. data/rbi/stripe/resources/treasury/transaction.rbi +215 -0
  514. data/rbi/stripe/resources/treasury/transaction_entry.rbi +192 -0
  515. data/rbi/stripe/resources/v2/amount.rbi +14 -0
  516. data/rbi/stripe/resources/v2/billing/meter_event.rbi +37 -0
  517. data/rbi/stripe/resources/v2/billing/meter_event_adjustment.rbi +41 -0
  518. data/rbi/stripe/resources/v2/billing/meter_event_session.rbi +31 -0
  519. data/rbi/stripe/resources/v2/event.rbi +48 -0
  520. data/rbi/stripe/resources/v2/event_destination.rbi +91 -0
  521. data/rbi/stripe/resources/webhook_endpoint.rbi +168 -0
  522. data/rbi/stripe/services/account_capability_service.rbi +51 -0
  523. data/rbi/stripe/services/account_external_account_service.rbi +304 -0
  524. data/rbi/stripe/services/account_link_service.rbi +58 -0
  525. data/rbi/stripe/services/account_login_link_service.rbi +22 -0
  526. data/rbi/stripe/services/account_person_service.rbi +1011 -0
  527. data/rbi/stripe/services/account_service.rbi +4213 -0
  528. data/rbi/stripe/services/account_session_service.rbi +646 -0
  529. data/rbi/stripe/services/apple_pay_domain_service.rbi +76 -0
  530. data/rbi/stripe/services/application_fee_refund_service.rbi +93 -0
  531. data/rbi/stripe/services/application_fee_service.rbi +78 -0
  532. data/rbi/stripe/services/apps/secret_service.rbi +151 -0
  533. data/{lib/stripe/resources/usage_record_summary.rb → rbi/stripe/services/apps_service.rbi} +4 -3
  534. data/rbi/stripe/services/balance_service.rbi +21 -0
  535. data/rbi/stripe/services/balance_transaction_service.rbi +93 -0
  536. data/rbi/stripe/services/billing/alert_service.rbi +152 -0
  537. data/rbi/stripe/services/billing/credit_balance_summary_service.rbi +68 -0
  538. data/rbi/stripe/services/billing/credit_balance_transaction_service.rbi +59 -0
  539. data/rbi/stripe/services/billing/credit_grant_service.rbi +211 -0
  540. data/rbi/stripe/services/billing/meter_event_adjustment_service.rbi +42 -0
  541. data/rbi/stripe/services/billing/meter_event_service.rbi +42 -0
  542. data/rbi/stripe/services/billing/meter_event_summary_service.rbi +54 -0
  543. data/rbi/stripe/services/billing/meter_service.rbi +163 -0
  544. data/rbi/stripe/services/billing_portal/configuration_service.rbi +511 -0
  545. data/rbi/stripe/services/billing_portal/session_service.rbi +204 -0
  546. data/rbi/stripe/services/billing_portal_service.rbi +10 -0
  547. data/rbi/stripe/services/billing_service.rbi +15 -0
  548. data/rbi/stripe/services/charge_service.rbi +448 -0
  549. data/rbi/stripe/services/checkout/session_line_item_service.rbi +33 -0
  550. data/rbi/stripe/services/checkout/session_service.rbi +2614 -0
  551. data/rbi/stripe/services/checkout_service.rbi +9 -0
  552. data/rbi/stripe/services/climate/order_service.rbi +142 -0
  553. data/rbi/stripe/services/climate/product_service.rbi +46 -0
  554. data/rbi/stripe/services/climate/supplier_service.rbi +46 -0
  555. data/rbi/stripe/services/climate_service.rbi +11 -0
  556. data/rbi/stripe/services/confirmation_token_service.rbi +20 -0
  557. data/rbi/stripe/services/country_spec_service.rbi +44 -0
  558. data/rbi/stripe/services/coupon_service.rbi +194 -0
  559. data/rbi/stripe/services/credit_note_line_item_service.rbi +31 -0
  560. data/rbi/stripe/services/credit_note_preview_lines_service.rbi +167 -0
  561. data/rbi/stripe/services/credit_note_service.rbi +415 -0
  562. data/rbi/stripe/services/customer_balance_transaction_service.rbi +92 -0
  563. data/rbi/stripe/services/customer_cash_balance_service.rbi +45 -0
  564. data/rbi/stripe/services/customer_cash_balance_transaction_service.rbi +44 -0
  565. data/rbi/stripe/services/customer_funding_instructions_service.rbi +59 -0
  566. data/rbi/stripe/services/customer_payment_method_service.rbi +57 -0
  567. data/rbi/stripe/services/customer_payment_source_service.rbi +232 -0
  568. data/rbi/stripe/services/customer_service.rbi +647 -0
  569. data/rbi/stripe/services/customer_session_service.rbi +116 -0
  570. data/rbi/stripe/services/customer_tax_id_service.rbi +70 -0
  571. data/rbi/stripe/services/dispute_service.rbi +424 -0
  572. data/rbi/stripe/services/entitlements/active_entitlement_service.rbi +55 -0
  573. data/rbi/stripe/services/entitlements/feature_service.rbi +107 -0
  574. data/rbi/stripe/services/entitlements_service.rbi +10 -0
  575. data/rbi/stripe/services/ephemeral_key_service.rbi +53 -0
  576. data/rbi/stripe/services/event_service.rbi +83 -0
  577. data/rbi/stripe/services/exchange_rate_service.rbi +44 -0
  578. data/rbi/stripe/services/file_link_service.rbi +124 -0
  579. data/rbi/stripe/services/file_service.rbi +116 -0
  580. data/rbi/stripe/services/financial_connections/account_owner_service.rbi +42 -0
  581. data/rbi/stripe/services/financial_connections/account_service.rbi +133 -0
  582. data/rbi/stripe/services/financial_connections/session_service.rbi +88 -0
  583. data/rbi/stripe/services/financial_connections/transaction_service.rbi +92 -0
  584. data/rbi/stripe/services/financial_connections_service.rbi +11 -0
  585. data/rbi/stripe/services/forwarding/request_service.rbi +134 -0
  586. data/rbi/stripe/services/forwarding_service.rbi +9 -0
  587. data/rbi/stripe/services/identity/verification_report_service.rbi +87 -0
  588. data/rbi/stripe/services/identity/verification_session_service.rbi +323 -0
  589. data/rbi/stripe/services/identity_service.rbi +10 -0
  590. data/rbi/stripe/services/invoice_item_service.rbi +366 -0
  591. data/rbi/stripe/services/invoice_line_item_service.rbi +259 -0
  592. data/rbi/stripe/services/invoice_payment_service.rbi +71 -0
  593. data/rbi/stripe/services/invoice_rendering_template_service.rbi +82 -0
  594. data/rbi/stripe/services/invoice_service.rbi +2981 -0
  595. data/rbi/stripe/services/issuing/authorization_service.rbi +146 -0
  596. data/rbi/stripe/services/issuing/card_service.rbi +495 -0
  597. data/rbi/stripe/services/issuing/cardholder_service.rbi +587 -0
  598. data/rbi/stripe/services/issuing/dispute_service.rbi +707 -0
  599. data/rbi/stripe/services/issuing/personalization_design_service.rbi +243 -0
  600. data/rbi/stripe/services/issuing/physical_bundle_service.rbi +59 -0
  601. data/rbi/stripe/services/issuing/token_service.rbi +99 -0
  602. data/rbi/stripe/services/issuing/transaction_service.rbi +105 -0
  603. data/rbi/stripe/services/issuing_service.rbi +16 -0
  604. data/rbi/stripe/services/mandate_service.rbi +20 -0
  605. data/rbi/stripe/services/payment_intent_service.rbi +7659 -0
  606. data/rbi/stripe/services/payment_link_line_item_service.rbi +31 -0
  607. data/rbi/stripe/services/payment_link_service.rbi +1352 -0
  608. data/rbi/stripe/services/payment_method_configuration_service.rbi +2487 -0
  609. data/rbi/stripe/services/payment_method_domain_service.rbi +112 -0
  610. data/rbi/stripe/services/payment_method_service.rbi +776 -0
  611. data/rbi/stripe/services/payout_service.rbi +205 -0
  612. data/rbi/stripe/services/plan_service.rbi +282 -0
  613. data/rbi/stripe/services/price_service.rbi +546 -0
  614. data/rbi/stripe/services/product_feature_service.rbi +67 -0
  615. data/rbi/stripe/services/product_service.rbi +477 -0
  616. data/rbi/stripe/services/promotion_code_service.rbi +214 -0
  617. data/rbi/stripe/services/quote_computed_upfront_line_items_service.rbi +31 -0
  618. data/rbi/stripe/services/quote_line_item_service.rbi +31 -0
  619. data/rbi/stripe/services/quote_service.rbi +686 -0
  620. data/rbi/stripe/services/radar/early_fraud_warning_service.rbi +85 -0
  621. data/rbi/stripe/services/radar/value_list_item_service.rbi +109 -0
  622. data/rbi/stripe/services/radar/value_list_service.rbi +141 -0
  623. data/rbi/stripe/services/radar_service.rbi +11 -0
  624. data/rbi/stripe/services/refund_service.rbi +185 -0
  625. data/rbi/stripe/services/reporting/report_run_service.rbi +135 -0
  626. data/rbi/stripe/services/reporting/report_type_service.rbi +35 -0
  627. data/rbi/stripe/services/reporting_service.rbi +10 -0
  628. data/rbi/stripe/services/review_service.rbi +84 -0
  629. data/rbi/stripe/services/setup_attempt_service.rbi +65 -0
  630. data/rbi/stripe/services/setup_intent_service.rbi +3391 -0
  631. data/rbi/stripe/services/shipping_rate_service.rbi +241 -0
  632. data/rbi/stripe/services/sigma/scheduled_query_run_service.rbi +46 -0
  633. data/rbi/stripe/services/sigma_service.rbi +9 -0
  634. data/rbi/stripe/services/source_service.rbi +663 -0
  635. data/rbi/stripe/services/source_transaction_service.rbi +31 -0
  636. data/rbi/stripe/services/subscription_item_service.rbi +350 -0
  637. data/rbi/stripe/services/subscription_schedule_service.rbi +1290 -0
  638. data/rbi/stripe/services/subscription_service.rbi +1648 -0
  639. data/rbi/stripe/services/tax/calculation_line_item_service.rbi +33 -0
  640. data/rbi/stripe/services/tax/calculation_service.rbi +234 -0
  641. data/rbi/stripe/services/tax/registration_service.rbi +1845 -0
  642. data/rbi/stripe/services/tax/settings_service.rbi +93 -0
  643. data/rbi/stripe/services/tax/transaction_line_item_service.rbi +33 -0
  644. data/rbi/stripe/services/tax/transaction_service.rbi +146 -0
  645. data/rbi/stripe/services/tax_code_service.rbi +44 -0
  646. data/rbi/stripe/services/tax_id_service.rbi +110 -0
  647. data/rbi/stripe/services/tax_rate_service.rbi +185 -0
  648. data/rbi/stripe/services/tax_service.rbi +12 -0
  649. data/rbi/stripe/services/terminal/configuration_service.rbi +1118 -0
  650. data/rbi/stripe/services/terminal/connection_token_service.rbi +25 -0
  651. data/rbi/stripe/services/terminal/location_service.rbi +182 -0
  652. data/rbi/stripe/services/terminal/reader_service.rbi +455 -0
  653. data/rbi/stripe/services/terminal_service.rbi +12 -0
  654. data/rbi/stripe/services/test_helpers/confirmation_token_service.rbi +739 -0
  655. data/rbi/stripe/services/test_helpers/customer_service.rbi +33 -0
  656. data/rbi/stripe/services/test_helpers/issuing/authorization_service.rbi +848 -0
  657. data/rbi/stripe/services/test_helpers/issuing/card_service.rbi +76 -0
  658. data/rbi/stripe/services/test_helpers/issuing/personalization_design_service.rbi +69 -0
  659. data/rbi/stripe/services/test_helpers/issuing/transaction_service.rbi +711 -0
  660. data/rbi/stripe/services/test_helpers/issuing_service.rbi +14 -0
  661. data/rbi/stripe/services/test_helpers/refund_service.rbi +22 -0
  662. data/rbi/stripe/services/test_helpers/terminal/reader_service.rbi +93 -0
  663. data/rbi/stripe/services/test_helpers/terminal_service.rbi +11 -0
  664. data/rbi/stripe/services/test_helpers/test_clock_service.rbi +90 -0
  665. data/rbi/stripe/services/test_helpers/treasury/inbound_transfer_service.rbi +64 -0
  666. data/rbi/stripe/services/test_helpers/treasury/outbound_payment_service.rbi +125 -0
  667. data/rbi/stripe/services/test_helpers/treasury/outbound_transfer_service.rbi +125 -0
  668. data/rbi/stripe/services/test_helpers/treasury/received_credit_service.rbi +87 -0
  669. data/rbi/stripe/services/test_helpers/treasury/received_debit_service.rbi +87 -0
  670. data/rbi/stripe/services/test_helpers/treasury_service.rbi +15 -0
  671. data/rbi/stripe/services/test_helpers_service.rbi +15 -0
  672. data/rbi/stripe/services/token_service.rbi +1257 -0
  673. data/rbi/stripe/services/topup_service.rbi +176 -0
  674. data/rbi/stripe/services/transfer_reversal_service.rbi +101 -0
  675. data/rbi/stripe/services/transfer_service.rbi +152 -0
  676. data/rbi/stripe/services/treasury/credit_reversal_service.rbi +84 -0
  677. data/rbi/stripe/services/treasury/debit_reversal_service.rbi +88 -0
  678. data/rbi/stripe/services/treasury/financial_account_features_service.rbi +198 -0
  679. data/rbi/stripe/services/treasury/financial_account_service.rbi +562 -0
  680. data/rbi/stripe/services/treasury/inbound_transfer_service.rbi +117 -0
  681. data/rbi/stripe/services/treasury/outbound_payment_service.rbi +304 -0
  682. data/rbi/stripe/services/treasury/outbound_transfer_service.rbi +157 -0
  683. data/rbi/stripe/services/treasury/received_credit_service.rbi +72 -0
  684. data/rbi/stripe/services/treasury/received_debit_service.rbi +59 -0
  685. data/rbi/stripe/services/treasury/transaction_entry_service.rbi +111 -0
  686. data/rbi/stripe/services/treasury/transaction_service.rbi +122 -0
  687. data/rbi/stripe/services/treasury_service.rbi +18 -0
  688. data/rbi/stripe/services/v1_services.rbi +77 -0
  689. data/rbi/stripe/services/v2/billing/meter_event_adjustment_service.rbi +39 -0
  690. data/rbi/stripe/services/v2/billing/meter_event_service.rbi +42 -0
  691. data/rbi/stripe/services/v2/billing/meter_event_session_service.rbi +18 -0
  692. data/rbi/stripe/services/v2/billing/meter_event_stream_service.rbi +55 -0
  693. data/rbi/stripe/services/v2/billing_service.rbi +14 -0
  694. data/rbi/stripe/services/v2/core/event_destination_service.rbi +192 -0
  695. data/rbi/stripe/services/v2/core/event_service.rbi +36 -0
  696. data/rbi/stripe/services/v2/core_service.rbi +12 -0
  697. data/rbi/stripe/services/v2_services.rbi +10 -0
  698. data/rbi/stripe/services/webhook_endpoint_service.rbi +129 -0
  699. data/stripe.gemspec +10 -7
  700. metadata +599 -18
  701. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  702. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  703. data/lib/stripe/resources/issuing/card_details.rb +0 -9
  704. data/lib/stripe/resources/order.rb +0 -33
  705. data/lib/stripe/resources/order_return.rb +0 -10
  706. data/lib/stripe/resources/recipient.rb +0 -14
  707. data/lib/stripe/resources/sku.rb +0 -13
  708. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -2,20 +2,1888 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Subscriptions allow you to charge a customer on a recurring basis.
6
+ #
7
+ # Related guide: [Creating subscriptions](https://stripe.com/docs/billing/subscriptions/creating)
5
8
  class Subscription < APIResource
6
9
  extend Stripe::APIOperations::Create
7
- include Stripe::APIOperations::Delete
8
10
  extend Stripe::APIOperations::List
11
+ extend Stripe::APIOperations::Search
9
12
  include Stripe::APIOperations::Save
10
13
 
11
14
  OBJECT_NAME = "subscription"
15
+ def self.object_name
16
+ "subscription"
17
+ end
18
+
19
+ class AutomaticTax < Stripe::StripeObject
20
+ class Liability < Stripe::StripeObject
21
+ # The connected account being referenced when `type` is `account`.
22
+ attr_reader :account
23
+ # Type of the account referenced.
24
+ attr_reader :type
25
+ end
26
+ # If Stripe disabled automatic tax, this enum describes why.
27
+ attr_reader :disabled_reason
28
+ # Whether Stripe automatically computes tax on this subscription.
29
+ attr_reader :enabled
30
+ # 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.
31
+ attr_reader :liability
32
+ end
33
+
34
+ class BillingCycleAnchorConfig < Stripe::StripeObject
35
+ # The day of the month of the billing_cycle_anchor.
36
+ attr_reader :day_of_month
37
+ # The hour of the day of the billing_cycle_anchor.
38
+ attr_reader :hour
39
+ # The minute of the hour of the billing_cycle_anchor.
40
+ attr_reader :minute
41
+ # The month to start full cycle billing periods.
42
+ attr_reader :month
43
+ # The second of the minute of the billing_cycle_anchor.
44
+ attr_reader :second
45
+ end
46
+
47
+ class BillingThresholds < Stripe::StripeObject
48
+ # Monetary threshold that triggers the subscription to create an invoice
49
+ attr_reader :amount_gte
50
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`.
51
+ attr_reader :reset_billing_cycle_anchor
52
+ end
53
+
54
+ class CancellationDetails < Stripe::StripeObject
55
+ # Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
56
+ attr_reader :comment
57
+ # The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user.
58
+ attr_reader :feedback
59
+ # Why this subscription was canceled.
60
+ attr_reader :reason
61
+ end
62
+
63
+ class InvoiceSettings < Stripe::StripeObject
64
+ class Issuer < Stripe::StripeObject
65
+ # The connected account being referenced when `type` is `account`.
66
+ attr_reader :account
67
+ # Type of the account referenced.
68
+ attr_reader :type
69
+ end
70
+ # The account tax IDs associated with the subscription. Will be set on invoices generated by the subscription.
71
+ attr_reader :account_tax_ids
72
+ # Attribute for field issuer
73
+ attr_reader :issuer
74
+ end
75
+
76
+ class PauseCollection < Stripe::StripeObject
77
+ # The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
78
+ attr_reader :behavior
79
+ # The time after which the subscription will resume collecting payments.
80
+ attr_reader :resumes_at
81
+ end
82
+
83
+ class PaymentSettings < Stripe::StripeObject
84
+ class PaymentMethodOptions < Stripe::StripeObject
85
+ class AcssDebit < Stripe::StripeObject
86
+ class MandateOptions < Stripe::StripeObject
87
+ # Transaction type of the mandate.
88
+ attr_reader :transaction_type
89
+ end
90
+ # Attribute for field mandate_options
91
+ attr_reader :mandate_options
92
+ # Bank account verification method.
93
+ attr_reader :verification_method
94
+ end
95
+
96
+ class Bancontact < Stripe::StripeObject
97
+ # Preferred language of the Bancontact authorization page that the customer is redirected to.
98
+ attr_reader :preferred_language
99
+ end
100
+
101
+ class Card < Stripe::StripeObject
102
+ class MandateOptions < Stripe::StripeObject
103
+ # Amount to be charged for future payments.
104
+ attr_reader :amount
105
+ # 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.
106
+ attr_reader :amount_type
107
+ # A description of the mandate or subscription that is meant to be displayed to the customer.
108
+ attr_reader :description
109
+ end
110
+ # Attribute for field mandate_options
111
+ attr_reader :mandate_options
112
+ # 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.
113
+ attr_reader :network
114
+ # 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.
115
+ attr_reader :request_three_d_secure
116
+ end
117
+
118
+ class CustomerBalance < Stripe::StripeObject
119
+ class BankTransfer < Stripe::StripeObject
120
+ class EuBankTransfer < Stripe::StripeObject
121
+ # The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
122
+ attr_reader :country
123
+ end
124
+ # Attribute for field eu_bank_transfer
125
+ attr_reader :eu_bank_transfer
126
+ # 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`.
127
+ attr_reader :type
128
+ end
129
+ # Attribute for field bank_transfer
130
+ attr_reader :bank_transfer
131
+ # The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
132
+ attr_reader :funding_type
133
+ end
134
+
135
+ class Konbini < Stripe::StripeObject; end
136
+ class SepaDebit < Stripe::StripeObject; end
137
+
138
+ class UsBankAccount < Stripe::StripeObject
139
+ class FinancialConnections < Stripe::StripeObject
140
+ class Filters < Stripe::StripeObject
141
+ # The account subcategories to use to filter for possible accounts to link. Valid subcategories are `checking` and `savings`.
142
+ attr_reader :account_subcategories
143
+ end
144
+ # Attribute for field filters
145
+ attr_reader :filters
146
+ # The list of permissions to request. The `payment_method` permission must be included.
147
+ attr_reader :permissions
148
+ # Data features requested to be retrieved upon account creation.
149
+ attr_reader :prefetch
150
+ end
151
+ # Attribute for field financial_connections
152
+ attr_reader :financial_connections
153
+ # Bank account verification method.
154
+ attr_reader :verification_method
155
+ end
156
+ # This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to invoices created by the subscription.
157
+ attr_reader :acss_debit
158
+ # This sub-hash contains details about the Bancontact payment method options to pass to invoices created by the subscription.
159
+ attr_reader :bancontact
160
+ # This sub-hash contains details about the Card payment method options to pass to invoices created by the subscription.
161
+ attr_reader :card
162
+ # This sub-hash contains details about the Bank transfer payment method options to pass to invoices created by the subscription.
163
+ attr_reader :customer_balance
164
+ # This sub-hash contains details about the Konbini payment method options to pass to invoices created by the subscription.
165
+ attr_reader :konbini
166
+ # This sub-hash contains details about the SEPA Direct Debit payment method options to pass to invoices created by the subscription.
167
+ attr_reader :sepa_debit
168
+ # This sub-hash contains details about the ACH direct debit payment method options to pass to invoices created by the subscription.
169
+ attr_reader :us_bank_account
170
+ end
171
+ # Payment-method-specific configuration to provide to invoices created by the subscription.
172
+ attr_reader :payment_method_options
173
+ # The list of payment method types to provide to every invoice created by the subscription. 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).
174
+ attr_reader :payment_method_types
175
+ # Configure whether Stripe updates `subscription.default_payment_method` when payment succeeds. Defaults to `off`.
176
+ attr_reader :save_default_payment_method
177
+ end
178
+
179
+ class PendingInvoiceItemInterval < Stripe::StripeObject
180
+ # Specifies invoicing frequency. Either `day`, `week`, `month` or `year`.
181
+ attr_reader :interval
182
+ # 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).
183
+ attr_reader :interval_count
184
+ end
185
+
186
+ class PendingUpdate < Stripe::StripeObject
187
+ # If the update is applied, determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format.
188
+ attr_reader :billing_cycle_anchor
189
+ # The point after which the changes reflected by this update will be discarded and no longer applied.
190
+ attr_reader :expires_at
191
+ # List of subscription items, each with an attached plan, that will be set if the update is applied.
192
+ attr_reader :subscription_items
193
+ # Unix timestamp representing the end of the trial period the customer will get before being charged for the first time, if the update is applied.
194
+ attr_reader :trial_end
195
+ # 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.
196
+ attr_reader :trial_from_plan
197
+ end
198
+
199
+ class TransferData < Stripe::StripeObject
200
+ # 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.
201
+ attr_reader :amount_percent
202
+ # The account where funds from the payment will be transferred to upon payment success.
203
+ attr_reader :destination
204
+ end
205
+
206
+ class TrialSettings < Stripe::StripeObject
207
+ class EndBehavior < Stripe::StripeObject
208
+ # Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
209
+ attr_reader :missing_payment_method
210
+ end
211
+ # Defines how a subscription behaves when a free trial ends.
212
+ attr_reader :end_behavior
213
+ end
214
+
215
+ class CancelParams < Stripe::RequestParams
216
+ class CancellationDetails < Stripe::RequestParams
217
+ # Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
218
+ attr_accessor :comment
219
+ # The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user.
220
+ attr_accessor :feedback
221
+
222
+ def initialize(comment: nil, feedback: nil)
223
+ @comment = comment
224
+ @feedback = feedback
225
+ end
226
+ end
227
+ # Details about why this subscription was cancelled
228
+ attr_accessor :cancellation_details
229
+ # Specifies which fields in the response should be expanded.
230
+ attr_accessor :expand
231
+ # Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. Defaults to `false`.
232
+ attr_accessor :invoice_now
233
+ # Will generate a proration invoice item that credits remaining unused time until the subscription period end. Defaults to `false`.
234
+ attr_accessor :prorate
235
+
236
+ def initialize(cancellation_details: nil, expand: nil, invoice_now: nil, prorate: nil)
237
+ @cancellation_details = cancellation_details
238
+ @expand = expand
239
+ @invoice_now = invoice_now
240
+ @prorate = prorate
241
+ end
242
+ end
243
+
244
+ class UpdateParams < Stripe::RequestParams
245
+ class AddInvoiceItem < Stripe::RequestParams
246
+ class Discount < Stripe::RequestParams
247
+ # ID of the coupon to create a new discount for.
248
+ attr_accessor :coupon
249
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
250
+ attr_accessor :discount
251
+ # ID of the promotion code to create a new discount for.
252
+ attr_accessor :promotion_code
253
+
254
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
255
+ @coupon = coupon
256
+ @discount = discount
257
+ @promotion_code = promotion_code
258
+ end
259
+ end
260
+
261
+ class PriceData < Stripe::RequestParams
262
+ # 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).
263
+ attr_accessor :currency
264
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
265
+ attr_accessor :product
266
+ # 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.
267
+ attr_accessor :tax_behavior
268
+ # 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.
269
+ attr_accessor :unit_amount
270
+ # 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.
271
+ attr_accessor :unit_amount_decimal
272
+
273
+ def initialize(
274
+ currency: nil,
275
+ product: nil,
276
+ tax_behavior: nil,
277
+ unit_amount: nil,
278
+ unit_amount_decimal: nil
279
+ )
280
+ @currency = currency
281
+ @product = product
282
+ @tax_behavior = tax_behavior
283
+ @unit_amount = unit_amount
284
+ @unit_amount_decimal = unit_amount_decimal
285
+ end
286
+ end
287
+ # The coupons to redeem into discounts for the item.
288
+ attr_accessor :discounts
289
+ # The ID of the price object. One of `price` or `price_data` is required.
290
+ attr_accessor :price
291
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
292
+ attr_accessor :price_data
293
+ # Quantity for this item. Defaults to 1.
294
+ attr_accessor :quantity
295
+ # The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
296
+ attr_accessor :tax_rates
297
+
298
+ def initialize(discounts: nil, price: nil, price_data: nil, quantity: nil, tax_rates: nil)
299
+ @discounts = discounts
300
+ @price = price
301
+ @price_data = price_data
302
+ @quantity = quantity
303
+ @tax_rates = tax_rates
304
+ end
305
+ end
306
+
307
+ class AutomaticTax < Stripe::RequestParams
308
+ class Liability < Stripe::RequestParams
309
+ # The connected account being referenced when `type` is `account`.
310
+ attr_accessor :account
311
+ # Type of the account referenced in the request.
312
+ attr_accessor :type
313
+
314
+ def initialize(account: nil, type: nil)
315
+ @account = account
316
+ @type = type
317
+ end
318
+ end
319
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
320
+ attr_accessor :enabled
321
+ # 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.
322
+ attr_accessor :liability
323
+
324
+ def initialize(enabled: nil, liability: nil)
325
+ @enabled = enabled
326
+ @liability = liability
327
+ end
328
+ end
329
+
330
+ class BillingThresholds < Stripe::RequestParams
331
+ # Monetary threshold that triggers the subscription to advance to a new billing period
332
+ attr_accessor :amount_gte
333
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
334
+ attr_accessor :reset_billing_cycle_anchor
335
+
336
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
337
+ @amount_gte = amount_gte
338
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
339
+ end
340
+ end
341
+
342
+ class CancellationDetails < Stripe::RequestParams
343
+ # Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
344
+ attr_accessor :comment
345
+ # The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user.
346
+ attr_accessor :feedback
347
+
348
+ def initialize(comment: nil, feedback: nil)
349
+ @comment = comment
350
+ @feedback = feedback
351
+ end
352
+ end
353
+
354
+ class Discount < Stripe::RequestParams
355
+ # ID of the coupon to create a new discount for.
356
+ attr_accessor :coupon
357
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
358
+ attr_accessor :discount
359
+ # ID of the promotion code to create a new discount for.
360
+ attr_accessor :promotion_code
361
+
362
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
363
+ @coupon = coupon
364
+ @discount = discount
365
+ @promotion_code = promotion_code
366
+ end
367
+ end
368
+
369
+ class InvoiceSettings < Stripe::RequestParams
370
+ class Issuer < Stripe::RequestParams
371
+ # The connected account being referenced when `type` is `account`.
372
+ attr_accessor :account
373
+ # Type of the account referenced in the request.
374
+ attr_accessor :type
375
+
376
+ def initialize(account: nil, type: nil)
377
+ @account = account
378
+ @type = type
379
+ end
380
+ end
381
+ # The account tax IDs associated with the subscription. Will be set on invoices generated by the subscription.
382
+ attr_accessor :account_tax_ids
383
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
384
+ attr_accessor :issuer
385
+
386
+ def initialize(account_tax_ids: nil, issuer: nil)
387
+ @account_tax_ids = account_tax_ids
388
+ @issuer = issuer
389
+ end
390
+ end
391
+
392
+ class Item < Stripe::RequestParams
393
+ class BillingThresholds < Stripe::RequestParams
394
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
395
+ attr_accessor :usage_gte
396
+
397
+ def initialize(usage_gte: nil)
398
+ @usage_gte = usage_gte
399
+ end
400
+ end
401
+
402
+ class Discount < Stripe::RequestParams
403
+ # ID of the coupon to create a new discount for.
404
+ attr_accessor :coupon
405
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
406
+ attr_accessor :discount
407
+ # ID of the promotion code to create a new discount for.
408
+ attr_accessor :promotion_code
409
+
410
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
411
+ @coupon = coupon
412
+ @discount = discount
413
+ @promotion_code = promotion_code
414
+ end
415
+ end
416
+
417
+ class PriceData < Stripe::RequestParams
418
+ class Recurring < Stripe::RequestParams
419
+ # Specifies billing frequency. Either `day`, `week`, `month` or `year`.
420
+ attr_accessor :interval
421
+ # 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).
422
+ attr_accessor :interval_count
423
+
424
+ def initialize(interval: nil, interval_count: nil)
425
+ @interval = interval
426
+ @interval_count = interval_count
427
+ end
428
+ end
429
+ # 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).
430
+ attr_accessor :currency
431
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
432
+ attr_accessor :product
433
+ # The recurring components of a price such as `interval` and `interval_count`.
434
+ attr_accessor :recurring
435
+ # 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.
436
+ attr_accessor :tax_behavior
437
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
438
+ attr_accessor :unit_amount
439
+ # 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.
440
+ attr_accessor :unit_amount_decimal
441
+
442
+ def initialize(
443
+ currency: nil,
444
+ product: nil,
445
+ recurring: nil,
446
+ tax_behavior: nil,
447
+ unit_amount: nil,
448
+ unit_amount_decimal: nil
449
+ )
450
+ @currency = currency
451
+ @product = product
452
+ @recurring = recurring
453
+ @tax_behavior = tax_behavior
454
+ @unit_amount = unit_amount
455
+ @unit_amount_decimal = unit_amount_decimal
456
+ end
457
+ end
458
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
459
+ attr_accessor :billing_thresholds
460
+ # 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.
461
+ attr_accessor :clear_usage
462
+ # A flag that, if set to `true`, will delete the specified item.
463
+ attr_accessor :deleted
464
+ # The coupons to redeem into discounts for the subscription item.
465
+ attr_accessor :discounts
466
+ # Subscription item to update.
467
+ attr_accessor :id
468
+ # 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`.
469
+ attr_accessor :metadata
470
+ # Plan ID for this item, as a string.
471
+ attr_accessor :plan
472
+ # 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.
473
+ attr_accessor :price
474
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
475
+ attr_accessor :price_data
476
+ # Quantity for this item.
477
+ attr_accessor :quantity
478
+ # 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.
479
+ attr_accessor :tax_rates
480
+
481
+ def initialize(
482
+ billing_thresholds: nil,
483
+ clear_usage: nil,
484
+ deleted: nil,
485
+ discounts: nil,
486
+ id: nil,
487
+ metadata: nil,
488
+ plan: nil,
489
+ price: nil,
490
+ price_data: nil,
491
+ quantity: nil,
492
+ tax_rates: nil
493
+ )
494
+ @billing_thresholds = billing_thresholds
495
+ @clear_usage = clear_usage
496
+ @deleted = deleted
497
+ @discounts = discounts
498
+ @id = id
499
+ @metadata = metadata
500
+ @plan = plan
501
+ @price = price
502
+ @price_data = price_data
503
+ @quantity = quantity
504
+ @tax_rates = tax_rates
505
+ end
506
+ end
507
+
508
+ class PauseCollection < Stripe::RequestParams
509
+ # The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
510
+ attr_accessor :behavior
511
+ # The time after which the subscription will resume collecting payments.
512
+ attr_accessor :resumes_at
513
+
514
+ def initialize(behavior: nil, resumes_at: nil)
515
+ @behavior = behavior
516
+ @resumes_at = resumes_at
517
+ end
518
+ end
519
+
520
+ class PaymentSettings < Stripe::RequestParams
521
+ class PaymentMethodOptions < Stripe::RequestParams
522
+ class AcssDebit < Stripe::RequestParams
523
+ class MandateOptions < Stripe::RequestParams
524
+ # Transaction type of the mandate.
525
+ attr_accessor :transaction_type
526
+
527
+ def initialize(transaction_type: nil)
528
+ @transaction_type = transaction_type
529
+ end
530
+ end
531
+ # Additional fields for Mandate creation
532
+ attr_accessor :mandate_options
533
+ # Verification method for the intent
534
+ attr_accessor :verification_method
535
+
536
+ def initialize(mandate_options: nil, verification_method: nil)
537
+ @mandate_options = mandate_options
538
+ @verification_method = verification_method
539
+ end
540
+ end
541
+
542
+ class Bancontact < Stripe::RequestParams
543
+ # Preferred language of the Bancontact authorization page that the customer is redirected to.
544
+ attr_accessor :preferred_language
545
+
546
+ def initialize(preferred_language: nil)
547
+ @preferred_language = preferred_language
548
+ end
549
+ end
550
+
551
+ class Card < Stripe::RequestParams
552
+ class MandateOptions < Stripe::RequestParams
553
+ # Amount to be charged for future payments.
554
+ attr_accessor :amount
555
+ # 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.
556
+ attr_accessor :amount_type
557
+ # A description of the mandate or subscription that is meant to be displayed to the customer.
558
+ attr_accessor :description
559
+
560
+ def initialize(amount: nil, amount_type: nil, description: nil)
561
+ @amount = amount
562
+ @amount_type = amount_type
563
+ @description = description
564
+ end
565
+ end
566
+ # Configuration options for setting up an eMandate for cards issued in India.
567
+ attr_accessor :mandate_options
568
+ # 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.
569
+ attr_accessor :network
570
+ # 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.
571
+ attr_accessor :request_three_d_secure
572
+
573
+ def initialize(mandate_options: nil, network: nil, request_three_d_secure: nil)
574
+ @mandate_options = mandate_options
575
+ @network = network
576
+ @request_three_d_secure = request_three_d_secure
577
+ end
578
+ end
579
+
580
+ class CustomerBalance < Stripe::RequestParams
581
+ class BankTransfer < Stripe::RequestParams
582
+ class EuBankTransfer < Stripe::RequestParams
583
+ # The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
584
+ attr_accessor :country
585
+
586
+ def initialize(country: nil)
587
+ @country = country
588
+ end
589
+ end
590
+ # Configuration for eu_bank_transfer funding type.
591
+ attr_accessor :eu_bank_transfer
592
+ # 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`.
593
+ attr_accessor :type
594
+
595
+ def initialize(eu_bank_transfer: nil, type: nil)
596
+ @eu_bank_transfer = eu_bank_transfer
597
+ @type = type
598
+ end
599
+ end
600
+ # Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
601
+ attr_accessor :bank_transfer
602
+ # The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
603
+ attr_accessor :funding_type
604
+
605
+ def initialize(bank_transfer: nil, funding_type: nil)
606
+ @bank_transfer = bank_transfer
607
+ @funding_type = funding_type
608
+ end
609
+ end
610
+
611
+ class Konbini < Stripe::RequestParams; end
612
+ class SepaDebit < Stripe::RequestParams; end
613
+
614
+ class UsBankAccount < Stripe::RequestParams
615
+ class FinancialConnections < Stripe::RequestParams
616
+ class Filters < Stripe::RequestParams
617
+ # The account subcategories to use to filter for selectable accounts. Valid subcategories are `checking` and `savings`.
618
+ attr_accessor :account_subcategories
619
+
620
+ def initialize(account_subcategories: nil)
621
+ @account_subcategories = account_subcategories
622
+ end
623
+ end
624
+ # Provide filters for the linked accounts that the customer can select for the payment method.
625
+ attr_accessor :filters
626
+ # 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`.
627
+ attr_accessor :permissions
628
+ # List of data features that you would like to retrieve upon account creation.
629
+ attr_accessor :prefetch
630
+
631
+ def initialize(filters: nil, permissions: nil, prefetch: nil)
632
+ @filters = filters
633
+ @permissions = permissions
634
+ @prefetch = prefetch
635
+ end
636
+ end
637
+ # Additional fields for Financial Connections Session creation
638
+ attr_accessor :financial_connections
639
+ # Verification method for the intent
640
+ attr_accessor :verification_method
641
+
642
+ def initialize(financial_connections: nil, verification_method: nil)
643
+ @financial_connections = financial_connections
644
+ @verification_method = verification_method
645
+ end
646
+ end
647
+ # This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
648
+ attr_accessor :acss_debit
649
+ # This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent.
650
+ attr_accessor :bancontact
651
+ # This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent.
652
+ attr_accessor :card
653
+ # This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent.
654
+ attr_accessor :customer_balance
655
+ # This sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent.
656
+ attr_accessor :konbini
657
+ # This sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice’s PaymentIntent.
658
+ attr_accessor :sepa_debit
659
+ # This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent.
660
+ attr_accessor :us_bank_account
661
+
662
+ def initialize(
663
+ acss_debit: nil,
664
+ bancontact: nil,
665
+ card: nil,
666
+ customer_balance: nil,
667
+ konbini: nil,
668
+ sepa_debit: nil,
669
+ us_bank_account: nil
670
+ )
671
+ @acss_debit = acss_debit
672
+ @bancontact = bancontact
673
+ @card = card
674
+ @customer_balance = customer_balance
675
+ @konbini = konbini
676
+ @sepa_debit = sepa_debit
677
+ @us_bank_account = us_bank_account
678
+ end
679
+ end
680
+ # Payment-method-specific configuration to provide to invoices created by the subscription.
681
+ attr_accessor :payment_method_options
682
+ # 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
683
+ attr_accessor :payment_method_types
684
+ # Configure whether Stripe updates `subscription.default_payment_method` when payment succeeds. Defaults to `off` if unspecified.
685
+ attr_accessor :save_default_payment_method
686
+
687
+ def initialize(
688
+ payment_method_options: nil,
689
+ payment_method_types: nil,
690
+ save_default_payment_method: nil
691
+ )
692
+ @payment_method_options = payment_method_options
693
+ @payment_method_types = payment_method_types
694
+ @save_default_payment_method = save_default_payment_method
695
+ end
696
+ end
697
+
698
+ class PendingInvoiceItemInterval < Stripe::RequestParams
699
+ # Specifies invoicing frequency. Either `day`, `week`, `month` or `year`.
700
+ attr_accessor :interval
701
+ # 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).
702
+ attr_accessor :interval_count
703
+
704
+ def initialize(interval: nil, interval_count: nil)
705
+ @interval = interval
706
+ @interval_count = interval_count
707
+ end
708
+ end
709
+
710
+ class TransferData < Stripe::RequestParams
711
+ # 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.
712
+ attr_accessor :amount_percent
713
+ # ID of an existing, connected Stripe account.
714
+ attr_accessor :destination
715
+
716
+ def initialize(amount_percent: nil, destination: nil)
717
+ @amount_percent = amount_percent
718
+ @destination = destination
719
+ end
720
+ end
721
+
722
+ class TrialSettings < Stripe::RequestParams
723
+ class EndBehavior < Stripe::RequestParams
724
+ # Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
725
+ attr_accessor :missing_payment_method
726
+
727
+ def initialize(missing_payment_method: nil)
728
+ @missing_payment_method = missing_payment_method
729
+ end
730
+ end
731
+ # Defines how the subscription should behave when the user's free trial ends.
732
+ attr_accessor :end_behavior
733
+
734
+ def initialize(end_behavior: nil)
735
+ @end_behavior = end_behavior
736
+ end
737
+ end
738
+ # 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.
739
+ attr_accessor :add_invoice_items
740
+ # 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).
741
+ attr_accessor :application_fee_percent
742
+ # Automatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed.
743
+ attr_accessor :automatic_tax
744
+ # 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).
745
+ attr_accessor :billing_cycle_anchor
746
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
747
+ attr_accessor :billing_thresholds
748
+ # 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.
749
+ attr_accessor :cancel_at
750
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This param will be removed in a future API version. Please use `cancel_at` instead.
751
+ attr_accessor :cancel_at_period_end
752
+ # Details about why this subscription was cancelled
753
+ attr_accessor :cancellation_details
754
+ # 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`.
755
+ attr_accessor :collection_method
756
+ # 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`.
757
+ attr_accessor :days_until_due
758
+ # 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).
759
+ attr_accessor :default_payment_method
760
+ # 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).
761
+ attr_accessor :default_source
762
+ # 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.
763
+ attr_accessor :default_tax_rates
764
+ # 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.
765
+ attr_accessor :description
766
+ # The coupons to redeem into discounts for the subscription. If not specified or empty, inherits the discount from the subscription's customer.
767
+ attr_accessor :discounts
768
+ # Specifies which fields in the response should be expanded.
769
+ attr_accessor :expand
770
+ # All invoices will be billed using the specified settings.
771
+ attr_accessor :invoice_settings
772
+ # A list of up to 20 subscription items, each with an attached price.
773
+ attr_accessor :items
774
+ # 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`.
775
+ attr_accessor :metadata
776
+ # Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `false` (on-session).
777
+ attr_accessor :off_session
778
+ # The account on behalf of which to charge, for each of the subscription's invoices.
779
+ attr_accessor :on_behalf_of
780
+ # 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).
781
+ attr_accessor :pause_collection
782
+ # 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.
783
+ #
784
+ # 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.
785
+ #
786
+ # 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).
787
+ #
788
+ # 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.
789
+ attr_accessor :payment_behavior
790
+ # Payment settings to pass to invoices created by the subscription.
791
+ attr_accessor :payment_settings
792
+ # 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.
793
+ attr_accessor :pending_invoice_item_interval
794
+ # 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`.
795
+ attr_accessor :proration_behavior
796
+ # If set, prorations will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint. `proration_date` 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.
797
+ attr_accessor :proration_date
798
+ # 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.
799
+ attr_accessor :transfer_data
800
+ # 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 `billing_cycle_anchor` will be updated to the `trial_end` value. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`.
801
+ attr_accessor :trial_end
802
+ # 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.
803
+ attr_accessor :trial_from_plan
804
+ # Settings related to subscription trials.
805
+ attr_accessor :trial_settings
806
+
807
+ def initialize(
808
+ add_invoice_items: nil,
809
+ application_fee_percent: nil,
810
+ automatic_tax: nil,
811
+ billing_cycle_anchor: nil,
812
+ billing_thresholds: nil,
813
+ cancel_at: nil,
814
+ cancel_at_period_end: nil,
815
+ cancellation_details: nil,
816
+ collection_method: nil,
817
+ days_until_due: nil,
818
+ default_payment_method: nil,
819
+ default_source: nil,
820
+ default_tax_rates: nil,
821
+ description: nil,
822
+ discounts: nil,
823
+ expand: nil,
824
+ invoice_settings: nil,
825
+ items: nil,
826
+ metadata: nil,
827
+ off_session: nil,
828
+ on_behalf_of: nil,
829
+ pause_collection: nil,
830
+ payment_behavior: nil,
831
+ payment_settings: nil,
832
+ pending_invoice_item_interval: nil,
833
+ proration_behavior: nil,
834
+ proration_date: nil,
835
+ transfer_data: nil,
836
+ trial_end: nil,
837
+ trial_from_plan: nil,
838
+ trial_settings: nil
839
+ )
840
+ @add_invoice_items = add_invoice_items
841
+ @application_fee_percent = application_fee_percent
842
+ @automatic_tax = automatic_tax
843
+ @billing_cycle_anchor = billing_cycle_anchor
844
+ @billing_thresholds = billing_thresholds
845
+ @cancel_at = cancel_at
846
+ @cancel_at_period_end = cancel_at_period_end
847
+ @cancellation_details = cancellation_details
848
+ @collection_method = collection_method
849
+ @days_until_due = days_until_due
850
+ @default_payment_method = default_payment_method
851
+ @default_source = default_source
852
+ @default_tax_rates = default_tax_rates
853
+ @description = description
854
+ @discounts = discounts
855
+ @expand = expand
856
+ @invoice_settings = invoice_settings
857
+ @items = items
858
+ @metadata = metadata
859
+ @off_session = off_session
860
+ @on_behalf_of = on_behalf_of
861
+ @pause_collection = pause_collection
862
+ @payment_behavior = payment_behavior
863
+ @payment_settings = payment_settings
864
+ @pending_invoice_item_interval = pending_invoice_item_interval
865
+ @proration_behavior = proration_behavior
866
+ @proration_date = proration_date
867
+ @transfer_data = transfer_data
868
+ @trial_end = trial_end
869
+ @trial_from_plan = trial_from_plan
870
+ @trial_settings = trial_settings
871
+ end
872
+ end
873
+
874
+ class DeleteDiscountParams < Stripe::RequestParams; end
875
+
876
+ class ListParams < Stripe::RequestParams
877
+ class AutomaticTax < Stripe::RequestParams
878
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
879
+ attr_accessor :enabled
880
+
881
+ def initialize(enabled: nil)
882
+ @enabled = enabled
883
+ end
884
+ end
885
+
886
+ class Created < Stripe::RequestParams
887
+ # Minimum value to filter by (exclusive)
888
+ attr_accessor :gt
889
+ # Minimum value to filter by (inclusive)
890
+ attr_accessor :gte
891
+ # Maximum value to filter by (exclusive)
892
+ attr_accessor :lt
893
+ # Maximum value to filter by (inclusive)
894
+ attr_accessor :lte
895
+
896
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
897
+ @gt = gt
898
+ @gte = gte
899
+ @lt = lt
900
+ @lte = lte
901
+ end
902
+ end
903
+
904
+ class CurrentPeriodEnd < Stripe::RequestParams
905
+ # Minimum value to filter by (exclusive)
906
+ attr_accessor :gt
907
+ # Minimum value to filter by (inclusive)
908
+ attr_accessor :gte
909
+ # Maximum value to filter by (exclusive)
910
+ attr_accessor :lt
911
+ # Maximum value to filter by (inclusive)
912
+ attr_accessor :lte
913
+
914
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
915
+ @gt = gt
916
+ @gte = gte
917
+ @lt = lt
918
+ @lte = lte
919
+ end
920
+ end
921
+
922
+ class CurrentPeriodStart < Stripe::RequestParams
923
+ # Minimum value to filter by (exclusive)
924
+ attr_accessor :gt
925
+ # Minimum value to filter by (inclusive)
926
+ attr_accessor :gte
927
+ # Maximum value to filter by (exclusive)
928
+ attr_accessor :lt
929
+ # Maximum value to filter by (inclusive)
930
+ attr_accessor :lte
931
+
932
+ def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
933
+ @gt = gt
934
+ @gte = gte
935
+ @lt = lt
936
+ @lte = lte
937
+ end
938
+ end
939
+ # Filter subscriptions by their automatic tax settings.
940
+ attr_accessor :automatic_tax
941
+ # The collection method of the subscriptions to retrieve. Either `charge_automatically` or `send_invoice`.
942
+ attr_accessor :collection_method
943
+ # Only return subscriptions that were created during the given date interval.
944
+ attr_accessor :created
945
+ # Only return subscriptions whose current_period_end falls within the given date interval.
946
+ attr_accessor :current_period_end
947
+ # Only return subscriptions whose current_period_start falls within the given date interval.
948
+ attr_accessor :current_period_start
949
+ # The ID of the customer whose subscriptions will be retrieved.
950
+ attr_accessor :customer
951
+ # 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.
952
+ attr_accessor :ending_before
953
+ # Specifies which fields in the response should be expanded.
954
+ attr_accessor :expand
955
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
956
+ attr_accessor :limit
957
+ # The ID of the plan whose subscriptions will be retrieved.
958
+ attr_accessor :plan
959
+ # Filter for subscriptions that contain this recurring price ID.
960
+ attr_accessor :price
961
+ # 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.
962
+ attr_accessor :starting_after
963
+ # 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.
964
+ attr_accessor :status
965
+ # 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.
966
+ attr_accessor :test_clock
967
+
968
+ def initialize(
969
+ automatic_tax: nil,
970
+ collection_method: nil,
971
+ created: nil,
972
+ current_period_end: nil,
973
+ current_period_start: nil,
974
+ customer: nil,
975
+ ending_before: nil,
976
+ expand: nil,
977
+ limit: nil,
978
+ plan: nil,
979
+ price: nil,
980
+ starting_after: nil,
981
+ status: nil,
982
+ test_clock: nil
983
+ )
984
+ @automatic_tax = automatic_tax
985
+ @collection_method = collection_method
986
+ @created = created
987
+ @current_period_end = current_period_end
988
+ @current_period_start = current_period_start
989
+ @customer = customer
990
+ @ending_before = ending_before
991
+ @expand = expand
992
+ @limit = limit
993
+ @plan = plan
994
+ @price = price
995
+ @starting_after = starting_after
996
+ @status = status
997
+ @test_clock = test_clock
998
+ end
999
+ end
1000
+
1001
+ class CreateParams < Stripe::RequestParams
1002
+ class AddInvoiceItem < Stripe::RequestParams
1003
+ class Discount < Stripe::RequestParams
1004
+ # ID of the coupon to create a new discount for.
1005
+ attr_accessor :coupon
1006
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
1007
+ attr_accessor :discount
1008
+ # ID of the promotion code to create a new discount for.
1009
+ attr_accessor :promotion_code
1010
+
1011
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
1012
+ @coupon = coupon
1013
+ @discount = discount
1014
+ @promotion_code = promotion_code
1015
+ end
1016
+ end
1017
+
1018
+ class PriceData < Stripe::RequestParams
1019
+ # 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).
1020
+ attr_accessor :currency
1021
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
1022
+ attr_accessor :product
1023
+ # 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.
1024
+ attr_accessor :tax_behavior
1025
+ # 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.
1026
+ attr_accessor :unit_amount
1027
+ # 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.
1028
+ attr_accessor :unit_amount_decimal
1029
+
1030
+ def initialize(
1031
+ currency: nil,
1032
+ product: nil,
1033
+ tax_behavior: nil,
1034
+ unit_amount: nil,
1035
+ unit_amount_decimal: nil
1036
+ )
1037
+ @currency = currency
1038
+ @product = product
1039
+ @tax_behavior = tax_behavior
1040
+ @unit_amount = unit_amount
1041
+ @unit_amount_decimal = unit_amount_decimal
1042
+ end
1043
+ end
1044
+ # The coupons to redeem into discounts for the item.
1045
+ attr_accessor :discounts
1046
+ # The ID of the price object. One of `price` or `price_data` is required.
1047
+ attr_accessor :price
1048
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1049
+ attr_accessor :price_data
1050
+ # Quantity for this item. Defaults to 1.
1051
+ attr_accessor :quantity
1052
+ # The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
1053
+ attr_accessor :tax_rates
1054
+
1055
+ def initialize(discounts: nil, price: nil, price_data: nil, quantity: nil, tax_rates: nil)
1056
+ @discounts = discounts
1057
+ @price = price
1058
+ @price_data = price_data
1059
+ @quantity = quantity
1060
+ @tax_rates = tax_rates
1061
+ end
1062
+ end
1063
+
1064
+ class AutomaticTax < Stripe::RequestParams
1065
+ class Liability < Stripe::RequestParams
1066
+ # The connected account being referenced when `type` is `account`.
1067
+ attr_accessor :account
1068
+ # Type of the account referenced in the request.
1069
+ attr_accessor :type
12
1070
 
13
- custom_method :delete_discount, http_verb: :delete, http_path: "discount"
1071
+ def initialize(account: nil, type: nil)
1072
+ @account = account
1073
+ @type = type
1074
+ end
1075
+ end
1076
+ # Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
1077
+ attr_accessor :enabled
1078
+ # 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.
1079
+ attr_accessor :liability
14
1080
 
1081
+ def initialize(enabled: nil, liability: nil)
1082
+ @enabled = enabled
1083
+ @liability = liability
1084
+ end
1085
+ end
1086
+
1087
+ class BillingCycleAnchorConfig < Stripe::RequestParams
1088
+ # The day of the month the billing_cycle_anchor should be. Ranges from 1 to 31.
1089
+ attr_accessor :day_of_month
1090
+ # The hour of the day the billing_cycle_anchor should be. Ranges from 0 to 23.
1091
+ attr_accessor :hour
1092
+ # The minute of the hour the billing_cycle_anchor should be. Ranges from 0 to 59.
1093
+ attr_accessor :minute
1094
+ # The month to start full cycle billing periods. Ranges from 1 to 12.
1095
+ attr_accessor :month
1096
+ # The second of the minute the billing_cycle_anchor should be. Ranges from 0 to 59.
1097
+ attr_accessor :second
1098
+
1099
+ def initialize(day_of_month: nil, hour: nil, minute: nil, month: nil, second: nil)
1100
+ @day_of_month = day_of_month
1101
+ @hour = hour
1102
+ @minute = minute
1103
+ @month = month
1104
+ @second = second
1105
+ end
1106
+ end
1107
+
1108
+ class BillingThresholds < Stripe::RequestParams
1109
+ # Monetary threshold that triggers the subscription to advance to a new billing period
1110
+ attr_accessor :amount_gte
1111
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
1112
+ attr_accessor :reset_billing_cycle_anchor
1113
+
1114
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
1115
+ @amount_gte = amount_gte
1116
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
1117
+ end
1118
+ end
1119
+
1120
+ class Discount < Stripe::RequestParams
1121
+ # ID of the coupon to create a new discount for.
1122
+ attr_accessor :coupon
1123
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
1124
+ attr_accessor :discount
1125
+ # ID of the promotion code to create a new discount for.
1126
+ attr_accessor :promotion_code
1127
+
1128
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
1129
+ @coupon = coupon
1130
+ @discount = discount
1131
+ @promotion_code = promotion_code
1132
+ end
1133
+ end
1134
+
1135
+ class InvoiceSettings < Stripe::RequestParams
1136
+ class Issuer < Stripe::RequestParams
1137
+ # The connected account being referenced when `type` is `account`.
1138
+ attr_accessor :account
1139
+ # Type of the account referenced in the request.
1140
+ attr_accessor :type
1141
+
1142
+ def initialize(account: nil, type: nil)
1143
+ @account = account
1144
+ @type = type
1145
+ end
1146
+ end
1147
+ # The account tax IDs associated with the subscription. Will be set on invoices generated by the subscription.
1148
+ attr_accessor :account_tax_ids
1149
+ # The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
1150
+ attr_accessor :issuer
1151
+
1152
+ def initialize(account_tax_ids: nil, issuer: nil)
1153
+ @account_tax_ids = account_tax_ids
1154
+ @issuer = issuer
1155
+ end
1156
+ end
1157
+
1158
+ class Item < Stripe::RequestParams
1159
+ class BillingThresholds < Stripe::RequestParams
1160
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
1161
+ attr_accessor :usage_gte
1162
+
1163
+ def initialize(usage_gte: nil)
1164
+ @usage_gte = usage_gte
1165
+ end
1166
+ end
1167
+
1168
+ class Discount < Stripe::RequestParams
1169
+ # ID of the coupon to create a new discount for.
1170
+ attr_accessor :coupon
1171
+ # ID of an existing discount on the object (or one of its ancestors) to reuse.
1172
+ attr_accessor :discount
1173
+ # ID of the promotion code to create a new discount for.
1174
+ attr_accessor :promotion_code
1175
+
1176
+ def initialize(coupon: nil, discount: nil, promotion_code: nil)
1177
+ @coupon = coupon
1178
+ @discount = discount
1179
+ @promotion_code = promotion_code
1180
+ end
1181
+ end
1182
+
1183
+ class PriceData < Stripe::RequestParams
1184
+ class Recurring < Stripe::RequestParams
1185
+ # Specifies billing frequency. Either `day`, `week`, `month` or `year`.
1186
+ attr_accessor :interval
1187
+ # 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).
1188
+ attr_accessor :interval_count
1189
+
1190
+ def initialize(interval: nil, interval_count: nil)
1191
+ @interval = interval
1192
+ @interval_count = interval_count
1193
+ end
1194
+ end
1195
+ # 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).
1196
+ attr_accessor :currency
1197
+ # The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
1198
+ attr_accessor :product
1199
+ # The recurring components of a price such as `interval` and `interval_count`.
1200
+ attr_accessor :recurring
1201
+ # 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.
1202
+ attr_accessor :tax_behavior
1203
+ # A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1204
+ attr_accessor :unit_amount
1205
+ # 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.
1206
+ attr_accessor :unit_amount_decimal
1207
+
1208
+ def initialize(
1209
+ currency: nil,
1210
+ product: nil,
1211
+ recurring: nil,
1212
+ tax_behavior: nil,
1213
+ unit_amount: nil,
1214
+ unit_amount_decimal: nil
1215
+ )
1216
+ @currency = currency
1217
+ @product = product
1218
+ @recurring = recurring
1219
+ @tax_behavior = tax_behavior
1220
+ @unit_amount = unit_amount
1221
+ @unit_amount_decimal = unit_amount_decimal
1222
+ end
1223
+ end
1224
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
1225
+ attr_accessor :billing_thresholds
1226
+ # The coupons to redeem into discounts for the subscription item.
1227
+ attr_accessor :discounts
1228
+ # 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`.
1229
+ attr_accessor :metadata
1230
+ # Plan ID for this item, as a string.
1231
+ attr_accessor :plan
1232
+ # The ID of the price object.
1233
+ attr_accessor :price
1234
+ # Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
1235
+ attr_accessor :price_data
1236
+ # Quantity for this item.
1237
+ attr_accessor :quantity
1238
+ # 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.
1239
+ attr_accessor :tax_rates
1240
+
1241
+ def initialize(
1242
+ billing_thresholds: nil,
1243
+ discounts: nil,
1244
+ metadata: nil,
1245
+ plan: nil,
1246
+ price: nil,
1247
+ price_data: nil,
1248
+ quantity: nil,
1249
+ tax_rates: nil
1250
+ )
1251
+ @billing_thresholds = billing_thresholds
1252
+ @discounts = discounts
1253
+ @metadata = metadata
1254
+ @plan = plan
1255
+ @price = price
1256
+ @price_data = price_data
1257
+ @quantity = quantity
1258
+ @tax_rates = tax_rates
1259
+ end
1260
+ end
1261
+
1262
+ class PaymentSettings < Stripe::RequestParams
1263
+ class PaymentMethodOptions < Stripe::RequestParams
1264
+ class AcssDebit < Stripe::RequestParams
1265
+ class MandateOptions < Stripe::RequestParams
1266
+ # Transaction type of the mandate.
1267
+ attr_accessor :transaction_type
1268
+
1269
+ def initialize(transaction_type: nil)
1270
+ @transaction_type = transaction_type
1271
+ end
1272
+ end
1273
+ # Additional fields for Mandate creation
1274
+ attr_accessor :mandate_options
1275
+ # Verification method for the intent
1276
+ attr_accessor :verification_method
1277
+
1278
+ def initialize(mandate_options: nil, verification_method: nil)
1279
+ @mandate_options = mandate_options
1280
+ @verification_method = verification_method
1281
+ end
1282
+ end
1283
+
1284
+ class Bancontact < Stripe::RequestParams
1285
+ # Preferred language of the Bancontact authorization page that the customer is redirected to.
1286
+ attr_accessor :preferred_language
1287
+
1288
+ def initialize(preferred_language: nil)
1289
+ @preferred_language = preferred_language
1290
+ end
1291
+ end
1292
+
1293
+ class Card < Stripe::RequestParams
1294
+ class MandateOptions < Stripe::RequestParams
1295
+ # Amount to be charged for future payments.
1296
+ attr_accessor :amount
1297
+ # 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.
1298
+ attr_accessor :amount_type
1299
+ # A description of the mandate or subscription that is meant to be displayed to the customer.
1300
+ attr_accessor :description
1301
+
1302
+ def initialize(amount: nil, amount_type: nil, description: nil)
1303
+ @amount = amount
1304
+ @amount_type = amount_type
1305
+ @description = description
1306
+ end
1307
+ end
1308
+ # Configuration options for setting up an eMandate for cards issued in India.
1309
+ attr_accessor :mandate_options
1310
+ # 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.
1311
+ attr_accessor :network
1312
+ # 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.
1313
+ attr_accessor :request_three_d_secure
1314
+
1315
+ def initialize(mandate_options: nil, network: nil, request_three_d_secure: nil)
1316
+ @mandate_options = mandate_options
1317
+ @network = network
1318
+ @request_three_d_secure = request_three_d_secure
1319
+ end
1320
+ end
1321
+
1322
+ class CustomerBalance < Stripe::RequestParams
1323
+ class BankTransfer < Stripe::RequestParams
1324
+ class EuBankTransfer < Stripe::RequestParams
1325
+ # The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
1326
+ attr_accessor :country
1327
+
1328
+ def initialize(country: nil)
1329
+ @country = country
1330
+ end
1331
+ end
1332
+ # Configuration for eu_bank_transfer funding type.
1333
+ attr_accessor :eu_bank_transfer
1334
+ # 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`.
1335
+ attr_accessor :type
1336
+
1337
+ def initialize(eu_bank_transfer: nil, type: nil)
1338
+ @eu_bank_transfer = eu_bank_transfer
1339
+ @type = type
1340
+ end
1341
+ end
1342
+ # Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
1343
+ attr_accessor :bank_transfer
1344
+ # The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
1345
+ attr_accessor :funding_type
1346
+
1347
+ def initialize(bank_transfer: nil, funding_type: nil)
1348
+ @bank_transfer = bank_transfer
1349
+ @funding_type = funding_type
1350
+ end
1351
+ end
1352
+
1353
+ class Konbini < Stripe::RequestParams; end
1354
+ class SepaDebit < Stripe::RequestParams; end
1355
+
1356
+ class UsBankAccount < Stripe::RequestParams
1357
+ class FinancialConnections < Stripe::RequestParams
1358
+ class Filters < Stripe::RequestParams
1359
+ # The account subcategories to use to filter for selectable accounts. Valid subcategories are `checking` and `savings`.
1360
+ attr_accessor :account_subcategories
1361
+
1362
+ def initialize(account_subcategories: nil)
1363
+ @account_subcategories = account_subcategories
1364
+ end
1365
+ end
1366
+ # Provide filters for the linked accounts that the customer can select for the payment method.
1367
+ attr_accessor :filters
1368
+ # 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`.
1369
+ attr_accessor :permissions
1370
+ # List of data features that you would like to retrieve upon account creation.
1371
+ attr_accessor :prefetch
1372
+
1373
+ def initialize(filters: nil, permissions: nil, prefetch: nil)
1374
+ @filters = filters
1375
+ @permissions = permissions
1376
+ @prefetch = prefetch
1377
+ end
1378
+ end
1379
+ # Additional fields for Financial Connections Session creation
1380
+ attr_accessor :financial_connections
1381
+ # Verification method for the intent
1382
+ attr_accessor :verification_method
1383
+
1384
+ def initialize(financial_connections: nil, verification_method: nil)
1385
+ @financial_connections = financial_connections
1386
+ @verification_method = verification_method
1387
+ end
1388
+ end
1389
+ # This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
1390
+ attr_accessor :acss_debit
1391
+ # This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent.
1392
+ attr_accessor :bancontact
1393
+ # This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent.
1394
+ attr_accessor :card
1395
+ # This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent.
1396
+ attr_accessor :customer_balance
1397
+ # This sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent.
1398
+ attr_accessor :konbini
1399
+ # This sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice’s PaymentIntent.
1400
+ attr_accessor :sepa_debit
1401
+ # This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent.
1402
+ attr_accessor :us_bank_account
1403
+
1404
+ def initialize(
1405
+ acss_debit: nil,
1406
+ bancontact: nil,
1407
+ card: nil,
1408
+ customer_balance: nil,
1409
+ konbini: nil,
1410
+ sepa_debit: nil,
1411
+ us_bank_account: nil
1412
+ )
1413
+ @acss_debit = acss_debit
1414
+ @bancontact = bancontact
1415
+ @card = card
1416
+ @customer_balance = customer_balance
1417
+ @konbini = konbini
1418
+ @sepa_debit = sepa_debit
1419
+ @us_bank_account = us_bank_account
1420
+ end
1421
+ end
1422
+ # Payment-method-specific configuration to provide to invoices created by the subscription.
1423
+ attr_accessor :payment_method_options
1424
+ # 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
1425
+ attr_accessor :payment_method_types
1426
+ # Configure whether Stripe updates `subscription.default_payment_method` when payment succeeds. Defaults to `off` if unspecified.
1427
+ attr_accessor :save_default_payment_method
1428
+
1429
+ def initialize(
1430
+ payment_method_options: nil,
1431
+ payment_method_types: nil,
1432
+ save_default_payment_method: nil
1433
+ )
1434
+ @payment_method_options = payment_method_options
1435
+ @payment_method_types = payment_method_types
1436
+ @save_default_payment_method = save_default_payment_method
1437
+ end
1438
+ end
1439
+
1440
+ class PendingInvoiceItemInterval < Stripe::RequestParams
1441
+ # Specifies invoicing frequency. Either `day`, `week`, `month` or `year`.
1442
+ attr_accessor :interval
1443
+ # 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).
1444
+ attr_accessor :interval_count
1445
+
1446
+ def initialize(interval: nil, interval_count: nil)
1447
+ @interval = interval
1448
+ @interval_count = interval_count
1449
+ end
1450
+ end
1451
+
1452
+ class TransferData < Stripe::RequestParams
1453
+ # 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.
1454
+ attr_accessor :amount_percent
1455
+ # ID of an existing, connected Stripe account.
1456
+ attr_accessor :destination
1457
+
1458
+ def initialize(amount_percent: nil, destination: nil)
1459
+ @amount_percent = amount_percent
1460
+ @destination = destination
1461
+ end
1462
+ end
1463
+
1464
+ class TrialSettings < Stripe::RequestParams
1465
+ class EndBehavior < Stripe::RequestParams
1466
+ # Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
1467
+ attr_accessor :missing_payment_method
1468
+
1469
+ def initialize(missing_payment_method: nil)
1470
+ @missing_payment_method = missing_payment_method
1471
+ end
1472
+ end
1473
+ # Defines how the subscription should behave when the user's free trial ends.
1474
+ attr_accessor :end_behavior
1475
+
1476
+ def initialize(end_behavior: nil)
1477
+ @end_behavior = end_behavior
1478
+ end
1479
+ end
1480
+ # 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.
1481
+ attr_accessor :add_invoice_items
1482
+ # 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).
1483
+ attr_accessor :application_fee_percent
1484
+ # Automatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed.
1485
+ attr_accessor :automatic_tax
1486
+ # 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.
1487
+ attr_accessor :backdate_start_date
1488
+ # 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.
1489
+ attr_accessor :billing_cycle_anchor
1490
+ # 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.
1491
+ attr_accessor :billing_cycle_anchor_config
1492
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
1493
+ attr_accessor :billing_thresholds
1494
+ # 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.
1495
+ attr_accessor :cancel_at
1496
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This param will be removed in a future API version. Please use `cancel_at` instead.
1497
+ attr_accessor :cancel_at_period_end
1498
+ # 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`.
1499
+ attr_accessor :collection_method
1500
+ # 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).
1501
+ attr_accessor :currency
1502
+ # The identifier of the customer to subscribe.
1503
+ attr_accessor :customer
1504
+ # 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`.
1505
+ attr_accessor :days_until_due
1506
+ # 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).
1507
+ attr_accessor :default_payment_method
1508
+ # 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).
1509
+ attr_accessor :default_source
1510
+ # 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.
1511
+ attr_accessor :default_tax_rates
1512
+ # 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.
1513
+ attr_accessor :description
1514
+ # The coupons to redeem into discounts for the subscription. If not specified or empty, inherits the discount from the subscription's customer.
1515
+ attr_accessor :discounts
1516
+ # Specifies which fields in the response should be expanded.
1517
+ attr_accessor :expand
1518
+ # All invoices will be billed using the specified settings.
1519
+ attr_accessor :invoice_settings
1520
+ # A list of up to 20 subscription items, each with an attached price.
1521
+ attr_accessor :items
1522
+ # 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`.
1523
+ attr_accessor :metadata
1524
+ # Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `false` (on-session).
1525
+ attr_accessor :off_session
1526
+ # The account on behalf of which to charge, for each of the subscription's invoices.
1527
+ attr_accessor :on_behalf_of
1528
+ # Only applies to subscriptions with `collection_method=charge_automatically`.
1529
+ #
1530
+ # 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.
1531
+ #
1532
+ # 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.
1533
+ #
1534
+ # 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.
1535
+ #
1536
+ # `pending_if_incomplete` is only used with updates and cannot be passed when creating a Subscription.
1537
+ #
1538
+ # Subscriptions with `collection_method=send_invoice` are automatically activated regardless of the first Invoice status.
1539
+ attr_accessor :payment_behavior
1540
+ # Payment settings to pass to invoices created by the subscription.
1541
+ attr_accessor :payment_settings
1542
+ # 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.
1543
+ attr_accessor :pending_invoice_item_interval
1544
+ # 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`.
1545
+ attr_accessor :proration_behavior
1546
+ # 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.
1547
+ attr_accessor :transfer_data
1548
+ # 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.
1549
+ attr_accessor :trial_end
1550
+ # 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.
1551
+ attr_accessor :trial_from_plan
1552
+ # 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.
1553
+ attr_accessor :trial_period_days
1554
+ # Settings related to subscription trials.
1555
+ attr_accessor :trial_settings
1556
+
1557
+ def initialize(
1558
+ add_invoice_items: nil,
1559
+ application_fee_percent: nil,
1560
+ automatic_tax: nil,
1561
+ backdate_start_date: nil,
1562
+ billing_cycle_anchor: nil,
1563
+ billing_cycle_anchor_config: nil,
1564
+ billing_thresholds: nil,
1565
+ cancel_at: nil,
1566
+ cancel_at_period_end: nil,
1567
+ collection_method: nil,
1568
+ currency: nil,
1569
+ customer: nil,
1570
+ days_until_due: nil,
1571
+ default_payment_method: nil,
1572
+ default_source: nil,
1573
+ default_tax_rates: nil,
1574
+ description: nil,
1575
+ discounts: nil,
1576
+ expand: nil,
1577
+ invoice_settings: nil,
1578
+ items: nil,
1579
+ metadata: nil,
1580
+ off_session: nil,
1581
+ on_behalf_of: nil,
1582
+ payment_behavior: nil,
1583
+ payment_settings: nil,
1584
+ pending_invoice_item_interval: nil,
1585
+ proration_behavior: nil,
1586
+ transfer_data: nil,
1587
+ trial_end: nil,
1588
+ trial_from_plan: nil,
1589
+ trial_period_days: nil,
1590
+ trial_settings: nil
1591
+ )
1592
+ @add_invoice_items = add_invoice_items
1593
+ @application_fee_percent = application_fee_percent
1594
+ @automatic_tax = automatic_tax
1595
+ @backdate_start_date = backdate_start_date
1596
+ @billing_cycle_anchor = billing_cycle_anchor
1597
+ @billing_cycle_anchor_config = billing_cycle_anchor_config
1598
+ @billing_thresholds = billing_thresholds
1599
+ @cancel_at = cancel_at
1600
+ @cancel_at_period_end = cancel_at_period_end
1601
+ @collection_method = collection_method
1602
+ @currency = currency
1603
+ @customer = customer
1604
+ @days_until_due = days_until_due
1605
+ @default_payment_method = default_payment_method
1606
+ @default_source = default_source
1607
+ @default_tax_rates = default_tax_rates
1608
+ @description = description
1609
+ @discounts = discounts
1610
+ @expand = expand
1611
+ @invoice_settings = invoice_settings
1612
+ @items = items
1613
+ @metadata = metadata
1614
+ @off_session = off_session
1615
+ @on_behalf_of = on_behalf_of
1616
+ @payment_behavior = payment_behavior
1617
+ @payment_settings = payment_settings
1618
+ @pending_invoice_item_interval = pending_invoice_item_interval
1619
+ @proration_behavior = proration_behavior
1620
+ @transfer_data = transfer_data
1621
+ @trial_end = trial_end
1622
+ @trial_from_plan = trial_from_plan
1623
+ @trial_period_days = trial_period_days
1624
+ @trial_settings = trial_settings
1625
+ end
1626
+ end
1627
+
1628
+ class SearchParams < Stripe::RequestParams
1629
+ # Specifies which fields in the response should be expanded.
1630
+ attr_accessor :expand
1631
+ # A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
1632
+ attr_accessor :limit
1633
+ # 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.
1634
+ attr_accessor :page
1635
+ # 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).
1636
+ attr_accessor :query
1637
+
1638
+ def initialize(expand: nil, limit: nil, page: nil, query: nil)
1639
+ @expand = expand
1640
+ @limit = limit
1641
+ @page = page
1642
+ @query = query
1643
+ end
1644
+ end
1645
+
1646
+ class ResumeParams < Stripe::RequestParams
1647
+ # 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).
1648
+ attr_accessor :billing_cycle_anchor
1649
+ # Specifies which fields in the response should be expanded.
1650
+ attr_accessor :expand
1651
+ # Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) resulting from the `billing_cycle_anchor` being `unchanged`. When the `billing_cycle_anchor` is set to `now` (default value), no prorations are generated. If no value is passed, the default is `create_prorations`.
1652
+ attr_accessor :proration_behavior
1653
+ # If set, prorations will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint.
1654
+ attr_accessor :proration_date
1655
+
1656
+ def initialize(
1657
+ billing_cycle_anchor: nil,
1658
+ expand: nil,
1659
+ proration_behavior: nil,
1660
+ proration_date: nil
1661
+ )
1662
+ @billing_cycle_anchor = billing_cycle_anchor
1663
+ @expand = expand
1664
+ @proration_behavior = proration_behavior
1665
+ @proration_date = proration_date
1666
+ end
1667
+ end
1668
+ # ID of the Connect Application that created the subscription.
1669
+ attr_reader :application
1670
+ # 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.
1671
+ attr_reader :application_fee_percent
1672
+ # Attribute for field automatic_tax
1673
+ attr_reader :automatic_tax
1674
+ # The reference point that aligns future [billing cycle](https://stripe.com/docs/subscriptions/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. The timestamp is in UTC format.
1675
+ attr_reader :billing_cycle_anchor
1676
+ # The fixed values used to calculate the `billing_cycle_anchor`.
1677
+ attr_reader :billing_cycle_anchor_config
1678
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
1679
+ attr_reader :billing_thresholds
1680
+ # A date in the future at which the subscription will automatically get canceled
1681
+ attr_reader :cancel_at
1682
+ # Whether this subscription will (if `status=active`) or did (if `status=canceled`) cancel at the end of the current billing period. This field will be removed in a future API version. Please use `cancel_at` instead.
1683
+ attr_reader :cancel_at_period_end
1684
+ # If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.
1685
+ attr_reader :canceled_at
1686
+ # Details about why this subscription was cancelled
1687
+ attr_reader :cancellation_details
1688
+ # 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`.
1689
+ attr_reader :collection_method
1690
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
1691
+ attr_reader :created
1692
+ # 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).
1693
+ attr_reader :currency
1694
+ # ID of the customer who owns the subscription.
1695
+ attr_reader :customer
1696
+ # Number of days a customer has to pay invoices generated by this subscription. This value will be `null` for subscriptions where `collection_method=charge_automatically`.
1697
+ attr_reader :days_until_due
1698
+ # 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).
1699
+ attr_reader :default_payment_method
1700
+ # 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).
1701
+ attr_reader :default_source
1702
+ # 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.
1703
+ attr_reader :default_tax_rates
1704
+ # 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.
1705
+ attr_reader :description
1706
+ # The discounts applied to the subscription. Subscription item discounts are applied before subscription discounts. Use `expand[]=discounts` to expand each discount.
1707
+ attr_reader :discounts
1708
+ # If the subscription has ended, the date the subscription ended.
1709
+ attr_reader :ended_at
1710
+ # Unique identifier for the object.
1711
+ attr_reader :id
1712
+ # Attribute for field invoice_settings
1713
+ attr_reader :invoice_settings
1714
+ # List of subscription items, each with an attached price.
1715
+ attr_reader :items
1716
+ # The most recent invoice this subscription has generated.
1717
+ attr_reader :latest_invoice
1718
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
1719
+ attr_reader :livemode
1720
+ # 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.
1721
+ attr_reader :metadata
1722
+ # Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`.
1723
+ attr_reader :next_pending_invoice_item_invoice
1724
+ # String representing the object's type. Objects of the same type share the same value.
1725
+ attr_reader :object
1726
+ # The account (if any) the charge was made on behalf of for charges associated with this subscription. See the [Connect documentation](https://stripe.com/docs/connect/subscriptions#on-behalf-of) for details.
1727
+ attr_reader :on_behalf_of
1728
+ # 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).
1729
+ attr_reader :pause_collection
1730
+ # Payment settings passed on to invoices created by the subscription.
1731
+ attr_reader :payment_settings
1732
+ # 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.
1733
+ attr_reader :pending_invoice_item_interval
1734
+ # You can use this [SetupIntent](https://stripe.com/docs/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2).
1735
+ attr_reader :pending_setup_intent
1736
+ # If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid.
1737
+ attr_reader :pending_update
1738
+ # The schedule attached to the subscription
1739
+ attr_reader :schedule
1740
+ # Date when the subscription was first created. The date might differ from the `created` date due to backdating.
1741
+ attr_reader :start_date
1742
+ # Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, `unpaid`, or `paused`.
1743
+ #
1744
+ # For `collection_method=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this status can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` status. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal status, the open invoice will be voided and no further invoices will be generated.
1745
+ #
1746
+ # A subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over.
1747
+ #
1748
+ # A subscription can only enter a `paused` status [when a trial ends without a payment method](https://stripe.com/docs/billing/subscriptions/trials#create-free-trials-without-payment). A `paused` subscription doesn't generate invoices and can be resumed after your customer adds their payment method. The `paused` status is different from [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment), which still generates invoices and leaves the subscription's status unchanged.
1749
+ #
1750
+ # If subscription `collection_method=charge_automatically`, it becomes `past_due` when payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will become `canceled` or `unpaid` (depending on your subscriptions settings).
1751
+ #
1752
+ # If subscription `collection_method=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.
1753
+ attr_reader :status
1754
+ # ID of the test clock this subscription belongs to.
1755
+ attr_reader :test_clock
1756
+ # The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
1757
+ attr_reader :transfer_data
1758
+ # If the subscription has a trial, the end of that trial.
1759
+ attr_reader :trial_end
1760
+ # Settings related to subscription trials.
1761
+ attr_reader :trial_settings
1762
+ # If the subscription has a trial, the beginning of that trial. For subsequent trials, this date remains as the start of the first ever trial on the subscription.
1763
+ attr_reader :trial_start
1764
+
1765
+ # 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://docs.stripe.com/metadata).
1766
+ #
1767
+ # Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://docs.stripe.com/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 if invoice_now and prorate are both set to true.
1768
+ #
1769
+ # 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.
1770
+ def cancel(params = {}, opts = {})
1771
+ request_stripe_object(
1772
+ method: :delete,
1773
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(self["id"]) }),
1774
+ params: params,
1775
+ opts: opts
1776
+ )
1777
+ end
1778
+
1779
+ # 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://docs.stripe.com/metadata).
1780
+ #
1781
+ # Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://docs.stripe.com/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 if invoice_now and prorate are both set to true.
1782
+ #
1783
+ # 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.
1784
+ def self.cancel(subscription_exposed_id, params = {}, opts = {})
1785
+ request_stripe_object(
1786
+ method: :delete,
1787
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
1788
+ params: params,
1789
+ opts: opts
1790
+ )
1791
+ end
1792
+
1793
+ # Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.
1794
+ #
1795
+ # When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
1796
+ # The payment_behavior parameter determines the exact behavior of the initial payment.
1797
+ #
1798
+ # To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://docs.stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
1799
+ # Schedules provide the flexibility to model more complex billing configurations that change over time.
1800
+ def self.create(params = {}, opts = {})
1801
+ request_stripe_object(method: :post, path: "/v1/subscriptions", params: params, opts: opts)
1802
+ end
1803
+
1804
+ # Removes the currently applied discount on a subscription.
15
1805
  def delete_discount(params = {}, opts = {})
16
1806
  request_stripe_object(
17
1807
  method: :delete,
18
- path: resource_url + "/discount",
1808
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(self["id"]) }),
1809
+ params: params,
1810
+ opts: opts
1811
+ )
1812
+ end
1813
+
1814
+ # Removes the currently applied discount on a subscription.
1815
+ def self.delete_discount(subscription_exposed_id, params = {}, opts = {})
1816
+ request_stripe_object(
1817
+ method: :delete,
1818
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
1819
+ params: params,
1820
+ opts: opts
1821
+ )
1822
+ end
1823
+
1824
+ # By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled.
1825
+ def self.list(params = {}, opts = {})
1826
+ request_stripe_object(method: :get, path: "/v1/subscriptions", params: params, opts: opts)
1827
+ end
1828
+
1829
+ # 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.
1830
+ def resume(params = {}, opts = {})
1831
+ request_stripe_object(
1832
+ method: :post,
1833
+ path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(self["id"]) }),
1834
+ params: params,
1835
+ opts: opts
1836
+ )
1837
+ end
1838
+
1839
+ # 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.
1840
+ def self.resume(subscription, params = {}, opts = {})
1841
+ request_stripe_object(
1842
+ method: :post,
1843
+ path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(subscription) }),
1844
+ params: params,
1845
+ opts: opts
1846
+ )
1847
+ end
1848
+
1849
+ def self.search(params = {}, opts = {})
1850
+ request_stripe_object(
1851
+ method: :get,
1852
+ path: "/v1/subscriptions/search",
1853
+ params: params,
1854
+ opts: opts
1855
+ )
1856
+ end
1857
+
1858
+ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
1859
+ search(params, opts).auto_paging_each(&blk)
1860
+ end
1861
+
1862
+ # Updates an existing subscription to match the specified parameters.
1863
+ # When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes.
1864
+ # To preview how the proration is calculated, use the [create preview](https://docs.stripe.com/docs/api/invoices/create_preview) endpoint.
1865
+ #
1866
+ # 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.
1867
+ #
1868
+ # Switching prices does not normally change the billing date or generate an immediate charge unless:
1869
+ #
1870
+ #
1871
+ # The billing interval is changed (for example, from monthly to yearly).
1872
+ # The subscription moves from free to paid.
1873
+ # A trial starts or ends.
1874
+ #
1875
+ #
1876
+ # 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://docs.stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment).
1877
+ #
1878
+ # 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://docs.stripe.com/docs/api/invoices/create).
1879
+ #
1880
+ # 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.
1881
+ #
1882
+ # 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://docs.stripe.com/docs/rate-limits) instead.
1883
+ def self.update(subscription_exposed_id, params = {}, opts = {})
1884
+ request_stripe_object(
1885
+ method: :post,
1886
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
19
1887
  params: params,
20
1888
  opts: opts
21
1889
  )