stripe 13.2.0 → 13.3.0.pre.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1396 -645
  3. data/OPENAPI_VERSION +1 -1
  4. data/VERSION +1 -1
  5. data/lib/stripe/object_types.rb +32 -0
  6. data/lib/stripe/request_signing_authenticator.rb +79 -0
  7. data/lib/stripe/resources/account.rb +230 -0
  8. data/lib/stripe/resources/account_link.rb +9 -0
  9. data/lib/stripe/resources/account_notice.rb +60 -0
  10. data/lib/stripe/resources/account_session.rb +103 -0
  11. data/lib/stripe/resources/apple_pay_domain.rb +13 -0
  12. data/lib/stripe/resources/application.rb +20 -0
  13. data/lib/stripe/resources/application_fee.rb +34 -0
  14. data/lib/stripe/resources/application_fee_refund.rb +17 -0
  15. data/lib/stripe/resources/apps/secret.rb +22 -0
  16. data/lib/stripe/resources/balance.rb +59 -0
  17. data/lib/stripe/resources/balance_transaction.rb +34 -0
  18. data/lib/stripe/resources/bank_account.rb +60 -2
  19. data/lib/stripe/resources/billing/alert.rb +21 -0
  20. data/lib/stripe/resources/billing/alert_triggered.rb +26 -0
  21. data/lib/stripe/resources/billing/credit_balance_summary.rb +25 -0
  22. data/lib/stripe/resources/billing/credit_balance_transaction.rb +45 -1
  23. data/lib/stripe/resources/billing/credit_grant.rb +46 -2
  24. data/lib/stripe/resources/billing/meter.rb +49 -7
  25. data/lib/stripe/resources/billing/meter_error_report.rb +44 -0
  26. data/lib/stripe/resources/billing/meter_event.rb +17 -3
  27. data/lib/stripe/resources/billing/meter_event_adjustment.rb +17 -1
  28. data/lib/stripe/resources/billing/meter_event_summary.rb +15 -0
  29. data/lib/stripe/resources/billing_portal/configuration.rb +70 -0
  30. data/lib/stripe/resources/billing_portal/session.rb +61 -0
  31. data/lib/stripe/resources/capability.rb +38 -0
  32. data/lib/stripe/resources/capital/financing_offer.rb +94 -0
  33. data/lib/stripe/resources/capital/financing_summary.rb +32 -0
  34. data/lib/stripe/resources/capital/financing_transaction.rb +56 -0
  35. data/lib/stripe/resources/card.rb +72 -0
  36. data/lib/stripe/resources/cash_balance.rb +14 -0
  37. data/lib/stripe/resources/charge.rb +469 -0
  38. data/lib/stripe/resources/checkout/session.rb +496 -0
  39. data/lib/stripe/resources/climate/order.rb +55 -0
  40. data/lib/stripe/resources/climate/product.rb +24 -0
  41. data/lib/stripe/resources/climate/supplier.rb +18 -0
  42. data/lib/stripe/resources/confirmation_token.rb +297 -0
  43. data/lib/stripe/resources/connect_collection_transfer.rb +24 -0
  44. data/lib/stripe/resources/country_spec.rb +27 -0
  45. data/lib/stripe/resources/coupon.rb +44 -0
  46. data/lib/stripe/resources/credit_note.rb +91 -0
  47. data/lib/stripe/resources/credit_note_line_item.rb +46 -0
  48. data/lib/stripe/resources/customer.rb +93 -0
  49. data/lib/stripe/resources/customer_balance_transaction.rb +27 -0
  50. data/lib/stripe/resources/customer_cash_balance_transaction.rb +72 -0
  51. data/lib/stripe/resources/customer_session.rb +34 -0
  52. data/lib/stripe/resources/discount.rb +29 -0
  53. data/lib/stripe/resources/dispute.rb +88 -0
  54. data/lib/stripe/resources/entitlements/active_entitlement.rb +11 -0
  55. data/lib/stripe/resources/entitlements/active_entitlement_summary.rb +23 -0
  56. data/lib/stripe/resources/entitlements/feature.rb +15 -0
  57. data/lib/stripe/resources/ephemeral_key.rb +13 -0
  58. data/lib/stripe/resources/event.rb +44 -0
  59. data/lib/stripe/resources/exchange_rate.rb +7 -0
  60. data/lib/stripe/resources/file.rb +23 -0
  61. data/lib/stripe/resources/file_link.rb +19 -0
  62. data/lib/stripe/resources/financial_connections/account.rb +87 -0
  63. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +27 -0
  64. data/lib/stripe/resources/financial_connections/account_owner.rb +17 -0
  65. data/lib/stripe/resources/financial_connections/account_ownership.rb +9 -0
  66. data/lib/stripe/resources/financial_connections/institution.rb +61 -0
  67. data/lib/stripe/resources/financial_connections/session.rb +49 -0
  68. data/lib/stripe/resources/financial_connections/transaction.rb +28 -0
  69. data/lib/stripe/resources/forwarding/request.rb +40 -0
  70. data/lib/stripe/resources/funding_instructions.rb +82 -0
  71. data/lib/stripe/resources/gift_cards/card.rb +96 -0
  72. data/lib/stripe/resources/gift_cards/transaction.rb +132 -0
  73. data/lib/stripe/resources/identity/verification_report.rb +92 -0
  74. data/lib/stripe/resources/identity/verification_session.rb +76 -0
  75. data/lib/stripe/resources/invoice.rb +418 -0
  76. data/lib/stripe/resources/invoice_item.rb +54 -0
  77. data/lib/stripe/resources/invoice_line_item.rb +83 -0
  78. data/lib/stripe/resources/invoice_payment.rb +46 -0
  79. data/lib/stripe/resources/invoice_rendering_template.rb +17 -0
  80. data/lib/stripe/resources/issuing/authorization.rb +129 -0
  81. data/lib/stripe/resources/issuing/card.rb +86 -0
  82. data/lib/stripe/resources/issuing/cardholder.rb +76 -0
  83. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +145 -0
  84. data/lib/stripe/resources/issuing/dispute.rb +65 -0
  85. data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +49 -0
  86. data/lib/stripe/resources/issuing/fraud_liability_debit.rb +43 -0
  87. data/lib/stripe/resources/issuing/personalization_design.rb +38 -0
  88. data/lib/stripe/resources/issuing/physical_bundle.rb +18 -0
  89. data/lib/stripe/resources/issuing/settlement.rb +49 -0
  90. data/lib/stripe/resources/issuing/token.rb +46 -0
  91. data/lib/stripe/resources/issuing/transaction.rb +106 -0
  92. data/lib/stripe/resources/line_item.rb +50 -0
  93. data/lib/stripe/resources/login_link.rb +7 -0
  94. data/lib/stripe/resources/mandate.rb +78 -0
  95. data/lib/stripe/resources/margin.rb +56 -0
  96. data/lib/stripe/resources/order.rb +322 -0
  97. data/lib/stripe/resources/payment_attempt_record.rb +100 -0
  98. data/lib/stripe/resources/payment_intent.rb +712 -0
  99. data/lib/stripe/resources/payment_link.rb +198 -0
  100. data/lib/stripe/resources/payment_method.rb +368 -0
  101. data/lib/stripe/resources/payment_method_configuration.rb +430 -0
  102. data/lib/stripe/resources/payment_method_domain.rb +57 -0
  103. data/lib/stripe/resources/payment_record.rb +194 -0
  104. data/lib/stripe/resources/payout.rb +56 -0
  105. data/lib/stripe/resources/person.rb +128 -0
  106. data/lib/stripe/resources/plan.rb +52 -0
  107. data/lib/stripe/resources/price.rb +77 -0
  108. data/lib/stripe/resources/product.rb +60 -0
  109. data/lib/stripe/resources/product_feature.rb +12 -0
  110. data/lib/stripe/resources/promotion_code.rb +35 -0
  111. data/lib/stripe/resources/quote.rb +356 -0
  112. data/lib/stripe/resources/quote_line.rb +136 -0
  113. data/lib/stripe/resources/quote_preview_invoice.rb +374 -0
  114. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +170 -0
  115. data/lib/stripe/resources/radar/early_fraud_warning.rb +17 -0
  116. data/lib/stripe/resources/radar/value_list.rb +23 -0
  117. data/lib/stripe/resources/radar/value_list_item.rb +17 -0
  118. data/lib/stripe/resources/refund.rb +130 -0
  119. data/lib/stripe/resources/reporting/report_run.rb +29 -0
  120. data/lib/stripe/resources/reporting/report_type.rb +19 -0
  121. data/lib/stripe/resources/reserve_transaction.rb +22 -0
  122. data/lib/stripe/resources/reversal.rb +21 -0
  123. data/lib/stripe/resources/review.rb +36 -0
  124. data/lib/stripe/resources/setup_attempt.rb +101 -0
  125. data/lib/stripe/resources/setup_intent.rb +158 -0
  126. data/lib/stripe/resources/shipping_rate.rb +42 -0
  127. data/lib/stripe/resources/sigma/scheduled_query_run.rb +26 -0
  128. data/lib/stripe/resources/source.rb +195 -0
  129. data/lib/stripe/resources/source_mandate_notification.rb +59 -0
  130. data/lib/stripe/resources/source_transaction.rb +48 -0
  131. data/lib/stripe/resources/subscription.rb +214 -0
  132. data/lib/stripe/resources/subscription_item.rb +46 -0
  133. data/lib/stripe/resources/subscription_schedule.rb +173 -0
  134. data/lib/stripe/resources/tax/association.rb +60 -0
  135. data/lib/stripe/resources/tax/calculation.rb +72 -0
  136. data/lib/stripe/resources/tax/calculation_line_item.rb +33 -0
  137. data/lib/stripe/resources/tax/form.rb +124 -0
  138. data/lib/stripe/resources/tax/registration.rb +379 -0
  139. data/lib/stripe/resources/tax/settings.rb +33 -0
  140. data/lib/stripe/resources/tax/transaction.rb +68 -0
  141. data/lib/stripe/resources/tax/transaction_line_item.rb +30 -0
  142. data/lib/stripe/resources/tax_code.rb +9 -0
  143. data/lib/stripe/resources/tax_deducted_at_source.rb +22 -0
  144. data/lib/stripe/resources/tax_id.rb +30 -0
  145. data/lib/stripe/resources/tax_rate.rb +42 -0
  146. data/lib/stripe/resources/terminal/configuration.rb +107 -0
  147. data/lib/stripe/resources/terminal/connection_token.rb +7 -0
  148. data/lib/stripe/resources/terminal/location.rb +20 -0
  149. data/lib/stripe/resources/terminal/reader.rb +178 -0
  150. data/lib/stripe/resources/terminal/reader_collected_data.rb +30 -0
  151. data/lib/stripe/resources/test_helpers/test_clock.rb +27 -0
  152. data/lib/stripe/resources/token.rb +29 -0
  153. data/lib/stripe/resources/topup.rb +33 -0
  154. data/lib/stripe/resources/transfer.rb +35 -0
  155. data/lib/stripe/resources/treasury/credit_reversal.rb +32 -0
  156. data/lib/stripe/resources/treasury/debit_reversal.rb +38 -0
  157. data/lib/stripe/resources/treasury/financial_account.rb +57 -0
  158. data/lib/stripe/resources/treasury/financial_account_features.rb +91 -0
  159. data/lib/stripe/resources/treasury/inbound_transfer.rb +66 -0
  160. data/lib/stripe/resources/treasury/outbound_payment.rb +85 -0
  161. data/lib/stripe/resources/treasury/outbound_transfer.rb +82 -0
  162. data/lib/stripe/resources/treasury/received_credit.rb +70 -0
  163. data/lib/stripe/resources/treasury/received_debit.rb +67 -0
  164. data/lib/stripe/resources/treasury/transaction.rb +42 -0
  165. data/lib/stripe/resources/treasury/transaction_entry.rb +34 -0
  166. data/lib/stripe/resources/usage_record.rb +13 -0
  167. data/lib/stripe/resources/usage_record_summary.rb +18 -0
  168. data/lib/stripe/resources/v2/amount.rb +9 -0
  169. data/lib/stripe/resources/v2/billing/meter_event.rb +18 -0
  170. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +20 -0
  171. data/lib/stripe/resources/v2/billing/meter_event_session.rb +14 -0
  172. data/lib/stripe/resources/v2/event.rb +21 -0
  173. data/lib/stripe/resources/v2/event_destination.rb +49 -0
  174. data/lib/stripe/resources/webhook_endpoint.rb +27 -0
  175. data/lib/stripe/resources.rb +31 -0
  176. data/lib/stripe/services/account_notice_service.rb +39 -0
  177. data/lib/stripe/services/billing/credit_balance_summary_service.rb +1 -1
  178. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +2 -2
  179. data/lib/stripe/services/billing/credit_grant_service.rb +3 -3
  180. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +1 -1
  181. data/lib/stripe/services/billing/meter_event_service.rb +1 -1
  182. data/lib/stripe/services/billing/meter_service.rb +5 -5
  183. data/lib/stripe/services/capital/financing_offer_service.rb +42 -0
  184. data/lib/stripe/services/capital/financing_summary_service.rb +19 -0
  185. data/lib/stripe/services/capital/financing_transaction_service.rb +31 -0
  186. data/lib/stripe/services/capital_service.rb +15 -0
  187. data/lib/stripe/services/financial_connections/account_inferred_balance_service.rb +19 -0
  188. data/lib/stripe/services/financial_connections/account_service.rb +3 -1
  189. data/lib/stripe/services/financial_connections/institution_service.rb +30 -0
  190. data/lib/stripe/services/financial_connections_service.rb +2 -1
  191. data/lib/stripe/services/gift_cards/card_service.rb +63 -0
  192. data/lib/stripe/services/gift_cards/transaction_service.rb +74 -0
  193. data/lib/stripe/services/gift_cards_service.rb +14 -0
  194. data/lib/stripe/services/invoice_payment_service.rb +28 -0
  195. data/lib/stripe/services/invoice_service.rb +44 -1
  196. data/lib/stripe/services/issuing/credit_underwriting_record_service.rb +74 -0
  197. data/lib/stripe/services/issuing/dispute_settlement_detail_service.rb +30 -0
  198. data/lib/stripe/services/issuing/fraud_liability_debit_service.rb +30 -0
  199. data/lib/stripe/services/issuing_service.rb +5 -1
  200. data/lib/stripe/services/margin_service.rb +50 -0
  201. data/lib/stripe/services/order_line_item_service.rb +17 -0
  202. data/lib/stripe/services/order_service.rb +78 -0
  203. data/lib/stripe/services/payment_attempt_record_service.rb +28 -0
  204. data/lib/stripe/services/payment_intent_service.rb +37 -0
  205. data/lib/stripe/services/payment_record_service.rb +78 -0
  206. data/lib/stripe/services/quote_line_service.rb +17 -0
  207. data/lib/stripe/services/quote_preview_invoice_service.rb +17 -0
  208. data/lib/stripe/services/quote_preview_subscription_schedule_service.rb +17 -0
  209. data/lib/stripe/services/quote_service.rb +49 -1
  210. data/lib/stripe/services/subscription_schedule_service.rb +11 -0
  211. data/lib/stripe/services/tax/association_service.rb +19 -0
  212. data/lib/stripe/services/tax/form_service.rb +37 -0
  213. data/lib/stripe/services/tax_service.rb +3 -1
  214. data/lib/stripe/services/terminal/reader_collected_data_service.rb +19 -0
  215. data/lib/stripe/services/terminal/reader_service.rb +33 -0
  216. data/lib/stripe/services/terminal_service.rb +2 -1
  217. data/lib/stripe/services/v1_services.rb +8 -1
  218. data/lib/stripe/services.rb +25 -0
  219. data/lib/stripe/stripe_configuration.rb +3 -1
  220. data/lib/stripe/stripe_object.rb +5 -0
  221. data/lib/stripe/util.rb +7 -1
  222. data/lib/stripe/version.rb +1 -1
  223. data/lib/stripe.rb +45 -0
  224. data/stripe.gemspec +2 -1
  225. metadata +62 -4
@@ -0,0 +1,20 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class Application < APIResource
6
+ OBJECT_NAME = "application"
7
+ def self.object_name
8
+ "application"
9
+ end
10
+
11
+ # Unique identifier for the object.
12
+ attr_reader :id
13
+ # The name of the application.
14
+ attr_reader :name
15
+ # String representing the object's type. Objects of the same type share the same value.
16
+ attr_reader :object
17
+ # Always true for a deleted object
18
+ attr_reader :deleted
19
+ end
20
+ end
@@ -13,6 +13,40 @@ module Stripe
13
13
 
14
14
  nested_resource_class_methods :refund, operations: %i[create retrieve update list]
15
15
 
16
+ class FeeSource < Stripe::StripeObject
17
+ attr_reader :charge, :payout, :type
18
+ end
19
+ # ID of the Stripe account this fee was taken from.
20
+ attr_reader :account
21
+ # Amount earned, in cents (or local equivalent).
22
+ attr_reader :amount
23
+ # Amount in cents (or local equivalent) refunded (can be less than the amount attribute on the fee if a partial refund was issued)
24
+ attr_reader :amount_refunded
25
+ # ID of the Connect application that earned the fee.
26
+ attr_reader :application
27
+ # Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
28
+ attr_reader :balance_transaction
29
+ # ID of the charge that the application fee was taken from.
30
+ attr_reader :charge
31
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
32
+ attr_reader :created
33
+ # 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).
34
+ attr_reader :currency
35
+ # Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
36
+ attr_reader :fee_source
37
+ # Unique identifier for the object.
38
+ attr_reader :id
39
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
40
+ attr_reader :livemode
41
+ # String representing the object's type. Objects of the same type share the same value.
42
+ attr_reader :object
43
+ # ID of the corresponding charge on the platform account, if this fee was the result of a charge using the `destination` parameter.
44
+ attr_reader :originating_transaction
45
+ # Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false.
46
+ attr_reader :refunded
47
+ # A list of refunds that have been applied to the fee.
48
+ attr_reader :refunds
49
+
16
50
  # Returns a list of application fees you've previously collected. The application fees are returned in sorted order, with the most recent fees appearing first.
17
51
  def self.list(filters = {}, opts = {})
18
52
  request_stripe_object(method: :get, path: "/v1/application_fees", params: filters, opts: opts)
@@ -15,6 +15,23 @@ module Stripe
15
15
  "fee_refund"
16
16
  end
17
17
 
18
+ # Amount, in cents (or local equivalent).
19
+ attr_reader :amount
20
+ # Balance transaction that describes the impact on your account balance.
21
+ attr_reader :balance_transaction
22
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
23
+ attr_reader :created
24
+ # 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).
25
+ attr_reader :currency
26
+ # ID of the application fee that was refunded.
27
+ attr_reader :fee
28
+ # Unique identifier for the object.
29
+ attr_reader :id
30
+ # 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.
31
+ attr_reader :metadata
32
+ # String representing the object's type. Objects of the same type share the same value.
33
+ attr_reader :object
34
+
18
35
  def resource_url
19
36
  "#{ApplicationFee.resource_url}/#{CGI.escape(fee)}/refunds" \
20
37
  "/#{CGI.escape(id)}"
@@ -21,6 +21,28 @@ module Stripe
21
21
  "apps.secret"
22
22
  end
23
23
 
24
+ class Scope < Stripe::StripeObject
25
+ attr_reader :type, :user
26
+ end
27
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
28
+ attr_reader :created
29
+ # If true, indicates that this secret has been deleted
30
+ attr_reader :deleted
31
+ # The Unix timestamp for the expiry time of the secret, after which the secret deletes.
32
+ attr_reader :expires_at
33
+ # Unique identifier for the object.
34
+ attr_reader :id
35
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
36
+ attr_reader :livemode
37
+ # A name for the secret that's unique within the scope.
38
+ attr_reader :name
39
+ # String representing the object's type. Objects of the same type share the same value.
40
+ attr_reader :object
41
+ # The plaintext secret value to be stored.
42
+ attr_reader :payload
43
+ # Attribute for field scope
44
+ attr_reader :scope
45
+
24
46
  # Create or replace a secret in the secret store.
25
47
  def self.create(params = {}, opts = {})
26
48
  request_stripe_object(method: :post, path: "/v1/apps/secrets", params: params, opts: opts)
@@ -18,5 +18,64 @@ module Stripe
18
18
  def self.object_name
19
19
  "balance"
20
20
  end
21
+
22
+ class Available < Stripe::StripeObject
23
+ class SourceTypes < Stripe::StripeObject
24
+ attr_reader :bank_account, :card, :fpx
25
+ end
26
+ attr_reader :amount, :currency, :source_types
27
+ end
28
+
29
+ class ConnectReserved < Stripe::StripeObject
30
+ class SourceTypes < Stripe::StripeObject
31
+ attr_reader :bank_account, :card, :fpx
32
+ end
33
+ attr_reader :amount, :currency, :source_types
34
+ end
35
+
36
+ class InstantAvailable < Stripe::StripeObject
37
+ class NetAvailable < Stripe::StripeObject
38
+ class SourceTypes < Stripe::StripeObject
39
+ attr_reader :bank_account, :card, :fpx
40
+ end
41
+ attr_reader :amount, :destination, :source_types
42
+ end
43
+
44
+ class SourceTypes < Stripe::StripeObject
45
+ attr_reader :bank_account, :card, :fpx
46
+ end
47
+ attr_reader :amount, :currency, :net_available, :source_types
48
+ end
49
+
50
+ class Issuing < Stripe::StripeObject
51
+ class Available < Stripe::StripeObject
52
+ class SourceTypes < Stripe::StripeObject
53
+ attr_reader :bank_account, :card, :fpx
54
+ end
55
+ attr_reader :amount, :currency, :source_types
56
+ end
57
+ attr_reader :available
58
+ end
59
+
60
+ class Pending < Stripe::StripeObject
61
+ class SourceTypes < Stripe::StripeObject
62
+ attr_reader :bank_account, :card, :fpx
63
+ end
64
+ attr_reader :amount, :currency, :source_types
65
+ end
66
+ # Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts). You can find the available balance for each currency and payment type in the `source_types` property.
67
+ attr_reader :available
68
+ # Funds held due to negative balances on connected accounts where [account.controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the `source_types` property.
69
+ attr_reader :connect_reserved
70
+ # Funds that you can pay out using Instant Payouts.
71
+ attr_reader :instant_available
72
+ # Attribute for field issuing
73
+ attr_reader :issuing
74
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
75
+ attr_reader :livemode
76
+ # String representing the object's type. Objects of the same type share the same value.
77
+ attr_reader :object
78
+ # Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the `source_types` property.
79
+ attr_reader :pending
21
80
  end
22
81
  end
@@ -14,6 +14,40 @@ module Stripe
14
14
  "balance_transaction"
15
15
  end
16
16
 
17
+ class FeeDetail < Stripe::StripeObject
18
+ attr_reader :amount, :application, :currency, :description, :type
19
+ end
20
+ # Gross amount of this transaction (in cents (or local equivalent)). A positive value represents funds charged to another party, and a negative value represents funds sent to another party.
21
+ attr_reader :amount
22
+ # The date that the transaction's net funds become available in the Stripe balance.
23
+ attr_reader :available_on
24
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
25
+ attr_reader :created
26
+ # 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).
27
+ attr_reader :currency
28
+ # An arbitrary string attached to the object. Often useful for displaying to users.
29
+ attr_reader :description
30
+ # If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the `amount` in currency A, multipled by the `exchange_rate`, equals the `amount` in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntent's `amount` is `1000` and `currency` is `eur`. If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's `amount` is `1234`, its `currency` is `usd`, and the `exchange_rate` is `1.234`.
31
+ attr_reader :exchange_rate
32
+ # Fees (in cents (or local equivalent)) paid for this transaction. Represented as a positive integer when assessed.
33
+ attr_reader :fee
34
+ # Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
35
+ attr_reader :fee_details
36
+ # Unique identifier for the object.
37
+ attr_reader :id
38
+ # Net impact to a Stripe balance (in cents (or local equivalent)). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by `amount` - `fee`
39
+ attr_reader :net
40
+ # String representing the object's type. Objects of the same type share the same value.
41
+ attr_reader :object
42
+ # Learn more about how [reporting categories](https://stripe.com/docs/reports/reporting-categories) can help you understand balance transactions from an accounting perspective.
43
+ attr_reader :reporting_category
44
+ # This transaction relates to the Stripe object.
45
+ attr_reader :source
46
+ # The transaction's net funds status in the Stripe balance, which are either `available` or `pending`.
47
+ attr_reader :status
48
+ # Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types). To classify transactions for accounting purposes, consider `reporting_category` instead.
49
+ attr_reader :type
50
+
17
51
  # Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first.
18
52
  #
19
53
  # Note that this endpoint was previously called “Balance history” and used the path /v1/balance/history.
@@ -19,6 +19,62 @@ module Stripe
19
19
  "bank_account"
20
20
  end
21
21
 
22
+ class FutureRequirements < Stripe::StripeObject
23
+ class Error < Stripe::StripeObject
24
+ attr_reader :code, :reason, :requirement
25
+ end
26
+ attr_reader :currently_due, :errors, :past_due, :pending_verification
27
+ end
28
+
29
+ class Requirements < Stripe::StripeObject
30
+ class Error < Stripe::StripeObject
31
+ attr_reader :code, :reason, :requirement
32
+ end
33
+ attr_reader :currently_due, :errors, :past_due, :pending_verification
34
+ end
35
+ # The ID of the account that the bank account is associated with.
36
+ attr_reader :account
37
+ # The name of the person or business that owns the bank account.
38
+ attr_reader :account_holder_name
39
+ # The type of entity that holds the account. This can be either `individual` or `company`.
40
+ attr_reader :account_holder_type
41
+ # The bank account type. This can only be `checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`.
42
+ attr_reader :account_type
43
+ # A set of available payout methods for this bank account. Only values from this set should be passed as the `method` when creating a payout.
44
+ attr_reader :available_payout_methods
45
+ # Name of the bank associated with the routing number (e.g., `WELLS FARGO`).
46
+ attr_reader :bank_name
47
+ # Two-letter ISO code representing the country the bank account is located in.
48
+ attr_reader :country
49
+ # Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
50
+ attr_reader :currency
51
+ # The ID of the customer that the bank account is associated with.
52
+ attr_reader :customer
53
+ # Whether this bank account is the default external account for its currency.
54
+ attr_reader :default_for_currency
55
+ # Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
56
+ attr_reader :fingerprint
57
+ # Information about the [upcoming new requirements for the bank account](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when.
58
+ attr_reader :future_requirements
59
+ # Unique identifier for the object.
60
+ attr_reader :id
61
+ # The last four digits of the bank account number.
62
+ attr_reader :last4
63
+ # 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.
64
+ attr_reader :metadata
65
+ # String representing the object's type. Objects of the same type share the same value.
66
+ attr_reader :object
67
+ # Information about the requirements for the bank account, including what information needs to be collected.
68
+ attr_reader :requirements
69
+ # The routing transit number for the bank account.
70
+ attr_reader :routing_number
71
+ # For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a payout sent to this bank account fails, we'll set the status to `errored` and will not continue to send [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) until the bank details are updated.
72
+ #
73
+ # For external accounts, possible values are `new`, `errored` and `verification_failed`. If a payout fails, the status is set to `errored` and scheduled payouts are stopped until account details are updated. In the US and India, if we can't [verify the owner of the bank account](https://support.stripe.com/questions/bank-account-ownership-verification), we'll set the status to `verification_failed`. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.
74
+ attr_reader :status
75
+ # Always true for a deleted object
76
+ attr_reader :deleted
77
+
22
78
  def verify(params = {}, opts = {})
23
79
  request_stripe_object(
24
80
  method: :post,
@@ -38,10 +94,12 @@ module Stripe
38
94
  end
39
95
 
40
96
  def resource_url
41
- if respond_to?(:customer)
97
+ if !customer.nil?
42
98
  "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
43
- elsif respond_to?(:account)
99
+ elsif !account.nil?
44
100
  "#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
101
+ else
102
+ raise InvalidRequestError, "Could not determine which URL to request: [account, customer] fields are all null"
45
103
  end
46
104
  end
47
105
 
@@ -13,6 +13,27 @@ module Stripe
13
13
  "billing.alert"
14
14
  end
15
15
 
16
+ class UsageThreshold < Stripe::StripeObject
17
+ class Filter < Stripe::StripeObject
18
+ attr_reader :customer, :type
19
+ end
20
+ attr_reader :filters, :gte, :meter, :recurrence
21
+ end
22
+ # Defines the type of the alert.
23
+ attr_reader :alert_type
24
+ # Unique identifier for the object.
25
+ attr_reader :id
26
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
27
+ attr_reader :livemode
28
+ # String representing the object's type. Objects of the same type share the same value.
29
+ attr_reader :object
30
+ # Status of the alert. This can be active, inactive or archived.
31
+ attr_reader :status
32
+ # Title of the alert.
33
+ attr_reader :title
34
+ # Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://stripe.com/docs/api/billing/meter).
35
+ attr_reader :usage_threshold
36
+
16
37
  # Reactivates this alert, allowing it to trigger again.
17
38
  def activate(params = {}, opts = {})
18
39
  request_stripe_object(
@@ -0,0 +1,26 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Billing
6
+ class AlertTriggered < APIResource
7
+ OBJECT_NAME = "billing.alert_triggered"
8
+ def self.object_name
9
+ "billing.alert_triggered"
10
+ end
11
+
12
+ # A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
13
+ attr_reader :alert
14
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
15
+ attr_reader :created
16
+ # ID of customer for which the alert triggered
17
+ attr_reader :customer
18
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
19
+ attr_reader :livemode
20
+ # String representing the object's type. Objects of the same type share the same value.
21
+ attr_reader :object
22
+ # The value triggering the alert
23
+ attr_reader :value
24
+ end
25
+ end
26
+ end
@@ -9,6 +9,31 @@ module Stripe
9
9
  def self.object_name
10
10
  "billing.credit_balance_summary"
11
11
  end
12
+
13
+ class Balance < Stripe::StripeObject
14
+ class AvailableBalance < Stripe::StripeObject
15
+ class Monetary < Stripe::StripeObject
16
+ attr_reader :currency, :value
17
+ end
18
+ attr_reader :monetary, :type
19
+ end
20
+
21
+ class LedgerBalance < Stripe::StripeObject
22
+ class Monetary < Stripe::StripeObject
23
+ attr_reader :currency, :value
24
+ end
25
+ attr_reader :monetary, :type
26
+ end
27
+ attr_reader :available_balance, :ledger_balance
28
+ end
29
+ # The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry.
30
+ attr_reader :balances
31
+ # The customer the balance is for.
32
+ attr_reader :customer
33
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
34
+ attr_reader :livemode
35
+ # String representing the object's type. Objects of the same type share the same value.
36
+ attr_reader :object
12
37
  end
13
38
  end
14
39
  end
@@ -12,7 +12,51 @@ module Stripe
12
12
  "billing.credit_balance_transaction"
13
13
  end
14
14
 
15
- # Retrieve a list of credit balance transactions
15
+ class Credit < Stripe::StripeObject
16
+ class Amount < Stripe::StripeObject
17
+ class Monetary < Stripe::StripeObject
18
+ attr_reader :currency, :value
19
+ end
20
+ attr_reader :monetary, :type
21
+ end
22
+ attr_reader :amount, :type
23
+ end
24
+
25
+ class Debit < Stripe::StripeObject
26
+ class Amount < Stripe::StripeObject
27
+ class Monetary < Stripe::StripeObject
28
+ attr_reader :currency, :value
29
+ end
30
+ attr_reader :monetary, :type
31
+ end
32
+
33
+ class CreditsApplied < Stripe::StripeObject
34
+ attr_reader :invoice, :invoice_line_item
35
+ end
36
+ attr_reader :amount, :credits_applied, :type
37
+ end
38
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
39
+ attr_reader :created
40
+ # Credit details for this credit balance transaction. Only present if type is `credit`.
41
+ attr_reader :credit
42
+ # The credit grant associated with this credit balance transaction.
43
+ attr_reader :credit_grant
44
+ # Debit details for this credit balance transaction. Only present if type is `debit`.
45
+ attr_reader :debit
46
+ # The effective time of this credit balance transaction.
47
+ attr_reader :effective_at
48
+ # Unique identifier for the object.
49
+ attr_reader :id
50
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
51
+ attr_reader :livemode
52
+ # String representing the object's type. Objects of the same type share the same value.
53
+ attr_reader :object
54
+ # ID of the test clock this credit balance transaction belongs to.
55
+ attr_reader :test_clock
56
+ # The type of credit balance transaction (credit or debit).
57
+ attr_reader :type
58
+
59
+ # Retrieve a list of credit balance transactions.
16
60
  def self.list(filters = {}, opts = {})
17
61
  request_stripe_object(
18
62
  method: :get,
@@ -16,7 +16,51 @@ module Stripe
16
16
  "billing.credit_grant"
17
17
  end
18
18
 
19
- # Creates a credit grant
19
+ class Amount < Stripe::StripeObject
20
+ class Monetary < Stripe::StripeObject
21
+ attr_reader :currency, :value
22
+ end
23
+ attr_reader :monetary, :type
24
+ end
25
+
26
+ class ApplicabilityConfig < Stripe::StripeObject
27
+ class Scope < Stripe::StripeObject
28
+ attr_reader :price_type
29
+ end
30
+ attr_reader :scope
31
+ end
32
+ # Attribute for field amount
33
+ attr_reader :amount
34
+ # Attribute for field applicability_config
35
+ attr_reader :applicability_config
36
+ # The category of this credit grant. This is for tracking purposes and isn't displayed to the customer.
37
+ attr_reader :category
38
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
39
+ attr_reader :created
40
+ # ID of the customer receiving the billing credits.
41
+ attr_reader :customer
42
+ # The time when the billing credits become effective-when they're eligible for use.
43
+ attr_reader :effective_at
44
+ # The time when the billing credits expire. If not present, the billing credits don't expire.
45
+ attr_reader :expires_at
46
+ # Unique identifier for the object.
47
+ attr_reader :id
48
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
49
+ attr_reader :livemode
50
+ # 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.
51
+ attr_reader :metadata
52
+ # A descriptive name shown in dashboard.
53
+ attr_reader :name
54
+ # String representing the object's type. Objects of the same type share the same value.
55
+ attr_reader :object
56
+ # ID of the test clock this credit grant belongs to.
57
+ attr_reader :test_clock
58
+ # Time at which the object was last updated. Measured in seconds since the Unix epoch.
59
+ attr_reader :updated
60
+ # The time when this credit grant was voided. If not present, the credit grant hasn't been voided.
61
+ attr_reader :voided_at
62
+
63
+ # Creates a credit grant.
20
64
  def self.create(params = {}, opts = {})
21
65
  request_stripe_object(
22
66
  method: :post,
@@ -56,7 +100,7 @@ module Stripe
56
100
  )
57
101
  end
58
102
 
59
- # Updates a credit grant
103
+ # Updates a credit grant.
60
104
  def self.update(id, params = {}, opts = {})
61
105
  request_stripe_object(
62
106
  method: :post,
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  module Billing
6
- # A billing meter is a resource that allows you to track usage of a particular event. For example, you might create a billing meter to track the number of API calls made by a particular user. You can then attach the billing meter to a price and attach the price to a subscription to charge the user for the number of API calls they make.
6
+ # Meters specify how to aggregate meter events over a billing period. Meter events represent the actions that customers take in your system. Meters attach to prices and form the basis of the bill.
7
7
  #
8
8
  # Related guide: [Usage based billing](https://docs.stripe.com/billing/subscriptions/usage-based)
9
9
  class Meter < APIResource
@@ -21,12 +21,54 @@ module Stripe
21
21
  operations: %i[list],
22
22
  resource_plural: "event_summaries"
23
23
 
24
- # Creates a billing meter
24
+ class CustomerMapping < Stripe::StripeObject
25
+ attr_reader :event_payload_key, :type
26
+ end
27
+
28
+ class DefaultAggregation < Stripe::StripeObject
29
+ attr_reader :formula
30
+ end
31
+
32
+ class StatusTransitions < Stripe::StripeObject
33
+ attr_reader :deactivated_at
34
+ end
35
+
36
+ class ValueSettings < Stripe::StripeObject
37
+ attr_reader :event_payload_key
38
+ end
39
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
40
+ attr_reader :created
41
+ # Attribute for field customer_mapping
42
+ attr_reader :customer_mapping
43
+ # Attribute for field default_aggregation
44
+ attr_reader :default_aggregation
45
+ # The meter's name.
46
+ attr_reader :display_name
47
+ # The name of the meter event to record usage for. Corresponds with the `event_name` field on meter events.
48
+ attr_reader :event_name
49
+ # The time window to pre-aggregate meter events for, if any.
50
+ attr_reader :event_time_window
51
+ # Unique identifier for the object.
52
+ attr_reader :id
53
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
54
+ attr_reader :livemode
55
+ # String representing the object's type. Objects of the same type share the same value.
56
+ attr_reader :object
57
+ # The meter's status.
58
+ attr_reader :status
59
+ # Attribute for field status_transitions
60
+ attr_reader :status_transitions
61
+ # Time at which the object was last updated. Measured in seconds since the Unix epoch.
62
+ attr_reader :updated
63
+ # Attribute for field value_settings
64
+ attr_reader :value_settings
65
+
66
+ # Creates a billing meter.
25
67
  def self.create(params = {}, opts = {})
26
68
  request_stripe_object(method: :post, path: "/v1/billing/meters", params: params, opts: opts)
27
69
  end
28
70
 
29
- # Deactivates a billing meter
71
+ # When a meter is deactivated, no more meter events will be accepted for this meter. You can't attach a deactivated meter to a price.
30
72
  def deactivate(params = {}, opts = {})
31
73
  request_stripe_object(
32
74
  method: :post,
@@ -36,7 +78,7 @@ module Stripe
36
78
  )
37
79
  end
38
80
 
39
- # Deactivates a billing meter
81
+ # When a meter is deactivated, no more meter events will be accepted for this meter. You can't attach a deactivated meter to a price.
40
82
  def self.deactivate(id, params = {}, opts = {})
41
83
  request_stripe_object(
42
84
  method: :post,
@@ -51,7 +93,7 @@ module Stripe
51
93
  request_stripe_object(method: :get, path: "/v1/billing/meters", params: filters, opts: opts)
52
94
  end
53
95
 
54
- # Reactivates a billing meter
96
+ # When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
55
97
  def reactivate(params = {}, opts = {})
56
98
  request_stripe_object(
57
99
  method: :post,
@@ -61,7 +103,7 @@ module Stripe
61
103
  )
62
104
  end
63
105
 
64
- # Reactivates a billing meter
106
+ # When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
65
107
  def self.reactivate(id, params = {}, opts = {})
66
108
  request_stripe_object(
67
109
  method: :post,
@@ -71,7 +113,7 @@ module Stripe
71
113
  )
72
114
  end
73
115
 
74
- # Updates a billing meter
116
+ # Updates a billing meter.
75
117
  def self.update(id, params = {}, opts = {})
76
118
  request_stripe_object(
77
119
  method: :post,
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Billing
6
+ class MeterErrorReport < APIResource
7
+ OBJECT_NAME = "billing.meter_error_report"
8
+ def self.object_name
9
+ "billing.meter_error_report"
10
+ end
11
+
12
+ class Reason < Stripe::StripeObject
13
+ class ErrorType < Stripe::StripeObject
14
+ class SampleError < Stripe::StripeObject
15
+ class ApiRequest < Stripe::StripeObject
16
+ attr_reader :id, :idempotency_key
17
+ end
18
+ attr_reader :api_request, :error_message
19
+ end
20
+ attr_reader :sample_errors
21
+ end
22
+ attr_reader :error_count, :error_types
23
+ end
24
+
25
+ class RelatedObject < Stripe::StripeObject
26
+ attr_reader :id, :object, :url
27
+ end
28
+ # Unique identifier for the object.
29
+ attr_reader :id
30
+ # String representing the object's type. Objects of the same type share the same value.
31
+ attr_reader :object
32
+ # Attribute for field reason
33
+ attr_reader :reason
34
+ # The related objects about the error
35
+ attr_reader :related_object
36
+ # Summary of invalid events
37
+ attr_reader :summary
38
+ # Time when validation ended. Measured in seconds since the Unix epoch
39
+ attr_reader :validation_end
40
+ # Time when validation started. Measured in seconds since the Unix epoch
41
+ attr_reader :validation_start
42
+ end
43
+ end
44
+ end