stripe 12.7.0.pre.beta.2 → 13.1.0.pre.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -9
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +4 -3
  5. data/VERSION +1 -1
  6. data/examples/README.md +11 -0
  7. data/examples/meter_event_stream.rb +47 -0
  8. data/examples/new_example.rb +24 -0
  9. data/examples/stripe_webhook_handler.rb +28 -0
  10. data/lib/stripe/api_operations/nested_resource.rb +1 -21
  11. data/lib/stripe/api_operations/request.rb +19 -70
  12. data/lib/stripe/api_operations/save.rb +4 -3
  13. data/lib/stripe/api_operations/singleton_save.rb +5 -2
  14. data/lib/stripe/api_requestor.rb +1131 -0
  15. data/lib/stripe/api_resource.rb +22 -14
  16. data/lib/stripe/api_version.rb +1 -2
  17. data/lib/stripe/connection_manager.rb +1 -1
  18. data/lib/stripe/errors.rb +8 -2
  19. data/lib/stripe/event_types.rb +14 -0
  20. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  21. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  22. data/lib/stripe/list_object.rb +2 -3
  23. data/lib/stripe/oauth.rb +8 -15
  24. data/lib/stripe/object_types.rb +16 -1
  25. data/lib/stripe/request_options.rb +128 -0
  26. data/lib/stripe/resources/billing/credit_balance_summary.rb +14 -0
  27. data/lib/stripe/resources/billing/credit_balance_transaction.rb +26 -0
  28. data/lib/stripe/resources/billing/credit_grant.rb +88 -0
  29. data/lib/stripe/resources/billing/meter.rb +2 -0
  30. data/lib/stripe/resources/customer.rb +2 -3
  31. data/lib/stripe/resources/file.rb +7 -5
  32. data/lib/stripe/resources/issuing/card.rb +20 -0
  33. data/lib/stripe/resources/quote.rb +4 -4
  34. data/lib/stripe/resources/source.rb +3 -2
  35. data/lib/stripe/resources/subscription.rb +6 -6
  36. data/lib/stripe/resources/tax/form.rb +4 -4
  37. data/lib/stripe/resources/usage_record_summary.rb +1 -0
  38. data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
  39. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
  40. data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
  41. data/lib/stripe/resources/v2/event.rb +13 -0
  42. data/lib/stripe/resources.rb +9 -0
  43. data/lib/stripe/search_result_object.rb +1 -1
  44. data/lib/stripe/services/account_capability_service.rb +39 -0
  45. data/lib/stripe/services/account_external_account_service.rb +68 -0
  46. data/lib/stripe/services/account_link_service.rb +17 -0
  47. data/lib/stripe/services/account_login_link_service.rb +19 -0
  48. data/lib/stripe/services/account_notice_service.rb +39 -0
  49. data/lib/stripe/services/account_person_service.rb +61 -0
  50. data/lib/stripe/services/account_service.rb +100 -0
  51. data/lib/stripe/services/account_session_service.rb +17 -0
  52. data/lib/stripe/services/apple_pay_domain_service.rb +50 -0
  53. data/lib/stripe/services/application_fee_refund_service.rb +60 -0
  54. data/lib/stripe/services/application_fee_service.rb +35 -0
  55. data/lib/stripe/services/apps/secret_service.rb +52 -0
  56. data/lib/stripe/services/apps_service.rb +13 -0
  57. data/lib/stripe/services/balance_service.rb +12 -0
  58. data/lib/stripe/services/balance_transaction_service.rb +32 -0
  59. data/lib/stripe/services/billing/alert_service.rb +74 -0
  60. data/lib/stripe/services/billing/credit_balance_summary_service.rb +19 -0
  61. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +30 -0
  62. data/lib/stripe/services/billing/credit_grant_service.rb +74 -0
  63. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +19 -0
  64. data/lib/stripe/services/billing/meter_event_service.rb +19 -0
  65. data/lib/stripe/services/billing/meter_event_summary_service.rb +19 -0
  66. data/lib/stripe/services/billing/meter_service.rb +81 -0
  67. data/lib/stripe/services/billing_portal/configuration_service.rb +52 -0
  68. data/lib/stripe/services/billing_portal/session_service.rb +19 -0
  69. data/lib/stripe/services/billing_portal_service.rb +14 -0
  70. data/lib/stripe/services/billing_service.rb +20 -0
  71. data/lib/stripe/services/capital/financing_offer_service.rb +42 -0
  72. data/lib/stripe/services/capital/financing_summary_service.rb +19 -0
  73. data/lib/stripe/services/capital/financing_transaction_service.rb +31 -0
  74. data/lib/stripe/services/capital_service.rb +15 -0
  75. data/lib/stripe/services/charge_service.rb +69 -0
  76. data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
  77. data/lib/stripe/services/checkout/session_service.rb +72 -0
  78. data/lib/stripe/services/checkout_service.rb +13 -0
  79. data/lib/stripe/services/climate/order_service.rb +68 -0
  80. data/lib/stripe/services/climate/product_service.rb +30 -0
  81. data/lib/stripe/services/climate/supplier_service.rb +30 -0
  82. data/lib/stripe/services/climate_service.rb +15 -0
  83. data/lib/stripe/services/confirmation_token_service.rb +17 -0
  84. data/lib/stripe/services/country_spec_service.rb +28 -0
  85. data/lib/stripe/services/coupon_service.rb +51 -0
  86. data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
  87. data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
  88. data/lib/stripe/services/credit_note_service.rb +93 -0
  89. data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
  90. data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
  91. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
  92. data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
  93. data/lib/stripe/services/customer_payment_method_service.rb +28 -0
  94. data/lib/stripe/services/customer_payment_source_service.rb +76 -0
  95. data/lib/stripe/services/customer_service.rb +89 -0
  96. data/lib/stripe/services/customer_session_service.rb +17 -0
  97. data/lib/stripe/services/customer_tax_id_service.rb +50 -0
  98. data/lib/stripe/services/dispute_service.rb +48 -0
  99. data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
  100. data/lib/stripe/services/entitlements/feature_service.rb +52 -0
  101. data/lib/stripe/services/entitlements_service.rb +14 -0
  102. data/lib/stripe/services/ephemeral_key_service.rb +28 -0
  103. data/lib/stripe/services/event_service.rb +22 -0
  104. data/lib/stripe/services/exchange_rate_service.rb +28 -0
  105. data/lib/stripe/services/file_link_service.rb +38 -0
  106. data/lib/stripe/services/file_service.rb +35 -0
  107. data/lib/stripe/services/financial_connections/account_inferred_balance_service.rb +19 -0
  108. data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
  109. data/lib/stripe/services/financial_connections/account_service.rb +83 -0
  110. data/lib/stripe/services/financial_connections/institution_service.rb +30 -0
  111. data/lib/stripe/services/financial_connections/session_service.rb +30 -0
  112. data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
  113. data/lib/stripe/services/financial_connections_service.rb +16 -0
  114. data/lib/stripe/services/forwarding/request_service.rb +41 -0
  115. data/lib/stripe/services/forwarding_service.rb +13 -0
  116. data/lib/stripe/services/gift_cards/card_service.rb +63 -0
  117. data/lib/stripe/services/gift_cards/transaction_service.rb +74 -0
  118. data/lib/stripe/services/gift_cards_service.rb +14 -0
  119. data/lib/stripe/services/identity/verification_report_service.rb +30 -0
  120. data/lib/stripe/services/identity/verification_session_service.rb +106 -0
  121. data/lib/stripe/services/identity_service.rb +14 -0
  122. data/lib/stripe/services/invoice_item_service.rb +61 -0
  123. data/lib/stripe/services/invoice_line_item_service.rb +31 -0
  124. data/lib/stripe/services/invoice_payment_service.rb +28 -0
  125. data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
  126. data/lib/stripe/services/invoice_service.rb +245 -0
  127. data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
  128. data/lib/stripe/services/issuing/authorization_service.rb +65 -0
  129. data/lib/stripe/services/issuing/card_service.rb +52 -0
  130. data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
  131. data/lib/stripe/services/issuing/credit_underwriting_record_service.rb +74 -0
  132. data/lib/stripe/services/issuing/dispute_service.rb +63 -0
  133. data/lib/stripe/services/issuing/dispute_settlement_detail_service.rb +30 -0
  134. data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
  135. data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
  136. data/lib/stripe/services/issuing/token_service.rb +41 -0
  137. data/lib/stripe/services/issuing/transaction_service.rb +41 -0
  138. data/lib/stripe/services/issuing_service.rb +23 -0
  139. data/lib/stripe/services/mandate_service.rb +17 -0
  140. data/lib/stripe/services/margin_service.rb +50 -0
  141. data/lib/stripe/services/oauth_service.rb +63 -0
  142. data/lib/stripe/services/order_line_item_service.rb +17 -0
  143. data/lib/stripe/services/order_service.rb +78 -0
  144. data/lib/stripe/services/payment_intent_service.rb +230 -0
  145. data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
  146. data/lib/stripe/services/payment_link_service.rb +57 -0
  147. data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
  148. data/lib/stripe/services/payment_method_domain_service.rb +66 -0
  149. data/lib/stripe/services/payment_method_service.rb +86 -0
  150. data/lib/stripe/services/payout_service.rb +66 -0
  151. data/lib/stripe/services/plan_service.rb +49 -0
  152. data/lib/stripe/services/price_service.rb +52 -0
  153. data/lib/stripe/services/product_feature_service.rb +50 -0
  154. data/lib/stripe/services/product_service.rb +70 -0
  155. data/lib/stripe/services/promotion_code_service.rb +50 -0
  156. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
  157. data/lib/stripe/services/quote_line_item_service.rb +17 -0
  158. data/lib/stripe/services/quote_line_service.rb +17 -0
  159. data/lib/stripe/services/quote_preview_invoice_service.rb +17 -0
  160. data/lib/stripe/services/quote_preview_subscription_schedule_service.rb +17 -0
  161. data/lib/stripe/services/quote_service.rb +140 -0
  162. data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
  163. data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
  164. data/lib/stripe/services/radar/value_list_service.rb +63 -0
  165. data/lib/stripe/services/radar_service.rb +15 -0
  166. data/lib/stripe/services/refund_service.rb +63 -0
  167. data/lib/stripe/services/reporting/report_run_service.rb +41 -0
  168. data/lib/stripe/services/reporting/report_type_service.rb +30 -0
  169. data/lib/stripe/services/reporting_service.rb +14 -0
  170. data/lib/stripe/services/review_service.rb +33 -0
  171. data/lib/stripe/services/setup_attempt_service.rb +17 -0
  172. data/lib/stripe/services/setup_intent_service.rb +105 -0
  173. data/lib/stripe/services/shipping_rate_service.rb +50 -0
  174. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
  175. data/lib/stripe/services/sigma_service.rb +13 -0
  176. data/lib/stripe/services/source_service.rb +64 -0
  177. data/lib/stripe/services/source_transaction_service.rb +17 -0
  178. data/lib/stripe/services/subscription_item_service.rb +69 -0
  179. data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
  180. data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
  181. data/lib/stripe/services/subscription_schedule_service.rb +83 -0
  182. data/lib/stripe/services/subscription_service.rb +127 -0
  183. data/lib/stripe/services/tax/association_service.rb +19 -0
  184. data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
  185. data/lib/stripe/services/tax/calculation_service.rb +37 -0
  186. data/lib/stripe/services/tax/form_service.rb +37 -0
  187. data/lib/stripe/services/tax/registration_service.rb +54 -0
  188. data/lib/stripe/services/tax/settings_service.rb +30 -0
  189. data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
  190. data/lib/stripe/services/tax/transaction_service.rb +48 -0
  191. data/lib/stripe/services/tax_code_service.rb +22 -0
  192. data/lib/stripe/services/tax_id_service.rb +38 -0
  193. data/lib/stripe/services/tax_rate_service.rb +38 -0
  194. data/lib/stripe/services/tax_service.rb +18 -0
  195. data/lib/stripe/services/terminal/configuration_service.rb +63 -0
  196. data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
  197. data/lib/stripe/services/terminal/location_service.rb +64 -0
  198. data/lib/stripe/services/terminal/reader_collected_data_service.rb +19 -0
  199. data/lib/stripe/services/terminal/reader_service.rb +151 -0
  200. data/lib/stripe/services/terminal_service.rb +17 -0
  201. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
  202. data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
  203. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +76 -0
  204. data/lib/stripe/services/test_helpers/issuing/card_service.rb +65 -0
  205. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
  206. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
  207. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  208. data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
  209. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
  210. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  211. data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
  212. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
  213. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
  214. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
  215. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
  216. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
  217. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  218. data/lib/stripe/services/test_helpers_service.rb +19 -0
  219. data/lib/stripe/services/token_service.rb +23 -0
  220. data/lib/stripe/services/topup_service.rb +49 -0
  221. data/lib/stripe/services/transfer_reversal_service.rb +56 -0
  222. data/lib/stripe/services/transfer_service.rb +47 -0
  223. data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
  224. data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
  225. data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
  226. data/lib/stripe/services/treasury/financial_account_service.rb +59 -0
  227. data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
  228. data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
  229. data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
  230. data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
  231. data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
  232. data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
  233. data/lib/stripe/services/treasury/transaction_service.rb +30 -0
  234. data/lib/stripe/services/treasury_service.rb +22 -0
  235. data/lib/stripe/services/v1_services.rb +94 -0
  236. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
  237. data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
  238. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
  239. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
  240. data/lib/stripe/services/v2/billing_service.rb +18 -0
  241. data/lib/stripe/services/v2/core/event_service.rb +32 -0
  242. data/lib/stripe/services/v2/core_service.rb +15 -0
  243. data/lib/stripe/services/v2_services.rb +14 -0
  244. data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
  245. data/lib/stripe/services.rb +203 -0
  246. data/lib/stripe/singleton_api_resource.rb +1 -18
  247. data/lib/stripe/stripe_client.rb +51 -1067
  248. data/lib/stripe/stripe_configuration.rb +33 -19
  249. data/lib/stripe/stripe_object.rb +37 -18
  250. data/lib/stripe/stripe_service.rb +32 -0
  251. data/lib/stripe/thin_event.rb +17 -0
  252. data/lib/stripe/util.rb +68 -39
  253. data/lib/stripe/v2_list_object.rb +84 -0
  254. data/lib/stripe/version.rb +1 -1
  255. data/lib/stripe/webhook.rb +1 -1
  256. data/lib/stripe.rb +33 -27
  257. metadata +223 -2
@@ -16,11 +16,11 @@ module Stripe
16
16
  "subscription"
17
17
  end
18
18
 
19
- # Cancels a customer's subscription immediately. The customer will not be charged again for the subscription.
19
+ # Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
20
20
  #
21
- # Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
21
+ # Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed.
22
22
  #
23
- # By default, upon subscription cancellation, Stripe will stop 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.
23
+ # 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.
24
24
  def cancel(params = {}, opts = {})
25
25
  request_stripe_object(
26
26
  method: :delete,
@@ -30,11 +30,11 @@ module Stripe
30
30
  )
31
31
  end
32
32
 
33
- # Cancels a customer's subscription immediately. The customer will not be charged again for the subscription.
33
+ # Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
34
34
  #
35
- # Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
35
+ # Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed.
36
36
  #
37
- # By default, upon subscription cancellation, Stripe will stop 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.
37
+ # 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.
38
38
  def self.cancel(subscription_exposed_id, params = {}, opts = {})
39
39
  request_stripe_object(
40
40
  method: :delete,
@@ -21,24 +21,24 @@ module Stripe
21
21
 
22
22
  # Download the PDF for a tax form.
23
23
  def pdf(params = {}, opts = {}, &read_body_chunk_block)
24
- config = opts[:client]&.config || Stripe.config
25
- opts = { api_base: config.uploads_base }.merge(opts)
24
+ opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
26
25
  request_stream(
27
26
  method: :get,
28
27
  path: format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(self["id"]) }),
29
28
  params: params,
30
29
  opts: opts,
30
+ base_address: :files,
31
31
  &read_body_chunk_block
32
32
  )
33
33
  end
34
34
 
35
35
  # Download the PDF for a tax form.
36
36
  def self.pdf(id, params = {}, opts = {}, &read_body_chunk_block)
37
- config = opts[:client]&.config || Stripe.config
38
- opts = { api_base: config.uploads_base }.merge(opts)
37
+ opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
39
38
  execute_resource_request_stream(
40
39
  :get,
41
40
  format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(id) }),
41
+ :files,
42
42
  params,
43
43
  opts,
44
44
  &read_body_chunk_block
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A usage record summary represents an aggregated view of how much usage was accrued for a subscription item within a subscription billing period.
5
6
  class UsageRecordSummary < StripeObject
6
7
  OBJECT_NAME = "usage_record_summary"
7
8
  def self.object_name
@@ -0,0 +1,16 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module V2
6
+ module Billing
7
+ # Fix me empty_doc_string.
8
+ class MeterEvent < APIResource
9
+ OBJECT_NAME = "billing.meter_event"
10
+ def self.object_name
11
+ "billing.meter_event"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module V2
6
+ module Billing
7
+ class MeterEventAdjustment < APIResource
8
+ OBJECT_NAME = "billing.meter_event_adjustment"
9
+ def self.object_name
10
+ "billing.meter_event_adjustment"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module V2
6
+ module Billing
7
+ class MeterEventSession < APIResource
8
+ OBJECT_NAME = "billing.meter_event_session"
9
+ def self.object_name
10
+ "billing.meter_event_session"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module V2
6
+ class Event < APIResource
7
+ OBJECT_NAME = "v2.core.event"
8
+ def self.object_name
9
+ "v2.core.event"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -13,6 +13,9 @@ require "stripe/resources/balance"
13
13
  require "stripe/resources/balance_transaction"
14
14
  require "stripe/resources/bank_account"
15
15
  require "stripe/resources/billing/alert"
16
+ require "stripe/resources/billing/credit_balance_summary"
17
+ require "stripe/resources/billing/credit_balance_transaction"
18
+ require "stripe/resources/billing/credit_grant"
16
19
  require "stripe/resources/billing/meter"
17
20
  require "stripe/resources/billing/meter_event"
18
21
  require "stripe/resources/billing/meter_event_adjustment"
@@ -146,4 +149,10 @@ require "stripe/resources/treasury/transaction"
146
149
  require "stripe/resources/treasury/transaction_entry"
147
150
  require "stripe/resources/usage_record"
148
151
  require "stripe/resources/usage_record_summary"
152
+ require "stripe/resources/v2/billing/meter_event"
153
+ require "stripe/resources/v2/billing/meter_event_adjustment"
154
+ require "stripe/resources/v2/billing/meter_event_session"
155
+ require "stripe/resources/v2/event"
149
156
  require "stripe/resources/webhook_endpoint"
157
+ require "stripe/events/v1_billing_meter_error_report_triggered_event"
158
+ require "stripe/events/v1_billing_meter_no_meter_found_event"
@@ -20,7 +20,7 @@ module Stripe
20
20
  # that there isn't a next page in order to replicate the behavior of the API
21
21
  # when it attempts to return a page beyond the last.
22
22
  def self.empty_search_result(opts = {})
23
- SearchResultObject.construct_from({ data: [] }, opts)
23
+ SearchResultObject.construct_from({ data: [] }, opts, :v1)
24
24
  end
25
25
 
26
26
  def initialize(*args)
@@ -0,0 +1,39 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountCapabilityService < StripeService
6
+ # Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first.
7
+ def list(account, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/accounts/%<account>s/capabilities", { account: CGI.escape(account) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Retrieves information about the specified Account Capability.
18
+ def retrieve(account, capability, params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: format("/v1/accounts/%<account>s/capabilities/%<capability>s", { account: CGI.escape(account), capability: CGI.escape(capability) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
29
+ def update(account, capability, params = {}, opts = {})
30
+ request(
31
+ method: :post,
32
+ path: format("/v1/accounts/%<account>s/capabilities/%<capability>s", { account: CGI.escape(account), capability: CGI.escape(capability) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,68 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountExternalAccountService < StripeService
6
+ # Create an external account for a given account.
7
+ def create(account, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/accounts/%<account>s/external_accounts", { account: CGI.escape(account) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Delete a specified external account for a given account.
18
+ def delete(account, id, params = {}, opts = {})
19
+ request(
20
+ method: :delete,
21
+ path: format("/v1/accounts/%<account>s/external_accounts/%<id>s", { account: CGI.escape(account), id: CGI.escape(id) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # List external accounts for an account.
29
+ def list(account, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/accounts/%<account>s/external_accounts", { account: CGI.escape(account) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Retrieve a specified external account for a given account.
40
+ def retrieve(account, id, params = {}, opts = {})
41
+ request(
42
+ method: :get,
43
+ path: format("/v1/accounts/%<account>s/external_accounts/%<id>s", { account: CGI.escape(account), id: CGI.escape(id) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+
50
+ # Updates the metadata, account holder name, account holder type of a bank account belonging to
51
+ # a connected account and optionally sets it as the default for its currency. Other bank account
52
+ # details are not editable by design.
53
+ #
54
+ # You can only update bank accounts when [account.controller.requirement_collection is application, which includes <a href="/connect/custom-accounts">Custom accounts](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection).
55
+ #
56
+ # You can re-enable a disabled bank account by performing an update call without providing any
57
+ # arguments or changes.
58
+ def update(account, id, params = {}, opts = {})
59
+ request(
60
+ method: :post,
61
+ path: format("/v1/accounts/%<account>s/external_accounts/%<id>s", { account: CGI.escape(account), id: CGI.escape(id) }),
62
+ params: params,
63
+ opts: opts,
64
+ base_address: :api
65
+ )
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountLinkService < StripeService
6
+ # Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/account_links",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountLoginLinkService < StripeService
6
+ # Creates a single-use login link for a connected account to access the Express Dashboard.
7
+ #
8
+ # You can only create login links for accounts that use the [Express Dashboard](https://stripe.com/connect/express-dashboard) and are connected to your platform.
9
+ def create(account, params = {}, opts = {})
10
+ request(
11
+ method: :post,
12
+ path: format("/v1/accounts/%<account>s/login_links", { account: CGI.escape(account) }),
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,39 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountNoticeService < StripeService
6
+ # Retrieves a list of AccountNotice objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
7
+ def list(params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: "/v1/account_notices",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Retrieves an AccountNotice object.
18
+ def retrieve(account_notice, params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: format("/v1/account_notices/%<account_notice>s", { account_notice: CGI.escape(account_notice) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Updates an AccountNotice object.
29
+ def update(account_notice, params = {}, opts = {})
30
+ request(
31
+ method: :post,
32
+ path: format("/v1/account_notices/%<account_notice>s", { account_notice: CGI.escape(account_notice) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,61 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountPersonService < StripeService
6
+ # Creates a new person.
7
+ def create(account, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
18
+ def delete(account, person, params = {}, opts = {})
19
+ request(
20
+ method: :delete,
21
+ path: format("/v1/accounts/%<account>s/persons/%<person>s", { account: CGI.escape(account), person: CGI.escape(person) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
29
+ def list(account, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Retrieves an existing person.
40
+ def retrieve(account, person, params = {}, opts = {})
41
+ request(
42
+ method: :get,
43
+ path: format("/v1/accounts/%<account>s/persons/%<person>s", { account: CGI.escape(account), person: CGI.escape(person) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+
50
+ # Updates an existing person.
51
+ def update(account, person, params = {}, opts = {})
52
+ request(
53
+ method: :post,
54
+ path: format("/v1/accounts/%<account>s/persons/%<person>s", { account: CGI.escape(account), person: CGI.escape(person) }),
55
+ params: params,
56
+ opts: opts,
57
+ base_address: :api
58
+ )
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,100 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountService < StripeService
6
+ attr_reader :capabilities, :external_accounts, :login_links, :persons
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @capabilities = Stripe::AccountCapabilityService.new(@requestor)
11
+ @external_accounts = Stripe::AccountExternalAccountService.new(@requestor)
12
+ @login_links = Stripe::AccountLoginLinkService.new(@requestor)
13
+ @persons = Stripe::AccountPersonService.new(@requestor)
14
+ end
15
+
16
+ # With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users.
17
+ # To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
18
+ #
19
+ # If you've already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when
20
+ # creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
21
+ # You can prefill any information on the account.
22
+ def create(params = {}, opts = {})
23
+ request(method: :post, path: "/v1/accounts", params: params, opts: opts, base_address: :api)
24
+ end
25
+
26
+ # With [Connect](https://stripe.com/connect), you can delete accounts you manage.
27
+ #
28
+ # Test-mode accounts can be deleted at any time.
29
+ #
30
+ # Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balance_object) are zero.
31
+ #
32
+ # If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
33
+ def delete(account, params = {}, opts = {})
34
+ request(
35
+ method: :delete,
36
+ path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }),
37
+ params: params,
38
+ opts: opts,
39
+ base_address: :api
40
+ )
41
+ end
42
+
43
+ # Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty.
44
+ def list(params = {}, opts = {})
45
+ request(method: :get, path: "/v1/accounts", params: params, opts: opts, base_address: :api)
46
+ end
47
+
48
+ # With [Connect](https://stripe.com/connect), you can reject accounts that you have flagged as suspicious.
49
+ #
50
+ # Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
51
+ def reject(account, params = {}, opts = {})
52
+ request(
53
+ method: :post,
54
+ path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(account) }),
55
+ params: params,
56
+ opts: opts,
57
+ base_address: :api
58
+ )
59
+ end
60
+
61
+ # Retrieves the details of an account.
62
+ def retrieve(account, params = {}, opts = {})
63
+ request(
64
+ method: :get,
65
+ path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }),
66
+ params: params,
67
+ opts: opts,
68
+ base_address: :api
69
+ )
70
+ end
71
+
72
+ # Retrieves the details of an account.
73
+ def retrieve_current(params = {}, opts = {})
74
+ request(method: :get, path: "/v1/account", params: params, opts: opts, base_address: :api)
75
+ end
76
+
77
+ # Updates a [connected account](https://stripe.com/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
78
+ # left unchanged.
79
+ #
80
+ # For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
81
+ # is application, which includes Custom accounts, you can update any information on the account.
82
+ #
83
+ # For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
84
+ # is stripe, which includes Standard and Express accounts, you can update all information until you create
85
+ # an [Account Link or <a href="/api/account_sessions">Account Session](https://stripe.com/api/account_links) to start Connect onboarding,
86
+ # after which some properties can no longer be updated.
87
+ #
88
+ # To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). Refer to our
89
+ # [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
90
+ def update(account, params = {}, opts = {})
91
+ request(
92
+ method: :post,
93
+ path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }),
94
+ params: params,
95
+ opts: opts,
96
+ base_address: :api
97
+ )
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountSessionService < StripeService
6
+ # Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/account_sessions",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,50 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class ApplePayDomainService < StripeService
6
+ # Create an apple pay domain.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/apple_pay/domains",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Delete an apple pay domain.
18
+ def delete(domain, params = {}, opts = {})
19
+ request(
20
+ method: :delete,
21
+ path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(domain) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # List apple pay domains.
29
+ def list(params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: "/v1/apple_pay/domains",
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Retrieve an apple pay domain.
40
+ def retrieve(domain, params = {}, opts = {})
41
+ request(
42
+ method: :get,
43
+ path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(domain) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,60 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class ApplicationFeeRefundService < StripeService
6
+ # Refunds an application fee that has previously been collected but not yet refunded.
7
+ # Funds will be refunded to the Stripe account from which the fee was originally collected.
8
+ #
9
+ # You can optionally refund only part of an application fee.
10
+ # You can do so multiple times, until the entire fee has been refunded.
11
+ #
12
+ # Once entirely refunded, an application fee can't be refunded again.
13
+ # This method will raise an error when called on an already-refunded application fee,
14
+ # or when trying to refund more money than is left on an application fee.
15
+ def create(id, params = {}, opts = {})
16
+ request(
17
+ method: :post,
18
+ path: format("/v1/application_fees/%<id>s/refunds", { id: CGI.escape(id) }),
19
+ params: params,
20
+ opts: opts,
21
+ base_address: :api
22
+ )
23
+ end
24
+
25
+ # You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.
26
+ def list(id, params = {}, opts = {})
27
+ request(
28
+ method: :get,
29
+ path: format("/v1/application_fees/%<id>s/refunds", { id: CGI.escape(id) }),
30
+ params: params,
31
+ opts: opts,
32
+ base_address: :api
33
+ )
34
+ end
35
+
36
+ # By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee.
37
+ def retrieve(fee, id, params = {}, opts = {})
38
+ request(
39
+ method: :get,
40
+ path: format("/v1/application_fees/%<fee>s/refunds/%<id>s", { fee: CGI.escape(fee), id: CGI.escape(id) }),
41
+ params: params,
42
+ opts: opts,
43
+ base_address: :api
44
+ )
45
+ end
46
+
47
+ # Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
48
+ #
49
+ # This request only accepts metadata as an argument.
50
+ def update(fee, id, params = {}, opts = {})
51
+ request(
52
+ method: :post,
53
+ path: format("/v1/application_fees/%<fee>s/refunds/%<id>s", { fee: CGI.escape(fee), id: CGI.escape(id) }),
54
+ params: params,
55
+ opts: opts,
56
+ base_address: :api
57
+ )
58
+ end
59
+ end
60
+ end