stripe 12.7.0.pre.beta.2 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +720 -1360
  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 -20
  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/customer.rb +2 -3
  30. data/lib/stripe/resources/file.rb +7 -5
  31. data/lib/stripe/resources/financial_connections/account.rb +0 -3
  32. data/lib/stripe/resources/invoice.rb +0 -81
  33. data/lib/stripe/resources/payment_intent.rb +0 -50
  34. data/lib/stripe/resources/quote.rb +4 -108
  35. data/lib/stripe/resources/source.rb +3 -2
  36. data/lib/stripe/resources/subscription.rb +6 -6
  37. data/lib/stripe/resources/subscription_schedule.rb +0 -20
  38. data/lib/stripe/resources/terminal/reader.rb +0 -60
  39. data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
  40. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
  41. data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
  42. data/lib/stripe/resources/v2/event.rb +13 -0
  43. data/lib/stripe/resources.rb +9 -18
  44. data/lib/stripe/search_result_object.rb +1 -1
  45. data/lib/stripe/services/account_capability_service.rb +39 -0
  46. data/lib/stripe/services/account_external_account_service.rb +68 -0
  47. data/lib/stripe/services/account_link_service.rb +17 -0
  48. data/lib/stripe/services/account_login_link_service.rb +19 -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/charge_service.rb +69 -0
  72. data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
  73. data/lib/stripe/services/checkout/session_service.rb +72 -0
  74. data/lib/stripe/services/checkout_service.rb +13 -0
  75. data/lib/stripe/services/climate/order_service.rb +68 -0
  76. data/lib/stripe/services/climate/product_service.rb +30 -0
  77. data/lib/stripe/services/climate/supplier_service.rb +30 -0
  78. data/lib/stripe/services/climate_service.rb +15 -0
  79. data/lib/stripe/services/confirmation_token_service.rb +17 -0
  80. data/lib/stripe/services/country_spec_service.rb +28 -0
  81. data/lib/stripe/services/coupon_service.rb +51 -0
  82. data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
  83. data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
  84. data/lib/stripe/services/credit_note_service.rb +93 -0
  85. data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
  86. data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
  87. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
  88. data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
  89. data/lib/stripe/services/customer_payment_method_service.rb +28 -0
  90. data/lib/stripe/services/customer_payment_source_service.rb +76 -0
  91. data/lib/stripe/services/customer_service.rb +89 -0
  92. data/lib/stripe/services/customer_session_service.rb +17 -0
  93. data/lib/stripe/services/customer_tax_id_service.rb +50 -0
  94. data/lib/stripe/services/dispute_service.rb +48 -0
  95. data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
  96. data/lib/stripe/services/entitlements/feature_service.rb +52 -0
  97. data/lib/stripe/services/entitlements_service.rb +14 -0
  98. data/lib/stripe/services/ephemeral_key_service.rb +28 -0
  99. data/lib/stripe/services/event_service.rb +22 -0
  100. data/lib/stripe/services/exchange_rate_service.rb +28 -0
  101. data/lib/stripe/services/file_link_service.rb +38 -0
  102. data/lib/stripe/services/file_service.rb +35 -0
  103. data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
  104. data/lib/stripe/services/financial_connections/account_service.rb +81 -0
  105. data/lib/stripe/services/financial_connections/session_service.rb +30 -0
  106. data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
  107. data/lib/stripe/services/financial_connections_service.rb +15 -0
  108. data/lib/stripe/services/forwarding/request_service.rb +41 -0
  109. data/lib/stripe/services/forwarding_service.rb +13 -0
  110. data/lib/stripe/services/identity/verification_report_service.rb +30 -0
  111. data/lib/stripe/services/identity/verification_session_service.rb +106 -0
  112. data/lib/stripe/services/identity_service.rb +14 -0
  113. data/lib/stripe/services/invoice_item_service.rb +61 -0
  114. data/lib/stripe/services/invoice_line_item_service.rb +31 -0
  115. data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
  116. data/lib/stripe/services/invoice_service.rb +202 -0
  117. data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
  118. data/lib/stripe/services/issuing/authorization_service.rb +65 -0
  119. data/lib/stripe/services/issuing/card_service.rb +52 -0
  120. data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
  121. data/lib/stripe/services/issuing/dispute_service.rb +63 -0
  122. data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
  123. data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
  124. data/lib/stripe/services/issuing/token_service.rb +41 -0
  125. data/lib/stripe/services/issuing/transaction_service.rb +41 -0
  126. data/lib/stripe/services/issuing_service.rb +20 -0
  127. data/lib/stripe/services/mandate_service.rb +17 -0
  128. data/lib/stripe/services/oauth_service.rb +63 -0
  129. data/lib/stripe/services/payment_intent_service.rb +204 -0
  130. data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
  131. data/lib/stripe/services/payment_link_service.rb +57 -0
  132. data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
  133. data/lib/stripe/services/payment_method_domain_service.rb +66 -0
  134. data/lib/stripe/services/payment_method_service.rb +86 -0
  135. data/lib/stripe/services/payout_service.rb +66 -0
  136. data/lib/stripe/services/plan_service.rb +49 -0
  137. data/lib/stripe/services/price_service.rb +52 -0
  138. data/lib/stripe/services/product_feature_service.rb +50 -0
  139. data/lib/stripe/services/product_service.rb +70 -0
  140. data/lib/stripe/services/promotion_code_service.rb +50 -0
  141. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
  142. data/lib/stripe/services/quote_line_item_service.rb +17 -0
  143. data/lib/stripe/services/quote_service.rb +92 -0
  144. data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
  145. data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
  146. data/lib/stripe/services/radar/value_list_service.rb +63 -0
  147. data/lib/stripe/services/radar_service.rb +15 -0
  148. data/lib/stripe/services/refund_service.rb +63 -0
  149. data/lib/stripe/services/reporting/report_run_service.rb +41 -0
  150. data/lib/stripe/services/reporting/report_type_service.rb +30 -0
  151. data/lib/stripe/services/reporting_service.rb +14 -0
  152. data/lib/stripe/services/review_service.rb +33 -0
  153. data/lib/stripe/services/setup_attempt_service.rb +17 -0
  154. data/lib/stripe/services/setup_intent_service.rb +105 -0
  155. data/lib/stripe/services/shipping_rate_service.rb +50 -0
  156. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
  157. data/lib/stripe/services/sigma_service.rb +13 -0
  158. data/lib/stripe/services/source_service.rb +64 -0
  159. data/lib/stripe/services/source_transaction_service.rb +17 -0
  160. data/lib/stripe/services/subscription_item_service.rb +69 -0
  161. data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
  162. data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
  163. data/lib/stripe/services/subscription_schedule_service.rb +72 -0
  164. data/lib/stripe/services/subscription_service.rb +127 -0
  165. data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
  166. data/lib/stripe/services/tax/calculation_service.rb +37 -0
  167. data/lib/stripe/services/tax/registration_service.rb +54 -0
  168. data/lib/stripe/services/tax/settings_service.rb +30 -0
  169. data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
  170. data/lib/stripe/services/tax/transaction_service.rb +48 -0
  171. data/lib/stripe/services/tax_code_service.rb +22 -0
  172. data/lib/stripe/services/tax_id_service.rb +38 -0
  173. data/lib/stripe/services/tax_rate_service.rb +38 -0
  174. data/lib/stripe/services/tax_service.rb +16 -0
  175. data/lib/stripe/services/terminal/configuration_service.rb +63 -0
  176. data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
  177. data/lib/stripe/services/terminal/location_service.rb +64 -0
  178. data/lib/stripe/services/terminal/reader_service.rb +118 -0
  179. data/lib/stripe/services/terminal_service.rb +16 -0
  180. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
  181. data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
  182. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +76 -0
  183. data/lib/stripe/services/test_helpers/issuing/card_service.rb +54 -0
  184. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
  185. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
  186. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  187. data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
  188. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
  189. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  190. data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
  191. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
  192. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
  193. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
  194. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
  195. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
  196. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  197. data/lib/stripe/services/test_helpers_service.rb +19 -0
  198. data/lib/stripe/services/token_service.rb +23 -0
  199. data/lib/stripe/services/topup_service.rb +49 -0
  200. data/lib/stripe/services/transfer_reversal_service.rb +56 -0
  201. data/lib/stripe/services/transfer_service.rb +47 -0
  202. data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
  203. data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
  204. data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
  205. data/lib/stripe/services/treasury/financial_account_service.rb +59 -0
  206. data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
  207. data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
  208. data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
  209. data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
  210. data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
  211. data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
  212. data/lib/stripe/services/treasury/transaction_service.rb +30 -0
  213. data/lib/stripe/services/treasury_service.rb +22 -0
  214. data/lib/stripe/services/v1_services.rb +89 -0
  215. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
  216. data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
  217. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
  218. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
  219. data/lib/stripe/services/v2/billing_service.rb +18 -0
  220. data/lib/stripe/services/v2/core/event_service.rb +32 -0
  221. data/lib/stripe/services/v2/core_service.rb +15 -0
  222. data/lib/stripe/services/v2_services.rb +14 -0
  223. data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
  224. data/lib/stripe/services.rb +181 -0
  225. data/lib/stripe/singleton_api_resource.rb +1 -18
  226. data/lib/stripe/stripe_client.rb +51 -1067
  227. data/lib/stripe/stripe_configuration.rb +32 -20
  228. data/lib/stripe/stripe_object.rb +37 -18
  229. data/lib/stripe/stripe_service.rb +32 -0
  230. data/lib/stripe/thin_event.rb +17 -0
  231. data/lib/stripe/util.rb +69 -46
  232. data/lib/stripe/v2_list_object.rb +84 -0
  233. data/lib/stripe/version.rb +1 -1
  234. data/lib/stripe/webhook.rb +1 -1
  235. data/lib/stripe.rb +15 -54
  236. metadata +203 -23
  237. data/lib/stripe/request_signing_authenticator.rb +0 -79
  238. data/lib/stripe/resources/account_notice.rb +0 -32
  239. data/lib/stripe/resources/capital/financing_offer.rb +0 -49
  240. data/lib/stripe/resources/capital/financing_summary.rb +0 -15
  241. data/lib/stripe/resources/capital/financing_transaction.rb +0 -27
  242. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +0 -14
  243. data/lib/stripe/resources/financial_connections/institution.rb +0 -26
  244. data/lib/stripe/resources/gift_cards/card.rb +0 -59
  245. data/lib/stripe/resources/gift_cards/transaction.rb +0 -93
  246. data/lib/stripe/resources/invoice_payment.rb +0 -12
  247. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +0 -88
  248. data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +0 -26
  249. data/lib/stripe/resources/margin.rb +0 -37
  250. data/lib/stripe/resources/order.rb +0 -120
  251. data/lib/stripe/resources/quote_preview_invoice.rb +0 -43
  252. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +0 -11
  253. data/lib/stripe/resources/tax/association.rb +0 -24
  254. data/lib/stripe/resources/tax/form.rb +0 -49
  255. data/lib/stripe/resources/terminal/reader_collected_data.rb +0 -14
@@ -0,0 +1,86 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PaymentMethodService < StripeService
6
+ # Attaches a PaymentMethod object to a Customer.
7
+ #
8
+ # To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents)
9
+ # or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage).
10
+ # These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
11
+ # endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for
12
+ # future use, which makes later declines and payment friction more likely.
13
+ # See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up
14
+ # future payments.
15
+ #
16
+ # To use this PaymentMethod as the default for invoice or subscription payments,
17
+ # set [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method),
18
+ # on the Customer to the PaymentMethod's ID.
19
+ def attach(payment_method, params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Creates a PaymentMethod object. Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js.
30
+ #
31
+ # Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents API to accept a payment immediately or the <a href="/docs/payments/save-and-reuse">SetupIntent](https://stripe.com/docs/payments/accept-a-payment) API to collect payment method details ahead of a future payment.
32
+ def create(params = {}, opts = {})
33
+ request(
34
+ method: :post,
35
+ path: "/v1/payment_methods",
36
+ params: params,
37
+ opts: opts,
38
+ base_address: :api
39
+ )
40
+ end
41
+
42
+ # Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
43
+ def detach(payment_method, params = {}, opts = {})
44
+ request(
45
+ method: :post,
46
+ path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(payment_method) }),
47
+ params: params,
48
+ opts: opts,
49
+ base_address: :api
50
+ )
51
+ end
52
+
53
+ # Returns a list of PaymentMethods for Treasury flows. If you want to list the PaymentMethods attached to a Customer for payments, you should use the [List a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list) API instead.
54
+ def list(params = {}, opts = {})
55
+ request(
56
+ method: :get,
57
+ path: "/v1/payment_methods",
58
+ params: params,
59
+ opts: opts,
60
+ base_address: :api
61
+ )
62
+ end
63
+
64
+ # Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use [Retrieve a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer)
65
+ def retrieve(payment_method, params = {}, opts = {})
66
+ request(
67
+ method: :get,
68
+ path: format("/v1/payment_methods/%<payment_method>s", { payment_method: CGI.escape(payment_method) }),
69
+ params: params,
70
+ opts: opts,
71
+ base_address: :api
72
+ )
73
+ end
74
+
75
+ # Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.
76
+ def update(payment_method, params = {}, opts = {})
77
+ request(
78
+ method: :post,
79
+ path: format("/v1/payment_methods/%<payment_method>s", { payment_method: CGI.escape(payment_method) }),
80
+ params: params,
81
+ opts: opts,
82
+ base_address: :api
83
+ )
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,66 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PayoutService < StripeService
6
+ # You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts.
7
+ def cancel(payout, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # To send funds to your own bank account, create a new payout object. Your [Stripe balance](https://stripe.com/docs/api#balance) must cover the payout amount. If it doesn't, you receive an “Insufficient Funds” error.
18
+ #
19
+ # If your API key is in test mode, money won't actually be sent, though every other action occurs as if you're in live mode.
20
+ #
21
+ # If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. The [balance object](https://stripe.com/docs/api#balance_object) details available and pending amounts by source type.
22
+ def create(params = {}, opts = {})
23
+ request(method: :post, path: "/v1/payouts", params: params, opts: opts, base_address: :api)
24
+ end
25
+
26
+ # Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. The payouts return in sorted order, with the most recently created payouts appearing first.
27
+ def list(params = {}, opts = {})
28
+ request(method: :get, path: "/v1/payouts", params: params, opts: opts, base_address: :api)
29
+ end
30
+
31
+ # Retrieves the details of an existing payout. Supply the unique payout ID from either a payout creation request or the payout list. Stripe returns the corresponding payout information.
32
+ def retrieve(payout, params = {}, opts = {})
33
+ request(
34
+ method: :get,
35
+ path: format("/v1/payouts/%<payout>s", { payout: CGI.escape(payout) }),
36
+ params: params,
37
+ opts: opts,
38
+ base_address: :api
39
+ )
40
+ end
41
+
42
+ # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
43
+ #
44
+ # By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
45
+ def reverse(payout, params = {}, opts = {})
46
+ request(
47
+ method: :post,
48
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
49
+ params: params,
50
+ opts: opts,
51
+ base_address: :api
52
+ )
53
+ end
54
+
55
+ # Updates the specified payout by setting the values of the parameters you pass. We don't change parameters that you don't provide. This request only accepts the metadata as arguments.
56
+ def update(payout, params = {}, opts = {})
57
+ request(
58
+ method: :post,
59
+ path: format("/v1/payouts/%<payout>s", { payout: CGI.escape(payout) }),
60
+ params: params,
61
+ opts: opts,
62
+ base_address: :api
63
+ )
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,49 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PlanService < StripeService
6
+ # You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.
7
+ def create(params = {}, opts = {})
8
+ request(method: :post, path: "/v1/plans", params: params, opts: opts, base_address: :api)
9
+ end
10
+
11
+ # Deleting plans means new subscribers can't be added. Existing subscribers aren't affected.
12
+ def delete(plan, params = {}, opts = {})
13
+ request(
14
+ method: :delete,
15
+ path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
16
+ params: params,
17
+ opts: opts,
18
+ base_address: :api
19
+ )
20
+ end
21
+
22
+ # Returns a list of your plans.
23
+ def list(params = {}, opts = {})
24
+ request(method: :get, path: "/v1/plans", params: params, opts: opts, base_address: :api)
25
+ end
26
+
27
+ # Retrieves the plan with the given ID.
28
+ def retrieve(plan, params = {}, opts = {})
29
+ request(
30
+ method: :get,
31
+ path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
32
+ params: params,
33
+ opts: opts,
34
+ base_address: :api
35
+ )
36
+ end
37
+
38
+ # Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan's ID, amount, currency, or billing cycle.
39
+ def update(plan, params = {}, opts = {})
40
+ request(
41
+ method: :post,
42
+ path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
43
+ params: params,
44
+ opts: opts,
45
+ base_address: :api
46
+ )
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,52 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PriceService < StripeService
6
+ # Creates a new price for an existing product. The price can be recurring or one-time.
7
+ def create(params = {}, opts = {})
8
+ request(method: :post, path: "/v1/prices", params: params, opts: opts, base_address: :api)
9
+ end
10
+
11
+ # Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing). For the list of inactive prices, set active to false.
12
+ def list(params = {}, opts = {})
13
+ request(method: :get, path: "/v1/prices", params: params, opts: opts, base_address: :api)
14
+ end
15
+
16
+ # Retrieves the price with the given ID.
17
+ def retrieve(price, params = {}, opts = {})
18
+ request(
19
+ method: :get,
20
+ path: format("/v1/prices/%<price>s", { price: CGI.escape(price) }),
21
+ params: params,
22
+ opts: opts,
23
+ base_address: :api
24
+ )
25
+ end
26
+
27
+ # Search for prices you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
28
+ # Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
29
+ # conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
30
+ # to an hour behind during outages. Search functionality is not available to merchants in India.
31
+ def search(params = {}, opts = {})
32
+ request(
33
+ method: :get,
34
+ path: "/v1/prices/search",
35
+ params: params,
36
+ opts: opts,
37
+ base_address: :api
38
+ )
39
+ end
40
+
41
+ # Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
42
+ def update(price, params = {}, opts = {})
43
+ request(
44
+ method: :post,
45
+ path: format("/v1/prices/%<price>s", { price: CGI.escape(price) }),
46
+ params: params,
47
+ opts: opts,
48
+ base_address: :api
49
+ )
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,50 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class ProductFeatureService < StripeService
6
+ # Creates a product_feature, which represents a feature attachment to a product
7
+ def create(product, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/products/%<product>s/features", { product: CGI.escape(product) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Deletes the feature attachment to a product
18
+ def delete(product, id, params = {}, opts = {})
19
+ request(
20
+ method: :delete,
21
+ path: format("/v1/products/%<product>s/features/%<id>s", { product: CGI.escape(product), id: CGI.escape(id) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Retrieve a list of features for a product
29
+ def list(product, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/products/%<product>s/features", { product: CGI.escape(product) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Retrieves a product_feature, which represents a feature attachment to a product
40
+ def retrieve(product, id, params = {}, opts = {})
41
+ request(
42
+ method: :get,
43
+ path: format("/v1/products/%<product>s/features/%<id>s", { product: CGI.escape(product), id: CGI.escape(id) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,70 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class ProductService < StripeService
6
+ attr_reader :features
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @features = Stripe::ProductFeatureService.new(@requestor)
11
+ end
12
+
13
+ # Creates a new product object.
14
+ def create(params = {}, opts = {})
15
+ request(method: :post, path: "/v1/products", params: params, opts: opts, base_address: :api)
16
+ end
17
+
18
+ # Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
19
+ def delete(id, params = {}, opts = {})
20
+ request(
21
+ method: :delete,
22
+ path: format("/v1/products/%<id>s", { id: CGI.escape(id) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
30
+ def list(params = {}, opts = {})
31
+ request(method: :get, path: "/v1/products", params: params, opts: opts, base_address: :api)
32
+ end
33
+
34
+ # Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
35
+ def retrieve(id, params = {}, opts = {})
36
+ request(
37
+ method: :get,
38
+ path: format("/v1/products/%<id>s", { id: CGI.escape(id) }),
39
+ params: params,
40
+ opts: opts,
41
+ base_address: :api
42
+ )
43
+ end
44
+
45
+ # Search for products you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
46
+ # Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
47
+ # conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
48
+ # to an hour behind during outages. Search functionality is not available to merchants in India.
49
+ def search(params = {}, opts = {})
50
+ request(
51
+ method: :get,
52
+ path: "/v1/products/search",
53
+ params: params,
54
+ opts: opts,
55
+ base_address: :api
56
+ )
57
+ end
58
+
59
+ # Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
60
+ def update(id, params = {}, opts = {})
61
+ request(
62
+ method: :post,
63
+ path: format("/v1/products/%<id>s", { id: CGI.escape(id) }),
64
+ params: params,
65
+ opts: opts,
66
+ base_address: :api
67
+ )
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,50 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class PromotionCodeService < StripeService
6
+ # A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/promotion_codes",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Returns a list of your promotion codes.
18
+ def list(params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: "/v1/promotion_codes",
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing code use [list](https://stripe.com/docs/api/promotion_codes/list) with the desired code.
29
+ def retrieve(promotion_code, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/promotion_codes/%<promotion_code>s", { promotion_code: CGI.escape(promotion_code) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.
40
+ def update(promotion_code, params = {}, opts = {})
41
+ request(
42
+ method: :post,
43
+ path: format("/v1/promotion_codes/%<promotion_code>s", { promotion_code: CGI.escape(promotion_code) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class QuoteComputedUpfrontLineItemsService < StripeService
6
+ # When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
7
+ def list(quote, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class QuoteLineItemService < StripeService
6
+ # When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
7
+ def list(quote, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,92 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class QuoteService < StripeService
6
+ attr_reader :line_items, :computed_upfront_line_items
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @line_items = Stripe::QuoteLineItemService.new(@requestor)
11
+ @computed_upfront_line_items = Stripe::QuoteComputedUpfrontLineItemsService.new(@requestor)
12
+ end
13
+
14
+ # Accepts the specified quote.
15
+ def accept(quote, params = {}, opts = {})
16
+ request(
17
+ method: :post,
18
+ path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
19
+ params: params,
20
+ opts: opts,
21
+ base_address: :api
22
+ )
23
+ end
24
+
25
+ # Cancels the quote.
26
+ def cancel(quote, params = {}, opts = {})
27
+ request(
28
+ method: :post,
29
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
30
+ params: params,
31
+ opts: opts,
32
+ base_address: :api
33
+ )
34
+ end
35
+
36
+ # A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
37
+ def create(params = {}, opts = {})
38
+ request(method: :post, path: "/v1/quotes", params: params, opts: opts, base_address: :api)
39
+ end
40
+
41
+ # Finalizes the quote.
42
+ def finalize_quote(quote, params = {}, opts = {})
43
+ request(
44
+ method: :post,
45
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
46
+ params: params,
47
+ opts: opts,
48
+ base_address: :api
49
+ )
50
+ end
51
+
52
+ # Returns a list of your quotes.
53
+ def list(params = {}, opts = {})
54
+ request(method: :get, path: "/v1/quotes", params: params, opts: opts, base_address: :api)
55
+ end
56
+
57
+ # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
58
+ def pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
59
+ opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
60
+ request_stream(
61
+ method: :get,
62
+ path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(quote) }),
63
+ params: params,
64
+ opts: opts,
65
+ base_address: :files,
66
+ &read_body_chunk_block
67
+ )
68
+ end
69
+
70
+ # Retrieves the quote with the given ID.
71
+ def retrieve(quote, params = {}, opts = {})
72
+ request(
73
+ method: :get,
74
+ path: format("/v1/quotes/%<quote>s", { quote: CGI.escape(quote) }),
75
+ params: params,
76
+ opts: opts,
77
+ base_address: :api
78
+ )
79
+ end
80
+
81
+ # A quote models prices and services for a customer.
82
+ def update(quote, params = {}, opts = {})
83
+ request(
84
+ method: :post,
85
+ path: format("/v1/quotes/%<quote>s", { quote: CGI.escape(quote) }),
86
+ params: params,
87
+ opts: opts,
88
+ base_address: :api
89
+ )
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,32 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Radar
6
+ class EarlyFraudWarningService < StripeService
7
+ # Returns a list of early fraud warnings.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/radar/early_fraud_warnings",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves the details of an early fraud warning that has previously been created.
19
+ #
20
+ # Please refer to the [early fraud warning](https://stripe.com/docs/api#early_fraud_warning_object) object reference for more details.
21
+ def retrieve(early_fraud_warning, params = {}, opts = {})
22
+ request(
23
+ method: :get,
24
+ path: format("/v1/radar/early_fraud_warnings/%<early_fraud_warning>s", { early_fraud_warning: CGI.escape(early_fraud_warning) }),
25
+ params: params,
26
+ opts: opts,
27
+ base_address: :api
28
+ )
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,52 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Radar
6
+ class ValueListItemService < StripeService
7
+ # Creates a new ValueListItem object, which is added to the specified parent value list.
8
+ def create(params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: "/v1/radar/value_list_items",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Deletes a ValueListItem object, removing it from its parent value list.
19
+ def delete(item, params = {}, opts = {})
20
+ request(
21
+ method: :delete,
22
+ path: format("/v1/radar/value_list_items/%<item>s", { item: CGI.escape(item) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
30
+ def list(params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: "/v1/radar/value_list_items",
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Retrieves a ValueListItem object.
41
+ def retrieve(item, params = {}, opts = {})
42
+ request(
43
+ method: :get,
44
+ path: format("/v1/radar/value_list_items/%<item>s", { item: CGI.escape(item) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end