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
@@ -24,6 +24,82 @@ module Stripe
24
24
  "identity.verification_session"
25
25
  end
26
26
 
27
+ class LastError < Stripe::StripeObject
28
+ attr_reader :code, :reason
29
+ end
30
+
31
+ class Options < Stripe::StripeObject
32
+ class Document < Stripe::StripeObject
33
+ attr_reader :allowed_types, :require_id_number, :require_live_capture, :require_matching_selfie
34
+ end
35
+
36
+ class Email < Stripe::StripeObject
37
+ attr_reader :require_verification
38
+ end
39
+
40
+ class IdNumber < Stripe::StripeObject; end
41
+
42
+ class Phone < Stripe::StripeObject
43
+ attr_reader :require_verification
44
+ end
45
+ attr_reader :document, :email, :id_number, :phone
46
+ end
47
+
48
+ class ProvidedDetails < Stripe::StripeObject
49
+ attr_reader :email, :phone
50
+ end
51
+
52
+ class Redaction < Stripe::StripeObject
53
+ attr_reader :status
54
+ end
55
+
56
+ class VerifiedOutputs < Stripe::StripeObject
57
+ class Address < Stripe::StripeObject
58
+ attr_reader :city, :country, :line1, :line2, :postal_code, :state
59
+ end
60
+
61
+ class Dob < Stripe::StripeObject
62
+ attr_reader :day, :month, :year
63
+ end
64
+ attr_reader :address, :dob, :email, :first_name, :id_number, :id_number_type, :last_name, :phone
65
+ end
66
+ # A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems.
67
+ attr_reader :client_reference_id
68
+ # The short-lived client secret used by Stripe.js to [show a verification modal](https://stripe.com/docs/js/identity/modal) inside your app. This client secret expires after 24 hours and can only be used once. Don’t store it, log it, embed it in a URL, or expose it to anyone other than the user. Make sure that you have TLS enabled on any page that includes the client secret. Refer to our docs on [passing the client secret to the frontend](https://stripe.com/docs/identity/verification-sessions#client-secret) to learn more.
69
+ attr_reader :client_secret
70
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
71
+ attr_reader :created
72
+ # Unique identifier for the object.
73
+ attr_reader :id
74
+ # If present, this property tells you the last error encountered when processing the verification.
75
+ attr_reader :last_error
76
+ # ID of the most recent VerificationReport. [Learn more about accessing detailed verification results.](https://stripe.com/docs/identity/verification-sessions#results)
77
+ attr_reader :last_verification_report
78
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
79
+ attr_reader :livemode
80
+ # 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.
81
+ attr_reader :metadata
82
+ # String representing the object's type. Objects of the same type share the same value.
83
+ attr_reader :object
84
+ # A set of options for the session’s verification checks.
85
+ attr_reader :options
86
+ # Details provided about the user being verified. These details may be shown to the user.
87
+ attr_reader :provided_details
88
+ # Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.
89
+ attr_reader :redaction
90
+ # Token referencing a Customer resource.
91
+ attr_reader :related_customer
92
+ # Status of this VerificationSession. [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work).
93
+ attr_reader :status
94
+ # The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed.
95
+ attr_reader :type
96
+ # The short-lived URL that you use to redirect a user to Stripe to submit their identity information. This URL expires after 48 hours and can only be used once. Don’t store it, log it, send it in emails or expose it to anyone other than the user. Refer to our docs on [verifying identity documents](https://stripe.com/docs/identity/verify-identity-documents?platform=web&type=redirect) to learn how to redirect users to Stripe.
97
+ attr_reader :url
98
+ # The configuration token of a verification flow from the dashboard.
99
+ attr_reader :verification_flow
100
+ # The user’s verified data.
101
+ attr_reader :verified_outputs
102
+
27
103
  # A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
28
104
  #
29
105
  # Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
@@ -48,6 +48,344 @@ module Stripe
48
48
  end
49
49
 
50
50
  nested_resource_class_methods :line, operations: %i[list]
51
+ nested_resource_class_methods :payment, operations: %i[retrieve list]
52
+
53
+ class AmountsDue < Stripe::StripeObject
54
+ attr_reader :amount, :amount_paid, :amount_remaining, :days_until_due, :description, :due_date, :paid_at, :status
55
+ end
56
+
57
+ class AutomaticTax < Stripe::StripeObject
58
+ class Liability < Stripe::StripeObject
59
+ attr_reader :account, :type
60
+ end
61
+ attr_reader :disabled_reason, :enabled, :liability, :status
62
+ end
63
+
64
+ class CustomField < Stripe::StripeObject
65
+ attr_reader :name, :value
66
+ end
67
+
68
+ class CustomerAddress < Stripe::StripeObject
69
+ attr_reader :city, :country, :line1, :line2, :postal_code, :state
70
+ end
71
+
72
+ class CustomerShipping < Stripe::StripeObject
73
+ class Address < Stripe::StripeObject
74
+ attr_reader :city, :country, :line1, :line2, :postal_code, :state
75
+ end
76
+ attr_reader :address, :carrier, :name, :phone, :tracking_number
77
+ end
78
+
79
+ class CustomerTaxId < Stripe::StripeObject
80
+ attr_reader :type, :value
81
+ end
82
+
83
+ class FromInvoice < Stripe::StripeObject
84
+ attr_reader :action, :invoice
85
+ end
86
+
87
+ class Issuer < Stripe::StripeObject
88
+ attr_reader :account, :type
89
+ end
90
+
91
+ class LastFinalizationError < Stripe::StripeObject
92
+ attr_reader :charge, :code, :decline_code, :doc_url, :message, :network_advice_code, :network_decline_code, :param, :payment_intent, :payment_method, :payment_method_type, :request_log_url, :setup_intent, :source, :type
93
+ end
94
+
95
+ class PaymentSettings < Stripe::StripeObject
96
+ class PaymentMethodOptions < Stripe::StripeObject
97
+ class AcssDebit < Stripe::StripeObject
98
+ class MandateOptions < Stripe::StripeObject
99
+ attr_reader :transaction_type
100
+ end
101
+ attr_reader :mandate_options, :verification_method
102
+ end
103
+
104
+ class Bancontact < Stripe::StripeObject
105
+ attr_reader :preferred_language
106
+ end
107
+
108
+ class Card < Stripe::StripeObject
109
+ class Installments < Stripe::StripeObject
110
+ attr_reader :enabled
111
+ end
112
+ attr_reader :installments, :request_three_d_secure
113
+ end
114
+
115
+ class CustomerBalance < Stripe::StripeObject
116
+ class BankTransfer < Stripe::StripeObject
117
+ class EuBankTransfer < Stripe::StripeObject
118
+ attr_reader :country
119
+ end
120
+ attr_reader :eu_bank_transfer, :type
121
+ end
122
+ attr_reader :bank_transfer, :funding_type
123
+ end
124
+
125
+ class IdBankTransfer < Stripe::StripeObject; end
126
+ class Konbini < Stripe::StripeObject; end
127
+ class SepaDebit < Stripe::StripeObject; end
128
+
129
+ class UsBankAccount < Stripe::StripeObject
130
+ class FinancialConnections < Stripe::StripeObject
131
+ class Filters < Stripe::StripeObject
132
+ attr_reader :account_subcategories, :institution
133
+ end
134
+ attr_reader :filters, :permissions, :prefetch
135
+ end
136
+ attr_reader :financial_connections, :verification_method
137
+ end
138
+ attr_reader :acss_debit, :bancontact, :card, :customer_balance, :id_bank_transfer, :konbini, :sepa_debit, :us_bank_account
139
+ end
140
+ attr_reader :default_mandate, :payment_method_options, :payment_method_types
141
+ end
142
+
143
+ class Rendering < Stripe::StripeObject
144
+ class Pdf < Stripe::StripeObject
145
+ attr_reader :page_size
146
+ end
147
+ attr_reader :amount_tax_display, :pdf, :template, :template_version
148
+ end
149
+
150
+ class ShippingCost < Stripe::StripeObject
151
+ class Tax < Stripe::StripeObject
152
+ attr_reader :amount, :rate, :taxability_reason, :taxable_amount
153
+ end
154
+ attr_reader :amount_subtotal, :amount_tax, :amount_total, :shipping_rate, :taxes
155
+ end
156
+
157
+ class ShippingDetails < Stripe::StripeObject
158
+ class Address < Stripe::StripeObject
159
+ attr_reader :city, :country, :line1, :line2, :postal_code, :state
160
+ end
161
+ attr_reader :address, :carrier, :name, :phone, :tracking_number
162
+ end
163
+
164
+ class StatusTransitions < Stripe::StripeObject
165
+ attr_reader :finalized_at, :marked_uncollectible_at, :paid_at, :voided_at
166
+ end
167
+
168
+ class SubscriptionDetails < Stripe::StripeObject
169
+ class PauseCollection < Stripe::StripeObject
170
+ attr_reader :behavior, :resumes_at
171
+ end
172
+ attr_reader :metadata, :pause_collection
173
+ end
174
+
175
+ class ThresholdReason < Stripe::StripeObject
176
+ class ItemReason < Stripe::StripeObject
177
+ attr_reader :line_item_ids, :usage_gte
178
+ end
179
+ attr_reader :amount_gte, :item_reasons
180
+ end
181
+
182
+ class TotalDiscountAmount < Stripe::StripeObject
183
+ attr_reader :amount, :discount
184
+ end
185
+
186
+ class TotalMarginAmount < Stripe::StripeObject
187
+ attr_reader :amount, :margin
188
+ end
189
+
190
+ class TotalPretaxCreditAmount < Stripe::StripeObject
191
+ attr_reader :amount, :credit_balance_transaction, :discount, :margin, :type
192
+ end
193
+
194
+ class TotalTaxAmount < Stripe::StripeObject
195
+ attr_reader :amount, :inclusive, :tax_rate, :taxability_reason, :taxable_amount
196
+ end
197
+
198
+ class TransferData < Stripe::StripeObject
199
+ attr_reader :amount, :destination
200
+ end
201
+ # The country of the business associated with this invoice, most often the business creating the invoice.
202
+ attr_reader :account_country
203
+ # The public name of the business associated with this invoice, most often the business creating the invoice.
204
+ attr_reader :account_name
205
+ # The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
206
+ attr_reader :account_tax_ids
207
+ # Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the `amount_due` may be 0. If there is a positive `starting_balance` for the invoice (the customer owes money), the `amount_due` will also take that into account. The charge that gets generated for the invoice will be for the amount specified in `amount_due`.
208
+ attr_reader :amount_due
209
+ # Amount that was overpaid on the invoice. Overpayments are debited to the customer's credit balance.
210
+ attr_reader :amount_overpaid
211
+ # The amount, in cents (or local equivalent), that was paid.
212
+ attr_reader :amount_paid
213
+ # The difference between amount_due and amount_paid, in cents (or local equivalent).
214
+ attr_reader :amount_remaining
215
+ # This is the sum of all the shipping amounts.
216
+ attr_reader :amount_shipping
217
+ # List of expected payments and corresponding due dates. This value will be null for invoices where collection_method=charge_automatically.
218
+ attr_reader :amounts_due
219
+ # ID of the Connect Application that created the invoice.
220
+ attr_reader :application
221
+ # The fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid.
222
+ attr_reader :application_fee_amount
223
+ # Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. If a failure is returned with a non-retryable return code, the invoice can no longer be retried unless a new payment method is obtained. Retries will continue to be scheduled, and attempt_count will continue to increment, but retries will only be executed if a new payment method is obtained.
224
+ attr_reader :attempt_count
225
+ # Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the `invoice.created` webhook, for example, so you might not want to display that invoice as unpaid to your users.
226
+ attr_reader :attempted
227
+ # Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action.
228
+ attr_reader :auto_advance
229
+ # Attribute for field automatic_tax
230
+ attr_reader :automatic_tax
231
+ # The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized.
232
+ attr_reader :automatically_finalizes_at
233
+ # Indicates the reason why the invoice was created.
234
+ #
235
+ # * `manual`: Unrelated to a subscription, for example, created via the invoice editor.
236
+ # * `subscription`: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.
237
+ # * `subscription_create`: A new subscription was created.
238
+ # * `subscription_cycle`: A subscription advanced into a new period.
239
+ # * `subscription_threshold`: A subscription reached a billing threshold.
240
+ # * `subscription_update`: A subscription was updated.
241
+ # * `upcoming`: Reserved for simulated invoices, per the upcoming invoice endpoint.
242
+ attr_reader :billing_reason
243
+ # ID of the latest charge generated for this invoice, if any.
244
+ attr_reader :charge
245
+ # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
246
+ attr_reader :collection_method
247
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
248
+ attr_reader :created
249
+ # 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).
250
+ attr_reader :currency
251
+ # Custom fields displayed on the invoice.
252
+ attr_reader :custom_fields
253
+ # The ID of the customer who will be billed.
254
+ attr_reader :customer
255
+ # The customer's address. Until the invoice is finalized, this field will equal `customer.address`. Once the invoice is finalized, this field will no longer be updated.
256
+ attr_reader :customer_address
257
+ # The customer's email. Until the invoice is finalized, this field will equal `customer.email`. Once the invoice is finalized, this field will no longer be updated.
258
+ attr_reader :customer_email
259
+ # The customer's name. Until the invoice is finalized, this field will equal `customer.name`. Once the invoice is finalized, this field will no longer be updated.
260
+ attr_reader :customer_name
261
+ # The customer's phone number. Until the invoice is finalized, this field will equal `customer.phone`. Once the invoice is finalized, this field will no longer be updated.
262
+ attr_reader :customer_phone
263
+ # The customer's shipping information. Until the invoice is finalized, this field will equal `customer.shipping`. Once the invoice is finalized, this field will no longer be updated.
264
+ attr_reader :customer_shipping
265
+ # The customer's tax exempt status. Until the invoice is finalized, this field will equal `customer.tax_exempt`. Once the invoice is finalized, this field will no longer be updated.
266
+ attr_reader :customer_tax_exempt
267
+ # The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as `customer.tax_ids`. Once the invoice is finalized, this field will no longer be updated.
268
+ attr_reader :customer_tax_ids
269
+ # The margins applied to the invoice. Can be overridden by line item `margins`. Use `expand[]=default_margins` to expand each margin.
270
+ attr_reader :default_margins
271
+ # ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.
272
+ attr_reader :default_payment_method
273
+ # ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.
274
+ attr_reader :default_source
275
+ # The tax rates applied to this invoice, if any.
276
+ attr_reader :default_tax_rates
277
+ # An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.
278
+ attr_reader :description
279
+ # Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts.
280
+ attr_reader :discount
281
+ # The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
282
+ attr_reader :discounts
283
+ # The date on which payment for this invoice is due. This value will be `null` for invoices where `collection_method=charge_automatically`.
284
+ attr_reader :due_date
285
+ # The date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt.
286
+ attr_reader :effective_at
287
+ # Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
288
+ attr_reader :ending_balance
289
+ # Footer displayed on the invoice.
290
+ attr_reader :footer
291
+ # Details of the invoice that was cloned. See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details.
292
+ attr_reader :from_invoice
293
+ # The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
294
+ attr_reader :hosted_invoice_url
295
+ # Unique identifier for the object. This property is always present unless the invoice is an upcoming invoice. See [Retrieve an upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) for more details.
296
+ attr_reader :id
297
+ # The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
298
+ attr_reader :invoice_pdf
299
+ # Attribute for field issuer
300
+ attr_reader :issuer
301
+ # The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
302
+ attr_reader :last_finalization_error
303
+ # The ID of the most recent non-draft revision of this invoice
304
+ attr_reader :latest_revision
305
+ # The individual line items that make up the invoice. `lines` is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order.
306
+ attr_reader :lines
307
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
308
+ attr_reader :livemode
309
+ # 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.
310
+ attr_reader :metadata
311
+ # The time at which payment will next be attempted. This value will be `null` for invoices where `collection_method=send_invoice`.
312
+ attr_reader :next_payment_attempt
313
+ # A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified.
314
+ attr_reader :number
315
+ # String representing the object's type. Objects of the same type share the same value.
316
+ attr_reader :object
317
+ # The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details.
318
+ attr_reader :on_behalf_of
319
+ # Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance.
320
+ attr_reader :paid
321
+ # Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe.
322
+ attr_reader :paid_out_of_band
323
+ # The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent.
324
+ attr_reader :payment_intent
325
+ # Attribute for field payment_settings
326
+ attr_reader :payment_settings
327
+ # Payments for this invoice
328
+ attr_reader :payments
329
+ # End of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price.
330
+ attr_reader :period_end
331
+ # Start of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price.
332
+ attr_reader :period_start
333
+ # Total amount of all post-payment credit notes issued for this invoice.
334
+ attr_reader :post_payment_credit_notes_amount
335
+ # Total amount of all pre-payment credit notes issued for this invoice.
336
+ attr_reader :pre_payment_credit_notes_amount
337
+ # The quote this invoice was generated from.
338
+ attr_reader :quote
339
+ # This is the transaction number that appears on email receipts sent for this invoice.
340
+ attr_reader :receipt_number
341
+ # The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
342
+ attr_reader :rendering
343
+ # The details of the cost of shipping, including the ShippingRate applied on the invoice.
344
+ attr_reader :shipping_cost
345
+ # Shipping details for the invoice. The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer.
346
+ attr_reader :shipping_details
347
+ # Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. For revision invoices, this also includes any customer balance that was applied to the original invoice.
348
+ attr_reader :starting_balance
349
+ # Extra information about an invoice for the customer's credit card statement.
350
+ attr_reader :statement_descriptor
351
+ # The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview)
352
+ attr_reader :status
353
+ # Attribute for field status_transitions
354
+ attr_reader :status_transitions
355
+ # The subscription that this invoice was prepared for, if any.
356
+ attr_reader :subscription
357
+ # Details about the subscription that created this invoice.
358
+ attr_reader :subscription_details
359
+ # Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
360
+ attr_reader :subscription_proration_date
361
+ # Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated
362
+ attr_reader :subtotal
363
+ # The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
364
+ attr_reader :subtotal_excluding_tax
365
+ # The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
366
+ attr_reader :tax
367
+ # ID of the test clock this invoice belongs to.
368
+ attr_reader :test_clock
369
+ # Attribute for field threshold_reason
370
+ attr_reader :threshold_reason
371
+ # Total after discounts and taxes.
372
+ attr_reader :total
373
+ # The aggregate amounts calculated per discount across all line items.
374
+ attr_reader :total_discount_amounts
375
+ # The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.
376
+ attr_reader :total_excluding_tax
377
+ # The aggregate amounts calculated per margin across all line items.
378
+ attr_reader :total_margin_amounts
379
+ # Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice. This is a combined list of total_pretax_credit_amounts across all invoice line items.
380
+ attr_reader :total_pretax_credit_amounts
381
+ # The aggregate amounts calculated per tax rate for all line items.
382
+ attr_reader :total_tax_amounts
383
+ # The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice.
384
+ attr_reader :transfer_data
385
+ # Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have [been exhausted](https://stripe.com/docs/billing/webhooks#understand). This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created.
386
+ attr_reader :webhooks_delivered_at
387
+ # Always true for a deleted object
388
+ attr_reader :deleted
51
389
 
52
390
  # Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
53
391
  def add_lines(params = {}, opts = {})
@@ -69,6 +407,86 @@ module Stripe
69
407
  )
70
408
  end
71
409
 
410
+ # Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
411
+ #
412
+ # For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid
413
+ # of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
414
+ #
415
+ # For the PaymentIntent, when the PaymentIntent's status changes to succeeded, the payment is credited
416
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
417
+ # invoice's status becomes paid.
418
+ #
419
+ # If the PaymentIntent's status is already succeeded when it's attached, it's
420
+ # credited to the invoice immediately.
421
+ #
422
+ # See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more.
423
+ def attach_payment(params = {}, opts = {})
424
+ request_stripe_object(
425
+ method: :post,
426
+ path: format("/v1/invoices/%<invoice>s/attach_payment", { invoice: CGI.escape(self["id"]) }),
427
+ params: params,
428
+ opts: opts
429
+ )
430
+ end
431
+
432
+ # Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
433
+ #
434
+ # For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid
435
+ # of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
436
+ #
437
+ # For the PaymentIntent, when the PaymentIntent's status changes to succeeded, the payment is credited
438
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
439
+ # invoice's status becomes paid.
440
+ #
441
+ # If the PaymentIntent's status is already succeeded when it's attached, it's
442
+ # credited to the invoice immediately.
443
+ #
444
+ # See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more.
445
+ def self.attach_payment(invoice, params = {}, opts = {})
446
+ request_stripe_object(
447
+ method: :post,
448
+ path: format("/v1/invoices/%<invoice>s/attach_payment", { invoice: CGI.escape(invoice) }),
449
+ params: params,
450
+ opts: opts
451
+ )
452
+ end
453
+
454
+ # Attaches a PaymentIntent to the invoice, adding it to the list of payments.
455
+ # When the PaymentIntent's status changes to succeeded, the payment is credited
456
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
457
+ # invoice's status becomes paid.
458
+ #
459
+ # If the PaymentIntent's status is already succeeded when it is attached, it is
460
+ # credited to the invoice immediately.
461
+ #
462
+ # Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
463
+ def attach_payment_intent(params = {}, opts = {})
464
+ request_stripe_object(
465
+ method: :post,
466
+ path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(self["id"]) }),
467
+ params: params,
468
+ opts: opts
469
+ )
470
+ end
471
+
472
+ # Attaches a PaymentIntent to the invoice, adding it to the list of payments.
473
+ # When the PaymentIntent's status changes to succeeded, the payment is credited
474
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
475
+ # invoice's status becomes paid.
476
+ #
477
+ # If the PaymentIntent's status is already succeeded when it is attached, it is
478
+ # credited to the invoice immediately.
479
+ #
480
+ # Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
481
+ def self.attach_payment_intent(invoice, params = {}, opts = {})
482
+ request_stripe_object(
483
+ method: :post,
484
+ path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(invoice) }),
485
+ params: params,
486
+ opts: opts
487
+ )
488
+ end
489
+
72
490
  # This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
73
491
  def self.create(params = {}, opts = {})
74
492
  request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
@@ -24,6 +24,60 @@ module Stripe
24
24
  "invoiceitem"
25
25
  end
26
26
 
27
+ class Period < Stripe::StripeObject
28
+ attr_reader :end, :start
29
+ end
30
+ # Amount (in the `currency` specified) of the invoice item. This should always be equal to `unit_amount * quantity`.
31
+ attr_reader :amount
32
+ # 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).
33
+ attr_reader :currency
34
+ # The ID of the customer who will be billed when this invoice item is billed.
35
+ attr_reader :customer
36
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
37
+ attr_reader :date
38
+ # An arbitrary string attached to the object. Often useful for displaying to users.
39
+ attr_reader :description
40
+ # If true, discounts will apply to this invoice item. Always false for prorations.
41
+ attr_reader :discountable
42
+ # The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
43
+ attr_reader :discounts
44
+ # Unique identifier for the object.
45
+ attr_reader :id
46
+ # The ID of the invoice this invoice item belongs to.
47
+ attr_reader :invoice
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
+ # The margins which apply to the invoice item. When set, the `default_margins` on the invoice do not apply to this invoice item.
51
+ attr_reader :margins
52
+ # 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.
53
+ attr_reader :metadata
54
+ # String representing the object's type. Objects of the same type share the same value.
55
+ attr_reader :object
56
+ # Attribute for field period
57
+ attr_reader :period
58
+ # If the invoice item is a proration, the plan of the subscription that the proration was computed for.
59
+ attr_reader :plan
60
+ # The price of the invoice item.
61
+ attr_reader :price
62
+ # Whether the invoice item was created automatically as a proration adjustment when the customer switched plans.
63
+ attr_reader :proration
64
+ # Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for.
65
+ attr_reader :quantity
66
+ # The subscription that this invoice item has been created for, if any.
67
+ attr_reader :subscription
68
+ # The subscription item that this invoice item has been created for, if any.
69
+ attr_reader :subscription_item
70
+ # The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.
71
+ attr_reader :tax_rates
72
+ # ID of the test clock this invoice item belongs to.
73
+ attr_reader :test_clock
74
+ # Unit amount (in the `currency` specified) of the invoice item.
75
+ attr_reader :unit_amount
76
+ # Same as `unit_amount`, but contains a decimal value with at most 12 decimal places.
77
+ attr_reader :unit_amount_decimal
78
+ # Always true for a deleted object
79
+ attr_reader :deleted
80
+
27
81
  # Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is specified, the item will be on the next invoice created for the customer specified.
28
82
  def self.create(params = {}, opts = {})
29
83
  request_stripe_object(method: :post, path: "/v1/invoiceitems", params: params, opts: opts)
@@ -13,6 +13,89 @@ module Stripe
13
13
  "line_item"
14
14
  end
15
15
 
16
+ class DiscountAmount < Stripe::StripeObject
17
+ attr_reader :amount, :discount
18
+ end
19
+
20
+ class MarginAmount < Stripe::StripeObject
21
+ attr_reader :amount, :margin
22
+ end
23
+
24
+ class Period < Stripe::StripeObject
25
+ attr_reader :end, :start
26
+ end
27
+
28
+ class PretaxCreditAmount < Stripe::StripeObject
29
+ attr_reader :amount, :credit_balance_transaction, :discount, :margin, :type
30
+ end
31
+
32
+ class ProrationDetails < Stripe::StripeObject
33
+ class CreditedItems < Stripe::StripeObject
34
+ attr_reader :invoice, :invoice_line_items
35
+ end
36
+ attr_reader :credited_items
37
+ end
38
+
39
+ class TaxAmount < Stripe::StripeObject
40
+ attr_reader :amount, :inclusive, :tax_rate, :taxability_reason, :taxable_amount
41
+ end
42
+ # The amount, in cents (or local equivalent).
43
+ attr_reader :amount
44
+ # The integer amount in cents (or local equivalent) representing the amount for this line item, excluding all tax and discounts.
45
+ attr_reader :amount_excluding_tax
46
+ # 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).
47
+ attr_reader :currency
48
+ # An arbitrary string attached to the object. Often useful for displaying to users.
49
+ attr_reader :description
50
+ # The amount of discount calculated per discount for this line item.
51
+ attr_reader :discount_amounts
52
+ # If true, discounts will apply to this line item. Always false for prorations.
53
+ attr_reader :discountable
54
+ # The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
55
+ attr_reader :discounts
56
+ # Unique identifier for the object.
57
+ attr_reader :id
58
+ # The ID of the invoice that contains this line item.
59
+ attr_reader :invoice
60
+ # The ID of the [invoice item](https://stripe.com/docs/api/invoiceitems) associated with this line item if any.
61
+ attr_reader :invoice_item
62
+ # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
63
+ attr_reader :livemode
64
+ # The amount of margin calculated per margin for this line item.
65
+ attr_reader :margin_amounts
66
+ # The margins applied to the line item. When set, the `default_margins` on the invoice do not apply to the line item. Use `expand[]=margins` to expand each margin.
67
+ attr_reader :margins
68
+ # 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. Note that for line items with `type=subscription`, `metadata` reflects the current metadata from the subscription associated with the line item, unless the invoice line was directly updated with different metadata after creation.
69
+ attr_reader :metadata
70
+ # String representing the object's type. Objects of the same type share the same value.
71
+ attr_reader :object
72
+ # Attribute for field period
73
+ attr_reader :period
74
+ # The plan of the subscription, if the line item is a subscription or a proration.
75
+ attr_reader :plan
76
+ # Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this line item.
77
+ attr_reader :pretax_credit_amounts
78
+ # The price of the line item.
79
+ attr_reader :price
80
+ # Whether this is a proration.
81
+ attr_reader :proration
82
+ # Additional details for proration line items
83
+ attr_reader :proration_details
84
+ # The quantity of the subscription, if the line item is a subscription or a proration.
85
+ attr_reader :quantity
86
+ # The subscription that the invoice item pertains to, if any.
87
+ attr_reader :subscription
88
+ # The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription.
89
+ attr_reader :subscription_item
90
+ # The amount of tax calculated per tax rate for this line item
91
+ attr_reader :tax_amounts
92
+ # The tax rates which apply to the line item.
93
+ attr_reader :tax_rates
94
+ # A string identifying the type of the source of this line item, either an `invoiceitem` or a `subscription`.
95
+ attr_reader :type
96
+ # The amount in cents (or local equivalent) representing the unit amount for this line item, excluding all tax and discounts.
97
+ attr_reader :unit_amount_excluding_tax
98
+
16
99
  # Updates an invoice's line item. Some fields, such as tax_amounts, only live on the invoice line item,
17
100
  # so they can only be updated through this endpoint. Other fields, such as amount, live on both the invoice
18
101
  # item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well.