stripe 10.1.0 → 12.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +215 -21
  3. data/Gemfile +6 -5
  4. data/Makefile +8 -1
  5. data/OPENAPI_VERSION +1 -1
  6. data/README.md +46 -14
  7. data/Rakefile +7 -5
  8. data/VERSION +1 -1
  9. data/{bin → exe}/stripe-console +1 -1
  10. data/lib/stripe/api_operations/nested_resource.rb +22 -2
  11. data/lib/stripe/api_operations/request.rb +22 -18
  12. data/lib/stripe/api_operations/save.rb +7 -9
  13. data/lib/stripe/api_operations/search.rb +5 -0
  14. data/lib/stripe/api_operations/singleton_save.rb +86 -0
  15. data/lib/stripe/api_resource.rb +13 -4
  16. data/lib/stripe/api_resource_test_helpers.rb +7 -3
  17. data/lib/stripe/api_version.rb +1 -1
  18. data/lib/stripe/connection_manager.rb +4 -6
  19. data/lib/stripe/errors.rb +3 -11
  20. data/lib/stripe/instrumentation.rb +5 -21
  21. data/lib/stripe/list_object.rb +3 -0
  22. data/lib/stripe/multipart_encoder.rb +7 -7
  23. data/lib/stripe/oauth.rb +6 -6
  24. data/lib/stripe/object_types.rb +135 -116
  25. data/lib/stripe/resources/account.rb +103 -25
  26. data/lib/stripe/resources/account_link.rb +8 -0
  27. data/lib/stripe/resources/account_session.rb +8 -0
  28. data/lib/stripe/resources/alipay_account.rb +1 -1
  29. data/lib/stripe/resources/apple_pay_domain.rb +43 -0
  30. data/lib/stripe/resources/application_fee.rb +8 -0
  31. data/lib/stripe/resources/application_fee_refund.rb +4 -2
  32. data/lib/stripe/resources/apps/secret.rb +15 -0
  33. data/lib/stripe/resources/balance.rb +3 -0
  34. data/lib/stripe/resources/balance_transaction.rb +15 -0
  35. data/lib/stripe/resources/bank_account.rb +49 -7
  36. data/lib/stripe/resources/billing/alert.rb +87 -0
  37. data/lib/stripe/resources/billing/meter.rb +83 -0
  38. data/lib/stripe/resources/billing/meter_event.rb +27 -0
  39. data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
  40. data/lib/stripe/resources/billing/meter_event_summary.rb +15 -0
  41. data/lib/stripe/resources/billing_portal/configuration.rb +33 -0
  42. data/lib/stripe/resources/billing_portal/session.rb +14 -1
  43. data/lib/stripe/resources/capability.rb +4 -2
  44. data/lib/stripe/resources/card.rb +28 -0
  45. data/lib/stripe/resources/cash_balance.rb +3 -0
  46. data/lib/stripe/resources/charge.rb +39 -1
  47. data/lib/stripe/resources/checkout/session.rb +47 -5
  48. data/lib/stripe/resources/climate/order.rb +67 -0
  49. data/lib/stripe/resources/climate/product.rb +27 -0
  50. data/lib/stripe/resources/climate/supplier.rb +26 -0
  51. data/lib/stripe/resources/confirmation_token.rb +39 -0
  52. data/lib/stripe/resources/country_spec.rb +8 -0
  53. data/lib/stripe/resources/coupon.rb +45 -0
  54. data/lib/stripe/resources/credit_note.rb +47 -7
  55. data/lib/stripe/resources/credit_note_line_item.rb +3 -0
  56. data/lib/stripe/resources/customer.rb +89 -26
  57. data/lib/stripe/resources/customer_balance_transaction.rb +3 -1
  58. data/lib/stripe/resources/customer_cash_balance_transaction.rb +3 -2
  59. data/lib/stripe/resources/customer_session.rb +29 -0
  60. data/lib/stripe/resources/discount.rb +3 -0
  61. data/lib/stripe/resources/dispute.rb +26 -0
  62. data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
  63. data/lib/stripe/resources/entitlements/feature.rb +49 -0
  64. data/lib/stripe/resources/ephemeral_key.rb +23 -0
  65. data/lib/stripe/resources/event.rb +11 -3
  66. data/lib/stripe/resources/exchange_rate.rb +8 -0
  67. data/lib/stripe/resources/file.rb +29 -16
  68. data/lib/stripe/resources/file_link.rb +23 -0
  69. data/lib/stripe/resources/financial_connections/account.rb +66 -7
  70. data/lib/stripe/resources/financial_connections/account_owner.rb +3 -0
  71. data/lib/stripe/resources/financial_connections/account_ownership.rb +3 -0
  72. data/lib/stripe/resources/financial_connections/session.rb +13 -0
  73. data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
  74. data/lib/stripe/resources/forwarding/request.rb +52 -0
  75. data/lib/stripe/resources/funding_instructions.rb +3 -0
  76. data/lib/stripe/resources/identity/verification_report.rb +14 -1
  77. data/lib/stripe/resources/identity/verification_session.rb +90 -4
  78. data/lib/stripe/resources/invoice.rb +170 -17
  79. data/lib/stripe/resources/invoice_item.rb +43 -0
  80. data/lib/stripe/resources/invoice_line_item.rb +21 -0
  81. data/lib/stripe/resources/invoice_rendering_template.rb +63 -0
  82. data/lib/stripe/resources/issuing/authorization.rb +88 -14
  83. data/lib/stripe/resources/issuing/card.rb +50 -16
  84. data/lib/stripe/resources/issuing/cardholder.rb +33 -0
  85. data/lib/stripe/resources/issuing/dispute.rb +35 -0
  86. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  87. data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
  88. data/lib/stripe/resources/issuing/token.rb +18 -0
  89. data/lib/stripe/resources/issuing/transaction.rb +30 -0
  90. data/lib/stripe/resources/line_item.rb +3 -0
  91. data/lib/stripe/resources/login_link.rb +4 -1
  92. data/lib/stripe/resources/mandate.rb +3 -0
  93. data/lib/stripe/resources/payment_intent.rb +190 -25
  94. data/lib/stripe/resources/payment_link.rb +25 -0
  95. data/lib/stripe/resources/payment_method.rb +57 -4
  96. data/lib/stripe/resources/payment_method_configuration.rb +33 -0
  97. data/lib/stripe/resources/payment_method_domain.rb +46 -1
  98. data/lib/stripe/resources/payout.rb +39 -4
  99. data/lib/stripe/resources/person.rb +5 -4
  100. data/lib/stripe/resources/plan.rb +43 -0
  101. data/lib/stripe/resources/price.rb +24 -1
  102. data/lib/stripe/resources/product.rb +47 -1
  103. data/lib/stripe/resources/product_feature.rb +13 -0
  104. data/lib/stripe/resources/promotion_code.rb +23 -0
  105. data/lib/stripe/resources/quote.rb +67 -32
  106. data/lib/stripe/resources/radar/early_fraud_warning.rb +13 -0
  107. data/lib/stripe/resources/radar/value_list.rb +53 -0
  108. data/lib/stripe/resources/radar/value_list_item.rb +43 -0
  109. data/lib/stripe/resources/refund.rb +46 -0
  110. data/lib/stripe/resources/reporting/report_run.rb +23 -0
  111. data/lib/stripe/resources/reporting/report_type.rb +13 -0
  112. data/lib/stripe/resources/reversal.rb +5 -3
  113. data/lib/stripe/resources/review.rb +10 -0
  114. data/lib/stripe/resources/setup_attempt.rb +8 -0
  115. data/lib/stripe/resources/setup_intent.rb +72 -10
  116. data/lib/stripe/resources/shipping_rate.rb +23 -0
  117. data/lib/stripe/resources/sigma/scheduled_query_run.rb +13 -0
  118. data/lib/stripe/resources/source.rb +23 -1
  119. data/lib/stripe/resources/source_transaction.rb +3 -0
  120. data/lib/stripe/resources/subscription.rb +81 -13
  121. data/lib/stripe/resources/subscription_item.rb +54 -1
  122. data/lib/stripe/resources/subscription_schedule.rb +41 -4
  123. data/lib/stripe/resources/tax/calculation.rb +15 -0
  124. data/lib/stripe/resources/tax/calculation_line_item.rb +3 -0
  125. data/lib/stripe/resources/tax/registration.rb +35 -0
  126. data/lib/stripe/resources/tax/settings.rb +4 -2
  127. data/lib/stripe/resources/tax/transaction.rb +15 -8
  128. data/lib/stripe/resources/tax/transaction_line_item.rb +3 -0
  129. data/lib/stripe/resources/tax_code.rb +8 -0
  130. data/lib/stripe/resources/tax_id.rb +30 -12
  131. data/lib/stripe/resources/tax_rate.rb +23 -0
  132. data/lib/stripe/resources/terminal/configuration.rb +53 -0
  133. data/lib/stripe/resources/terminal/connection_token.rb +13 -0
  134. data/lib/stripe/resources/terminal/location.rb +54 -0
  135. data/lib/stripe/resources/terminal/reader.rb +80 -12
  136. data/lib/stripe/resources/test_helpers/test_clock.rb +45 -0
  137. data/lib/stripe/resources/token.rb +10 -1
  138. data/lib/stripe/resources/topup.rb +25 -0
  139. data/lib/stripe/resources/transfer.rb +26 -1
  140. data/lib/stripe/resources/treasury/credit_reversal.rb +23 -0
  141. data/lib/stripe/resources/treasury/debit_reversal.rb +23 -0
  142. data/lib/stripe/resources/treasury/financial_account.rb +42 -5
  143. data/lib/stripe/resources/treasury/financial_account_features.rb +3 -0
  144. data/lib/stripe/resources/treasury/inbound_transfer.rb +47 -11
  145. data/lib/stripe/resources/treasury/outbound_payment.rb +64 -8
  146. data/lib/stripe/resources/treasury/outbound_transfer.rb +64 -8
  147. data/lib/stripe/resources/treasury/received_credit.rb +17 -0
  148. data/lib/stripe/resources/treasury/received_debit.rb +17 -0
  149. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  150. data/lib/stripe/resources/treasury/transaction_entry.rb +13 -0
  151. data/lib/stripe/resources/usage_record.rb +5 -0
  152. data/lib/stripe/resources/usage_record_summary.rb +3 -0
  153. data/lib/stripe/resources/webhook_endpoint.rb +55 -2
  154. data/lib/stripe/resources.rb +18 -0
  155. data/lib/stripe/search_result_object.rb +4 -1
  156. data/lib/stripe/singleton_api_resource.rb +20 -3
  157. data/lib/stripe/stripe_client.rb +61 -63
  158. data/lib/stripe/stripe_configuration.rb +13 -29
  159. data/lib/stripe/stripe_object.rb +23 -21
  160. data/lib/stripe/stripe_response.rb +1 -3
  161. data/lib/stripe/util.rb +13 -15
  162. data/lib/stripe/version.rb +1 -1
  163. data/lib/stripe.rb +26 -0
  164. data/stripe.gemspec +7 -4
  165. metadata +25 -5
@@ -20,7 +20,11 @@ module Stripe
20
20
  include Stripe::APIOperations::Save
21
21
 
22
22
  OBJECT_NAME = "payment_intent"
23
+ def self.object_name
24
+ "payment_intent"
25
+ end
23
26
 
27
+ # Manually reconcile the remaining amount for a customer_balance PaymentIntent.
24
28
  def apply_customer_balance(params = {}, opts = {})
25
29
  request_stripe_object(
26
30
  method: :post,
@@ -30,6 +34,21 @@ module Stripe
30
34
  )
31
35
  end
32
36
 
37
+ # Manually reconcile the remaining amount for a customer_balance PaymentIntent.
38
+ def self.apply_customer_balance(intent, params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ # You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
48
+ #
49
+ # After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
50
+ #
51
+ # You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
33
52
  def cancel(params = {}, opts = {})
34
53
  request_stripe_object(
35
54
  method: :post,
@@ -39,6 +58,25 @@ module Stripe
39
58
  )
40
59
  end
41
60
 
61
+ # You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
62
+ #
63
+ # After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
64
+ #
65
+ # You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
66
+ def self.cancel(intent, params = {}, opts = {})
67
+ request_stripe_object(
68
+ method: :post,
69
+ path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
70
+ params: params,
71
+ opts: opts
72
+ )
73
+ end
74
+
75
+ # Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
76
+ #
77
+ # Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
78
+ #
79
+ # Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
42
80
  def capture(params = {}, opts = {})
43
81
  request_stripe_object(
44
82
  method: :post,
@@ -48,78 +86,213 @@ module Stripe
48
86
  )
49
87
  end
50
88
 
51
- def confirm(params = {}, opts = {})
89
+ # Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
90
+ #
91
+ # Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
92
+ #
93
+ # Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
94
+ def self.capture(intent, params = {}, opts = {})
52
95
  request_stripe_object(
53
96
  method: :post,
54
- path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
97
+ path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
55
98
  params: params,
56
99
  opts: opts
57
100
  )
58
101
  end
59
102
 
60
- def increment_authorization(params = {}, opts = {})
103
+ # Confirm that your customer intends to pay with current or provided
104
+ # payment method. Upon confirmation, the PaymentIntent will attempt to initiate
105
+ # a payment.
106
+ # If the selected payment method requires additional authentication steps, the
107
+ # PaymentIntent will transition to the requires_action status and
108
+ # suggest additional actions via next_action. If payment fails,
109
+ # the PaymentIntent transitions to the requires_payment_method status or the
110
+ # canceled status if the confirmation limit is reached. If
111
+ # payment succeeds, the PaymentIntent will transition to the succeeded
112
+ # status (or requires_capture, if capture_method is set to manual).
113
+ # If the confirmation_method is automatic, payment may be attempted
114
+ # using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
115
+ # and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
116
+ # After next_actions are handled by the client, no additional
117
+ # confirmation is required to complete the payment.
118
+ # If the confirmation_method is manual, all payment attempts must be
119
+ # initiated using a secret key.
120
+ # If any actions are required for the payment, the PaymentIntent will
121
+ # return to the requires_confirmation state
122
+ # after those actions are completed. Your server needs to then
123
+ # explicitly re-confirm the PaymentIntent to initiate the next payment
124
+ # attempt.
125
+ # There is a variable upper limit on how many times a PaymentIntent can be confirmed.
126
+ # After this limit is reached, any further calls to this endpoint will
127
+ # transition the PaymentIntent to the canceled state.
128
+ def confirm(params = {}, opts = {})
61
129
  request_stripe_object(
62
130
  method: :post,
63
- path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
131
+ path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
64
132
  params: params,
65
133
  opts: opts
66
134
  )
67
135
  end
68
136
 
69
- def verify_microdeposits(params = {}, opts = {})
137
+ # Confirm that your customer intends to pay with current or provided
138
+ # payment method. Upon confirmation, the PaymentIntent will attempt to initiate
139
+ # a payment.
140
+ # If the selected payment method requires additional authentication steps, the
141
+ # PaymentIntent will transition to the requires_action status and
142
+ # suggest additional actions via next_action. If payment fails,
143
+ # the PaymentIntent transitions to the requires_payment_method status or the
144
+ # canceled status if the confirmation limit is reached. If
145
+ # payment succeeds, the PaymentIntent will transition to the succeeded
146
+ # status (or requires_capture, if capture_method is set to manual).
147
+ # If the confirmation_method is automatic, payment may be attempted
148
+ # using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
149
+ # and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
150
+ # After next_actions are handled by the client, no additional
151
+ # confirmation is required to complete the payment.
152
+ # If the confirmation_method is manual, all payment attempts must be
153
+ # initiated using a secret key.
154
+ # If any actions are required for the payment, the PaymentIntent will
155
+ # return to the requires_confirmation state
156
+ # after those actions are completed. Your server needs to then
157
+ # explicitly re-confirm the PaymentIntent to initiate the next payment
158
+ # attempt.
159
+ # There is a variable upper limit on how many times a PaymentIntent can be confirmed.
160
+ # After this limit is reached, any further calls to this endpoint will
161
+ # transition the PaymentIntent to the canceled state.
162
+ def self.confirm(intent, params = {}, opts = {})
70
163
  request_stripe_object(
71
164
  method: :post,
72
- path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
165
+ path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
73
166
  params: params,
74
167
  opts: opts
75
168
  )
76
169
  end
77
170
 
78
- def self.apply_customer_balance(intent, params = {}, opts = {})
171
+ # Creates a PaymentIntent object.
172
+ #
173
+ # After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm)
174
+ # to continue the payment. Learn more about <a href="/docs/payments/payment-intents">the available payment flows
175
+ # with the Payment Intents API.
176
+ #
177
+ # When you use confirm=true during creation, it's equivalent to creating
178
+ # and confirming the PaymentIntent in the same call. You can use any parameters
179
+ # available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply
180
+ # confirm=true.
181
+ def self.create(params = {}, opts = {})
182
+ request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts)
183
+ end
184
+
185
+ # Perform an incremental authorization on an eligible
186
+ # [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
187
+ # PaymentIntent's status must be requires_capture and
188
+ # [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
189
+ # must be true.
190
+ #
191
+ # Incremental authorizations attempt to increase the authorized amount on
192
+ # your customer's card to the new, higher amount provided. Similar to the
193
+ # initial authorization, incremental authorizations can be declined. A
194
+ # single PaymentIntent can call this endpoint multiple times to further
195
+ # increase the authorized amount.
196
+ #
197
+ # If the incremental authorization succeeds, the PaymentIntent object
198
+ # returns with the updated
199
+ # [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
200
+ # If the incremental authorization fails, a
201
+ # [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
202
+ # fields on the PaymentIntent or Charge update. The PaymentIntent
203
+ # object remains capturable for the previously authorized amount.
204
+ #
205
+ # Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
206
+ # After it's captured, a PaymentIntent can no longer be incremented.
207
+ #
208
+ # Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
209
+ def increment_authorization(params = {}, opts = {})
79
210
  request_stripe_object(
80
211
  method: :post,
81
- path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
212
+ path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
82
213
  params: params,
83
214
  opts: opts
84
215
  )
85
216
  end
86
217
 
87
- def self.cancel(intent, params = {}, opts = {})
218
+ # Perform an incremental authorization on an eligible
219
+ # [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
220
+ # PaymentIntent's status must be requires_capture and
221
+ # [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
222
+ # must be true.
223
+ #
224
+ # Incremental authorizations attempt to increase the authorized amount on
225
+ # your customer's card to the new, higher amount provided. Similar to the
226
+ # initial authorization, incremental authorizations can be declined. A
227
+ # single PaymentIntent can call this endpoint multiple times to further
228
+ # increase the authorized amount.
229
+ #
230
+ # If the incremental authorization succeeds, the PaymentIntent object
231
+ # returns with the updated
232
+ # [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
233
+ # If the incremental authorization fails, a
234
+ # [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
235
+ # fields on the PaymentIntent or Charge update. The PaymentIntent
236
+ # object remains capturable for the previously authorized amount.
237
+ #
238
+ # Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
239
+ # After it's captured, a PaymentIntent can no longer be incremented.
240
+ #
241
+ # Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
242
+ def self.increment_authorization(intent, params = {}, opts = {})
88
243
  request_stripe_object(
89
244
  method: :post,
90
- path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
245
+ path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
91
246
  params: params,
92
247
  opts: opts
93
248
  )
94
249
  end
95
250
 
96
- def self.capture(intent, params = {}, opts = {})
251
+ # Returns a list of PaymentIntents.
252
+ def self.list(filters = {}, opts = {})
253
+ request_stripe_object(method: :get, path: "/v1/payment_intents", params: filters, opts: opts)
254
+ end
255
+
256
+ def self.search(params = {}, opts = {})
97
257
  request_stripe_object(
98
- method: :post,
99
- path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
258
+ method: :get,
259
+ path: "/v1/payment_intents/search",
100
260
  params: params,
101
261
  opts: opts
102
262
  )
103
263
  end
104
264
 
105
- def self.confirm(intent, params = {}, opts = {})
265
+ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
266
+ search(params, opts).auto_paging_each(&blk)
267
+ end
268
+
269
+ # Updates properties on a PaymentIntent object without confirming.
270
+ #
271
+ # Depending on which properties you update, you might need to confirm the
272
+ # PaymentIntent again. For example, updating the payment_method
273
+ # always requires you to confirm the PaymentIntent again. If you prefer to
274
+ # update and confirm at the same time, we recommend updating properties through
275
+ # the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead.
276
+ def self.update(id, params = {}, opts = {})
106
277
  request_stripe_object(
107
278
  method: :post,
108
- path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
279
+ path: format("/v1/payment_intents/%<id>s", { id: CGI.escape(id) }),
109
280
  params: params,
110
281
  opts: opts
111
282
  )
112
283
  end
113
284
 
114
- def self.increment_authorization(intent, params = {}, opts = {})
285
+ # Verifies microdeposits on a PaymentIntent object.
286
+ def verify_microdeposits(params = {}, opts = {})
115
287
  request_stripe_object(
116
288
  method: :post,
117
- path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
289
+ path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
118
290
  params: params,
119
291
  opts: opts
120
292
  )
121
293
  end
122
294
 
295
+ # Verifies microdeposits on a PaymentIntent object.
123
296
  def self.verify_microdeposits(intent, params = {}, opts = {})
124
297
  request_stripe_object(
125
298
  method: :post,
@@ -128,13 +301,5 @@ module Stripe
128
301
  opts: opts
129
302
  )
130
303
  end
131
-
132
- def self.search(params = {}, opts = {})
133
- _search("/v1/payment_intents/search", params, opts)
134
- end
135
-
136
- def self.search_auto_paging_each(params = {}, opts = {}, &blk)
137
- search(params, opts).auto_paging_each(&blk)
138
- end
139
304
  end
140
305
  end
@@ -13,7 +13,21 @@ module Stripe
13
13
  include Stripe::APIOperations::Save
14
14
 
15
15
  OBJECT_NAME = "payment_link"
16
+ def self.object_name
17
+ "payment_link"
18
+ end
19
+
20
+ # Creates a payment link.
21
+ def self.create(params = {}, opts = {})
22
+ request_stripe_object(method: :post, path: "/v1/payment_links", params: params, opts: opts)
23
+ end
16
24
 
25
+ # Returns a list of your payment links.
26
+ def self.list(filters = {}, opts = {})
27
+ request_stripe_object(method: :get, path: "/v1/payment_links", params: filters, opts: opts)
28
+ end
29
+
30
+ # When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
17
31
  def list_line_items(params = {}, opts = {})
18
32
  request_stripe_object(
19
33
  method: :get,
@@ -23,6 +37,7 @@ module Stripe
23
37
  )
24
38
  end
25
39
 
40
+ # When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
26
41
  def self.list_line_items(payment_link, params = {}, opts = {})
27
42
  request_stripe_object(
28
43
  method: :get,
@@ -31,5 +46,15 @@ module Stripe
31
46
  opts: opts
32
47
  )
33
48
  end
49
+
50
+ # Updates a payment link.
51
+ def self.update(id, params = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/payment_links/%<id>s", { id: CGI.escape(id) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
34
59
  end
35
60
  end
@@ -13,7 +13,23 @@ module Stripe
13
13
  include Stripe::APIOperations::Save
14
14
 
15
15
  OBJECT_NAME = "payment_method"
16
+ def self.object_name
17
+ "payment_method"
18
+ end
16
19
 
20
+ # Attaches a PaymentMethod object to a Customer.
21
+ #
22
+ # To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents)
23
+ # or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage).
24
+ # These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
25
+ # endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for
26
+ # future use, which makes later declines and payment friction more likely.
27
+ # See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up
28
+ # future payments.
29
+ #
30
+ # To use this PaymentMethod as the default for invoice or subscription payments,
31
+ # set [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method),
32
+ # on the Customer to the PaymentMethod's ID.
17
33
  def attach(params = {}, opts = {})
18
34
  request_stripe_object(
19
35
  method: :post,
@@ -23,24 +39,46 @@ module Stripe
23
39
  )
24
40
  end
25
41
 
26
- def detach(params = {}, opts = {})
42
+ # Attaches a PaymentMethod object to a Customer.
43
+ #
44
+ # To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents)
45
+ # or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage).
46
+ # These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
47
+ # endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for
48
+ # future use, which makes later declines and payment friction more likely.
49
+ # See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up
50
+ # future payments.
51
+ #
52
+ # To use this PaymentMethod as the default for invoice or subscription payments,
53
+ # set [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method),
54
+ # on the Customer to the PaymentMethod's ID.
55
+ def self.attach(payment_method, params = {}, opts = {})
27
56
  request_stripe_object(
28
57
  method: :post,
29
- path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
58
+ path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
30
59
  params: params,
31
60
  opts: opts
32
61
  )
33
62
  end
34
63
 
35
- def self.attach(payment_method, params = {}, opts = {})
64
+ # Creates a PaymentMethod object. Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js.
65
+ #
66
+ # Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents API to accept a payment immediately or the <a href="/docs/payments/save-and-reuse">SetupIntent](https://stripe.com/docs/payments/accept-a-payment) API to collect payment method details ahead of a future payment.
67
+ def self.create(params = {}, opts = {})
68
+ request_stripe_object(method: :post, path: "/v1/payment_methods", params: params, opts: opts)
69
+ end
70
+
71
+ # Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
72
+ def detach(params = {}, opts = {})
36
73
  request_stripe_object(
37
74
  method: :post,
38
- path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
75
+ path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
39
76
  params: params,
40
77
  opts: opts
41
78
  )
42
79
  end
43
80
 
81
+ # Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
44
82
  def self.detach(payment_method, params = {}, opts = {})
45
83
  request_stripe_object(
46
84
  method: :post,
@@ -49,5 +87,20 @@ module Stripe
49
87
  opts: opts
50
88
  )
51
89
  end
90
+
91
+ # Returns a list of PaymentMethods for Treasury flows. If you want to list the PaymentMethods attached to a Customer for payments, you should use the [List a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list) API instead.
92
+ def self.list(filters = {}, opts = {})
93
+ request_stripe_object(method: :get, path: "/v1/payment_methods", params: filters, opts: opts)
94
+ end
95
+
96
+ # Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.
97
+ def self.update(id, params = {}, opts = {})
98
+ request_stripe_object(
99
+ method: :post,
100
+ path: format("/v1/payment_methods/%<id>s", { id: CGI.escape(id) }),
101
+ params: params,
102
+ opts: opts
103
+ )
104
+ end
52
105
  end
53
106
  end
@@ -22,5 +22,38 @@ module Stripe
22
22
  include Stripe::APIOperations::Save
23
23
 
24
24
  OBJECT_NAME = "payment_method_configuration"
25
+ def self.object_name
26
+ "payment_method_configuration"
27
+ end
28
+
29
+ # Creates a payment method configuration
30
+ def self.create(params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: "/v1/payment_method_configurations",
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ # List payment method configurations
40
+ def self.list(filters = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :get,
43
+ path: "/v1/payment_method_configurations",
44
+ params: filters,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ # Update payment method configuration
50
+ def self.update(id, params = {}, opts = {})
51
+ request_stripe_object(
52
+ method: :post,
53
+ path: format("/v1/payment_method_configurations/%<id>s", { id: CGI.escape(id) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
25
58
  end
26
59
  end
@@ -5,14 +5,53 @@ module Stripe
5
5
  # A payment method domain represents a web domain that you have registered with Stripe.
6
6
  # Stripe Elements use registered payment method domains to control where certain payment methods are shown.
7
7
  #
8
- # Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
8
+ # Related guide: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
9
9
  class PaymentMethodDomain < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  extend Stripe::APIOperations::List
12
12
  include Stripe::APIOperations::Save
13
13
 
14
14
  OBJECT_NAME = "payment_method_domain"
15
+ def self.object_name
16
+ "payment_method_domain"
17
+ end
18
+
19
+ # Creates a payment method domain.
20
+ def self.create(params = {}, opts = {})
21
+ request_stripe_object(
22
+ method: :post,
23
+ path: "/v1/payment_method_domains",
24
+ params: params,
25
+ opts: opts
26
+ )
27
+ end
28
+
29
+ # Lists the details of existing payment method domains.
30
+ def self.list(filters = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :get,
33
+ path: "/v1/payment_method_domains",
34
+ params: filters,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ # Updates an existing payment method domain.
40
+ def self.update(id, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: format("/v1/payment_method_domains/%<id>s", { id: CGI.escape(id) }),
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
15
48
 
49
+ # Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain.
50
+ # The payment method doesn't appear in Elements for this domain until it is active.
51
+ #
52
+ # To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint.
53
+ #
54
+ # Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
16
55
  def validate(params = {}, opts = {})
17
56
  request_stripe_object(
18
57
  method: :post,
@@ -22,6 +61,12 @@ module Stripe
22
61
  )
23
62
  end
24
63
 
64
+ # Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain.
65
+ # The payment method doesn't appear in Elements for this domain until it is active.
66
+ #
67
+ # To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint.
68
+ #
69
+ # Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
25
70
  def self.validate(payment_method_domain, params = {}, opts = {})
26
71
  request_stripe_object(
27
72
  method: :post,
@@ -16,7 +16,11 @@ module Stripe
16
16
  include Stripe::APIOperations::Save
17
17
 
18
18
  OBJECT_NAME = "payout"
19
+ def self.object_name
20
+ "payout"
21
+ end
19
22
 
23
+ # You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts.
20
24
  def cancel(params = {}, opts = {})
21
25
  request_stripe_object(
22
26
  method: :post,
@@ -26,24 +30,45 @@ module Stripe
26
30
  )
27
31
  end
28
32
 
29
- def reverse(params = {}, opts = {})
33
+ # You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts.
34
+ def self.cancel(payout, params = {}, opts = {})
30
35
  request_stripe_object(
31
36
  method: :post,
32
- path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
37
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
33
38
  params: params,
34
39
  opts: opts
35
40
  )
36
41
  end
37
42
 
38
- def self.cancel(payout, params = {}, opts = {})
43
+ # To send funds to your own bank account, create a new payout object. Your [Stripe balance](https://stripe.com/docs/api#balance) must cover the payout amount. If it doesn't, you receive an “Insufficient Funds” error.
44
+ #
45
+ # If your API key is in test mode, money won't actually be sent, though every other action occurs as if you're in live mode.
46
+ #
47
+ # If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. The [balance object](https://stripe.com/docs/api#balance_object) details available and pending amounts by source type.
48
+ def self.create(params = {}, opts = {})
49
+ request_stripe_object(method: :post, path: "/v1/payouts", params: params, opts: opts)
50
+ end
51
+
52
+ # Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. The payouts return in sorted order, with the most recently created payouts appearing first.
53
+ def self.list(filters = {}, opts = {})
54
+ request_stripe_object(method: :get, path: "/v1/payouts", params: filters, opts: opts)
55
+ end
56
+
57
+ # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
58
+ #
59
+ # By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
60
+ def reverse(params = {}, opts = {})
39
61
  request_stripe_object(
40
62
  method: :post,
41
- path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
63
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
42
64
  params: params,
43
65
  opts: opts
44
66
  )
45
67
  end
46
68
 
69
+ # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
70
+ #
71
+ # By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
47
72
  def self.reverse(payout, params = {}, opts = {})
48
73
  request_stripe_object(
49
74
  method: :post,
@@ -52,5 +77,15 @@ module Stripe
52
77
  opts: opts
53
78
  )
54
79
  end
80
+
81
+ # Updates the specified payout by setting the values of the parameters you pass. We don't change parameters that you don't provide. This request only accepts the metadata as arguments.
82
+ def self.update(id, params = {}, opts = {})
83
+ request_stripe_object(
84
+ method: :post,
85
+ path: format("/v1/payouts/%<id>s", { id: CGI.escape(id) }),
86
+ params: params,
87
+ opts: opts
88
+ )
89
+ end
55
90
  end
56
91
  end
@@ -4,15 +4,16 @@
4
4
  module Stripe
5
5
  # This is an object representing a person associated with a Stripe account.
6
6
  #
7
- # A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account.
8
- # See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform prefilling and account onboarding steps.
7
+ # A platform cannot access a person for an account where [account.controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `stripe`, which includes Standard and Express accounts, after creating an Account Link or Account Session to start Connect onboarding.
9
8
  #
10
- # Related guide: [Handling identity verification with the API](https://stripe.com/docs/connect/handling-api-verification#person-information)
9
+ # See the [Standard onboarding](https://stripe.com/connect/standard-accounts) or [Express onboarding](https://stripe.com/connect/express-accounts) documentation for information about prefilling information and account onboarding steps. Learn more about [handling identity verification with the API](https://stripe.com/connect/handling-api-verification#person-information).
11
10
  class Person < APIResource
12
- extend Stripe::APIOperations::List
13
11
  include Stripe::APIOperations::Save
14
12
 
15
13
  OBJECT_NAME = "person"
14
+ def self.object_name
15
+ "person"
16
+ end
16
17
 
17
18
  def resource_url
18
19
  if !respond_to?(:account) || account.nil?