stripe 10.15.0 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +64 -21
- data/Gemfile +0 -4
- data/OPENAPI_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/stripe/api_operations/nested_resource.rb +22 -2
- data/lib/stripe/api_version.rb +1 -1
- data/lib/stripe/object_types.rb +2 -2
- data/lib/stripe/resources/account.rb +28 -15
- data/lib/stripe/resources/bank_account.rb +4 -3
- data/lib/stripe/resources/billing/meter.rb +1 -1
- data/lib/stripe/resources/billing/meter_event_adjustment.rb +1 -1
- data/lib/stripe/resources/event.rb +3 -3
- data/lib/stripe/resources/forwarding/request.rb +3 -3
- data/lib/stripe/resources/invoice.rb +22 -1
- data/lib/stripe/resources/issuing/authorization.rb +11 -0
- data/lib/stripe/resources/login_link.rb +1 -1
- data/lib/stripe/resources/person.rb +2 -3
- data/lib/stripe/resources/reversal.rb +1 -1
- data/lib/stripe/resources/setup_intent.rb +4 -4
- data/lib/stripe/resources/token.rb +2 -2
- data/lib/stripe/resources/treasury/outbound_payment.rb +20 -0
- data/lib/stripe/resources/treasury/outbound_transfer.rb +20 -0
- data/lib/stripe/resources/usage_record.rb +2 -0
- data/lib/stripe/resources/webhook_endpoint.rb +2 -2
- data/lib/stripe/stripe_client.rb +20 -13
- data/lib/stripe/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10d590e76f5c8524bee12dc767dee9b845fa9732aa4eed9621d0c10d05dfef4c
|
|
4
|
+
data.tar.gz: 803b1a9728c6322b40cce127b3464e1abff35c2ad515a73ec2b11ae1fe5b0476
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f324debcf2d8d68f425a1fd934d981656f695d8440ca3c4cef5dab5b618d56407e324420b0ceee896f69c21281133d8fe4fb931b9bca34a9fece9fc281b6ef3
|
|
7
|
+
data.tar.gz: 6d17556b19ccac9ce7d9a102b6a3d7984b042f98fcaeb3014dd177a232fba50897bbba9b2ddf6addc76fad6a99b607e4f0069c994047e38217f53ee81b61ed7c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## 11.7.0 - 2024-06-13
|
|
3
|
+
* [#1415](https://github.com/stripe/stripe-ruby/pull/1415) Deprecate StripeClient#request
|
|
4
|
+
* Add deprecation warning for `StripeClient#request`. This helper method will be removed in a future major version. To access response objects, use the `last_response` property on the returned resource instead. Refer to [Accessing a response object](https://github.com/stripe/stripe-ruby?tab=readme-ov-file#accessing-a-response-object) in the README for usage details.
|
|
5
|
+
|
|
6
|
+
## 11.6.0 - 2024-05-30
|
|
7
|
+
* [#1404](https://github.com/stripe/stripe-ruby/pull/1404) Add method to list invoice line items
|
|
8
|
+
* Add methods `list_lines()` on the class `Invoice` to list the invoice line items
|
|
9
|
+
|
|
10
|
+
## 11.5.0 - 2024-05-23
|
|
11
|
+
* This release has no changes.
|
|
12
|
+
|
|
13
|
+
## 11.4.0 - 2024-05-09
|
|
14
|
+
* [#1397](https://github.com/stripe/stripe-ruby/pull/1397) Update generated code
|
|
15
|
+
* Add support for `update` test helper method on resources `Treasury.OutboundPayment` and `Treasury.OutboundTransfer`
|
|
16
|
+
* [#1399](https://github.com/stripe/stripe-ruby/pull/1399) Pass params to transfer reversal
|
|
17
|
+
* Allow `Stripe::Transfer.retrieve_reversal()` to accept a params hash as the third argument, followed by opts. No changes to existing calls are necessary, but in a future major version this method will be updated to only accept params as the first argument. Fixes [#1393](https://github.com/stripe/stripe-ruby/issues/1393)
|
|
18
|
+
* [#1389](https://github.com/stripe/stripe-ruby/pull/1389) Removed jaro_winkler as a dependency
|
|
19
|
+
* [#1396](https://github.com/stripe/stripe-ruby/pull/1396) Start tracking `StripeClient#request` usage
|
|
20
|
+
|
|
21
|
+
## 11.3.0 - 2024-05-02
|
|
22
|
+
* [#1387](https://github.com/stripe/stripe-ruby/pull/1387) Update generated code
|
|
23
|
+
|
|
24
|
+
* [#1392](https://github.com/stripe/stripe-ruby/pull/1392) Deprecate Ruby methods based on OpenAPI spec
|
|
25
|
+
- Mark as deprecated the `approve` and `decline` methods in `lib/stripe/resources/issuing/authorization.rb`. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
|
|
26
|
+
* [#1391](https://github.com/stripe/stripe-ruby/pull/1391) Add Ruby 3.3 to CI test matrix
|
|
27
|
+
|
|
28
|
+
## 11.2.0 - 2024-04-18
|
|
29
|
+
* [#1385](https://github.com/stripe/stripe-ruby/pull/1385) Update generated code
|
|
30
|
+
* Add support for `create_preview` method on resource `Invoice`
|
|
31
|
+
|
|
32
|
+
## 11.1.0 - 2024-04-16
|
|
33
|
+
* [#1379](https://github.com/stripe/stripe-ruby/pull/1379) Update generated code
|
|
34
|
+
* Add support for new resource `Entitlements.ActiveEntitlementSummary`
|
|
35
|
+
|
|
36
|
+
## 11.0.0 - 2024-04-10
|
|
37
|
+
* [#1374](https://github.com/stripe/stripe-ruby/pull/1374)
|
|
38
|
+
|
|
39
|
+
* This release changes the pinned API version to `2024-04-10`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-04-10) and carefully review the API changes before upgrading.
|
|
40
|
+
|
|
41
|
+
### ⚠️ Breaking changes
|
|
42
|
+
|
|
43
|
+
* When no `x-stripe-should-retry` header is set in the response, the library now retries all requests with `status >= 500`, not just non-POST methods.
|
|
44
|
+
|
|
2
45
|
## 10.15.0 - 2024-04-09
|
|
3
46
|
* [#1377](https://github.com/stripe/stripe-ruby/pull/1377) Add last_response to StripeObject
|
|
4
47
|
* Users can now retrieve raw response from the returned resource, using the `last_response` property. See [README](https://github.com/stripe/stripe-ruby/blob/master/README.md) for an example.
|
|
@@ -138,32 +181,32 @@
|
|
|
138
181
|
**⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
|
|
139
182
|
|
|
140
183
|
* [#1253](https://github.com/stripe/stripe-ruby/pull/1253) [#1260](https://github.com/stripe/stripe-ruby/pull/1260) Pin latest API version as the default
|
|
141
|
-
|
|
184
|
+
|
|
142
185
|
In this release, Stripe API Version `2023-08-16` (the latest at time of release) will be sent by default on all requests. This is a significant change with wide ramifications. The API version affects the properties you see on responses, the parameters you are allowed to send on requests, and so on. The previous default was to use your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version).
|
|
143
|
-
|
|
186
|
+
|
|
144
187
|
To successfully upgrade to stripe-ruby v9, you must either
|
|
145
|
-
|
|
188
|
+
|
|
146
189
|
1. **(Recommended) Upgrade your integration to be compatible with API Version `2023-08-16`.**
|
|
147
|
-
|
|
190
|
+
|
|
148
191
|
Please read the API Changelog carefully for each API Version from `2023-08-16` back to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). Determine if you are using any of the APIs that have changed in a breaking way, and adjust your integration accordingly. Carefully test your changes with Stripe [Test Mode](https://stripe.com/docs/keys#test-live-modes) before deploying them to production.
|
|
149
|
-
|
|
192
|
+
|
|
150
193
|
You can read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more detailed instructions.
|
|
151
194
|
2. **(Alternative option) Specify a version other than `2023-08-16` when initializing `stripe-ruby`.**
|
|
152
|
-
|
|
195
|
+
|
|
153
196
|
If you were previously initializing stripe-ruby without an explicit API Version, you can postpone modifying your integration by specifying a version equal to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). For example:
|
|
154
|
-
|
|
197
|
+
|
|
155
198
|
```diff
|
|
156
199
|
require 'stripe'
|
|
157
200
|
Stripe.api_key = "sk_test_..."
|
|
158
201
|
+ Stripe.api_version = '2020-08-27'
|
|
159
202
|
```
|
|
160
|
-
|
|
203
|
+
|
|
161
204
|
If you were already initializing stripe-ruby with an explicit API Version, upgrading to v9 will not affect your integration.
|
|
162
|
-
|
|
205
|
+
|
|
163
206
|
Read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more details.
|
|
164
|
-
|
|
207
|
+
|
|
165
208
|
Going forward, each major release of this library will be *pinned* by default to the latest Stripe API Version at the time of release.
|
|
166
|
-
|
|
209
|
+
|
|
167
210
|
That is, instead of upgrading stripe-ruby and separately upgrading your Stripe API Version through the Stripe Dashboard. whenever you upgrade major versions of stripe-ruby, you should also upgrade your integration to be compatible with the latest Stripe API version.
|
|
168
211
|
|
|
169
212
|
## 8.7.0 - 2023-08-10
|
|
@@ -190,7 +233,7 @@
|
|
|
190
233
|
|
|
191
234
|
* [#1225](https://github.com/stripe/stripe-ruby/pull/1225) Downgrade jaro_winkler
|
|
192
235
|
* [#1219](https://github.com/stripe/stripe-ruby/pull/1219) Update generated code
|
|
193
|
-
|
|
236
|
+
|
|
194
237
|
Documentation updates.
|
|
195
238
|
* [#1215](https://github.com/stripe/stripe-ruby/pull/1215) Update generated code
|
|
196
239
|
|
|
@@ -238,7 +281,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
|
238
281
|
refund = Stripe::Refund.retrieve("re_123")
|
|
239
282
|
refund.description = "Refund description"
|
|
240
283
|
refund.save
|
|
241
|
-
|
|
284
|
+
|
|
242
285
|
# after
|
|
243
286
|
Stripe::Refund.update("re_123", description: "Refund description")
|
|
244
287
|
```
|
|
@@ -302,7 +345,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
|
302
345
|
* [#1072](https://github.com/stripe/stripe-ruby/pull/1072) Trigger workflows on beta branches
|
|
303
346
|
* [#1071](https://github.com/stripe/stripe-ruby/pull/1071) Use request_stripe_object for all requests
|
|
304
347
|
* [#1070](https://github.com/stripe/stripe-ruby/pull/1070) API Updates
|
|
305
|
-
|
|
348
|
+
|
|
306
349
|
Switch from using meta-programing to generating explicit methods for custom methods.
|
|
307
350
|
* [#1069](https://github.com/stripe/stripe-ruby/pull/1069) chore: Stop special implementation of Account.persons method.
|
|
308
351
|
|
|
@@ -318,15 +361,15 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
|
318
361
|
* Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction`
|
|
319
362
|
* Add support for `retrieve_payment_method` method on resource `Customer`
|
|
320
363
|
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
|
|
321
|
-
|
|
322
|
-
|
|
364
|
+
|
|
365
|
+
|
|
323
366
|
|
|
324
367
|
## 6.0.0 - 2022-05-09
|
|
325
368
|
* [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
|
|
326
369
|
Major version release. The [migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-Guide-for-v6) contains more information.
|
|
327
|
-
|
|
370
|
+
|
|
328
371
|
(⚠️ = breaking changes):
|
|
329
|
-
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
|
|
372
|
+
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
|
|
330
373
|
* New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
|
|
331
374
|
* Removed methods: `pay` and `return_order`
|
|
332
375
|
* Removed resources: `OrderItem` and `OrderReturn`
|
|
@@ -335,7 +378,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
|
335
378
|
## 5.55.0 - 2022-05-05
|
|
336
379
|
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
|
|
337
380
|
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
|
|
338
|
-
|
|
381
|
+
|
|
339
382
|
|
|
340
383
|
## 5.54.0 - 2022-05-03
|
|
341
384
|
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
|
|
@@ -346,7 +389,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
|
346
389
|
* Add support for `expire` test helper method on resource `Refund`
|
|
347
390
|
|
|
348
391
|
## 5.52.0 - 2022-04-18
|
|
349
|
-
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
|
|
392
|
+
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
|
|
350
393
|
* Add support for new resources `FundingInstructions` and `Terminal.Configuration`
|
|
351
394
|
|
|
352
395
|
## 5.51.0 - 2022-04-15
|
|
@@ -368,7 +411,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
|
368
411
|
* [#1040](https://github.com/stripe/stripe-ruby/pull/1040) API Updates
|
|
369
412
|
* Add support for Search API
|
|
370
413
|
* Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription`
|
|
371
|
-
|
|
414
|
+
|
|
372
415
|
* [#1034](https://github.com/stripe/stripe-ruby/pull/1034) Add supporting classes for test helper generation
|
|
373
416
|
|
|
374
417
|
## 5.46.0 - 2022-03-23
|
data/Gemfile
CHANGED
|
@@ -27,10 +27,6 @@ group :development do
|
|
|
27
27
|
# The latest version of rubocop is only compatible with Ruby 2.7+
|
|
28
28
|
gem "rubocop", "1.57.2" if RUBY_VERSION >= "2.7"
|
|
29
29
|
|
|
30
|
-
# jaro_winkler 1.5.5 installation fails for jruby
|
|
31
|
-
# don't install on truffleruby
|
|
32
|
-
gem "jaro_winkler", "1.5.4" unless RUBY_ENGINE == "truffleruby"
|
|
33
|
-
|
|
34
30
|
gem "sorbet"
|
|
35
31
|
gem "tapioca"
|
|
36
32
|
|
data/OPENAPI_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v1011
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
11.7.0
|
|
@@ -35,6 +35,7 @@ module Stripe
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
# rubocop:disable Metrics/MethodLength
|
|
38
39
|
private def define_operation(
|
|
39
40
|
resource,
|
|
40
41
|
operation,
|
|
@@ -53,12 +54,30 @@ module Stripe
|
|
|
53
54
|
)
|
|
54
55
|
end
|
|
55
56
|
when :retrieve
|
|
57
|
+
# TODO: (Major) Split params_or_opts to params and opts and get rid of the complicated way to add params
|
|
56
58
|
define_singleton_method(:"retrieve_#{resource}") \
|
|
57
|
-
do |id, nested_id,
|
|
59
|
+
do |id, nested_id, params_or_opts = {}, definitely_opts = nil|
|
|
60
|
+
opts = nil
|
|
61
|
+
params = nil
|
|
62
|
+
if definitely_opts.nil?
|
|
63
|
+
unrecognized_key = params_or_opts.keys.find { |k| !Util::OPTS_USER_SPECIFIED.include?(k) }
|
|
64
|
+
if unrecognized_key
|
|
65
|
+
raise ArgumentError,
|
|
66
|
+
"Unrecognized request option: #{unrecognized_key}. Did you mean to specify this as " \
|
|
67
|
+
"retrieve params? " \
|
|
68
|
+
"If so, you must explicitly pass an opts hash as a fourth argument. " \
|
|
69
|
+
"For example: .retrieve(#{id}, #{nested_id}, {#{unrecognized_key}: 'foo'}, {})"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
opts = params_or_opts
|
|
73
|
+
else
|
|
74
|
+
opts = definitely_opts
|
|
75
|
+
params = params_or_opts
|
|
76
|
+
end
|
|
58
77
|
request_stripe_object(
|
|
59
78
|
method: :get,
|
|
60
79
|
path: send(resource_url_method, id, nested_id),
|
|
61
|
-
params:
|
|
80
|
+
params: params,
|
|
62
81
|
opts: opts
|
|
63
82
|
)
|
|
64
83
|
end
|
|
@@ -96,6 +115,7 @@ module Stripe
|
|
|
96
115
|
raise ArgumentError, "Unknown operation: #{operation.inspect}"
|
|
97
116
|
end
|
|
98
117
|
end
|
|
118
|
+
# rubocop:enable Metrics/MethodLength
|
|
99
119
|
end
|
|
100
120
|
end
|
|
101
121
|
end
|
data/lib/stripe/api_version.rb
CHANGED
data/lib/stripe/object_types.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Stripe
|
|
|
12
12
|
SearchResultObject.object_name => SearchResultObject,
|
|
13
13
|
File.object_name_alt => File,
|
|
14
14
|
|
|
15
|
-
# The beginning of the section generated from our OpenAPI spec
|
|
15
|
+
# object classes: The beginning of the section generated from our OpenAPI spec
|
|
16
16
|
Account.object_name => Account,
|
|
17
17
|
AccountLink.object_name => AccountLink,
|
|
18
18
|
AccountSession.object_name => AccountSession,
|
|
@@ -139,7 +139,7 @@ module Stripe
|
|
|
139
139
|
UsageRecord.object_name => UsageRecord,
|
|
140
140
|
UsageRecordSummary.object_name => UsageRecordSummary,
|
|
141
141
|
WebhookEndpoint.object_name => WebhookEndpoint,
|
|
142
|
-
# The end of the section generated from our OpenAPI spec
|
|
142
|
+
# object classes: The end of the section generated from our OpenAPI spec
|
|
143
143
|
}
|
|
144
144
|
end
|
|
145
145
|
end
|
|
@@ -6,9 +6,14 @@ module Stripe
|
|
|
6
6
|
# properties on the account like its current requirements or if the account is
|
|
7
7
|
# enabled to make live charges or receive payouts.
|
|
8
8
|
#
|
|
9
|
-
# For
|
|
10
|
-
#
|
|
11
|
-
#
|
|
9
|
+
# For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
|
10
|
+
# is `application`, which includes Custom accounts, the properties below are always
|
|
11
|
+
# returned.
|
|
12
|
+
#
|
|
13
|
+
# For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
|
14
|
+
# is `stripe`, which includes Standard and Express accounts, some properties are only returned
|
|
15
|
+
# until you create an [Account Link](https://stripe.com/api/account_links) or [Account Session](https://stripe.com/api/account_sessions)
|
|
16
|
+
# to start Connect Onboarding. Learn about the [differences between accounts](https://stripe.com/connect/accounts).
|
|
12
17
|
class Account < APIResource
|
|
13
18
|
extend Stripe::APIOperations::Create
|
|
14
19
|
include Stripe::APIOperations::Delete
|
|
@@ -39,9 +44,11 @@ module Stripe
|
|
|
39
44
|
request_stripe_object(method: :post, path: "/v1/accounts", params: params, opts: opts)
|
|
40
45
|
end
|
|
41
46
|
|
|
42
|
-
# With [Connect](https://stripe.com/
|
|
47
|
+
# With [Connect](https://stripe.com/connect), you can delete accounts you manage.
|
|
48
|
+
#
|
|
49
|
+
# Test-mode accounts can be deleted at any time.
|
|
43
50
|
#
|
|
44
|
-
#
|
|
51
|
+
# Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balanace_object) are zero.
|
|
45
52
|
#
|
|
46
53
|
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
|
|
47
54
|
def self.delete(id, params = {}, opts = {})
|
|
@@ -53,9 +60,11 @@ module Stripe
|
|
|
53
60
|
)
|
|
54
61
|
end
|
|
55
62
|
|
|
56
|
-
# With [Connect](https://stripe.com/
|
|
63
|
+
# With [Connect](https://stripe.com/connect), you can delete accounts you manage.
|
|
57
64
|
#
|
|
58
|
-
#
|
|
65
|
+
# Test-mode accounts can be deleted at any time.
|
|
66
|
+
#
|
|
67
|
+
# Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balanace_object) are zero.
|
|
59
68
|
#
|
|
60
69
|
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
|
|
61
70
|
def delete(params = {}, opts = {})
|
|
@@ -92,9 +101,9 @@ module Stripe
|
|
|
92
101
|
)
|
|
93
102
|
end
|
|
94
103
|
|
|
95
|
-
# With [Connect](https://stripe.com/
|
|
104
|
+
# With [Connect](https://stripe.com/connect), you can reject accounts that you have flagged as suspicious.
|
|
96
105
|
#
|
|
97
|
-
#
|
|
106
|
+
# Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
|
|
98
107
|
def reject(params = {}, opts = {})
|
|
99
108
|
request_stripe_object(
|
|
100
109
|
method: :post,
|
|
@@ -104,9 +113,9 @@ module Stripe
|
|
|
104
113
|
)
|
|
105
114
|
end
|
|
106
115
|
|
|
107
|
-
# With [Connect](https://stripe.com/
|
|
116
|
+
# With [Connect](https://stripe.com/connect), you can reject accounts that you have flagged as suspicious.
|
|
108
117
|
#
|
|
109
|
-
#
|
|
118
|
+
# Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
|
|
110
119
|
def self.reject(account, params = {}, opts = {})
|
|
111
120
|
request_stripe_object(
|
|
112
121
|
method: :post,
|
|
@@ -116,12 +125,16 @@ module Stripe
|
|
|
116
125
|
)
|
|
117
126
|
end
|
|
118
127
|
|
|
119
|
-
# Updates a [connected account](https://stripe.com/
|
|
128
|
+
# Updates a [connected account](https://stripe.com/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
|
|
120
129
|
# left unchanged.
|
|
121
130
|
#
|
|
122
|
-
# For
|
|
123
|
-
#
|
|
124
|
-
#
|
|
131
|
+
# For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
|
132
|
+
# is application, which includes Custom accounts, you can update any information on the account.
|
|
133
|
+
#
|
|
134
|
+
# For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
|
135
|
+
# is stripe, which includes Standard and Express accounts, you can update all information until you create
|
|
136
|
+
# an [Account Link or <a href="/api/account_sessions">Account Session](https://stripe.com/api/account_links) to start Connect onboarding,
|
|
137
|
+
# after which some properties can no longer be updated.
|
|
125
138
|
#
|
|
126
139
|
# To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). Refer to our
|
|
127
140
|
# [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
module Stripe
|
|
5
5
|
# These bank accounts are payment methods on `Customer` objects.
|
|
6
6
|
#
|
|
7
|
-
# On the other hand [External Accounts](https://stripe.com/
|
|
8
|
-
# destinations on `Account` objects for [
|
|
7
|
+
# On the other hand [External Accounts](https://stripe.com/api#external_accounts) are transfer
|
|
8
|
+
# destinations on `Account` objects for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
|
9
|
+
# is `application`, which includes [Custom accounts](https://stripe.com/connect/custom-accounts).
|
|
9
10
|
# They can be bank accounts or debit cards as well, and are documented in the links above.
|
|
10
11
|
#
|
|
11
|
-
# Related guide: [Bank debits and transfers](https://stripe.com/
|
|
12
|
+
# Related guide: [Bank debits and transfers](https://stripe.com/payments/bank-debits-transfers)
|
|
12
13
|
class BankAccount < APIResource
|
|
13
14
|
include Stripe::APIOperations::Delete
|
|
14
15
|
extend Stripe::APIOperations::List
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
module Stripe
|
|
5
5
|
module Billing
|
|
6
|
-
# A billing meter is a resource that allows you to track usage of a particular event. For example, you might create a billing meter to track the number of API calls made by a particular user. You can then
|
|
6
|
+
# A billing meter is a resource that allows you to track usage of a particular event. For example, you might create a billing meter to track the number of API calls made by a particular user. You can then attach the billing meter to a price and attach the price to a subscription to charge the user for the number of API calls they make.
|
|
7
7
|
class Meter < APIResource
|
|
8
8
|
extend Stripe::APIOperations::Create
|
|
9
9
|
extend Stripe::APIOperations::List
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
module Stripe
|
|
5
5
|
module Billing
|
|
6
|
-
# A billing meter event adjustment
|
|
6
|
+
# A billing meter event adjustment is a resource that allows you to cancel a meter event. For example, you might create a billing meter event adjustment to cancel a meter event that was created in error or attached to the wrong customer.
|
|
7
7
|
class MeterEventAdjustment < APIResource
|
|
8
8
|
extend Stripe::APIOperations::Create
|
|
9
9
|
|
|
@@ -23,10 +23,10 @@ module Stripe
|
|
|
23
23
|
# `Event` objects directly to an endpoint on your server. You can manage
|
|
24
24
|
# webhooks in your
|
|
25
25
|
# [account settings](https://dashboard.stripe.com/account/webhooks). Learn how
|
|
26
|
-
# to [listen for events](https://stripe.com/
|
|
26
|
+
# to [listen for events](https://docs.stripe.com/webhooks)
|
|
27
27
|
# so that your integration can automatically trigger reactions.
|
|
28
28
|
#
|
|
29
|
-
# When using [Connect](https://stripe.com/
|
|
29
|
+
# When using [Connect](https://docs.stripe.com/connect), you can also receive event notifications
|
|
30
30
|
# that occur in connected accounts. For these events, there's an
|
|
31
31
|
# additional `account` attribute in the received `Event` object.
|
|
32
32
|
#
|
|
@@ -40,7 +40,7 @@ module Stripe
|
|
|
40
40
|
"event"
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
# List events, going back up to 30 days. Each event data is rendered according to Stripe API version at its creation time, specified in [event object](https://stripe.com/
|
|
43
|
+
# List events, going back up to 30 days. Each event data is rendered according to Stripe API version at its creation time, specified in [event object](https://docs.stripe.com/api/events/object) api_version attribute (not according to your current Stripe API version or Stripe-Version header).
|
|
44
44
|
def self.list(filters = {}, opts = {})
|
|
45
45
|
request_stripe_object(method: :get, path: "/v1/events", params: filters, opts: opts)
|
|
46
46
|
end
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
module Stripe
|
|
5
5
|
module Forwarding
|
|
6
|
-
# Instructs Stripe to make a request on your behalf using the destination URL
|
|
7
|
-
#
|
|
8
|
-
#
|
|
6
|
+
# Instructs Stripe to make a request on your behalf using the destination URL. The destination URL
|
|
7
|
+
# is activated by Stripe at the time of onboarding. Stripe verifies requests with your credentials
|
|
8
|
+
# provided during onboarding, and injects card details from the payment_method into the request.
|
|
9
9
|
#
|
|
10
10
|
# Stripe redacts all sensitive fields and headers, including authentication credentials and card numbers,
|
|
11
11
|
# before storing the request and response data in the forwarding Request object, which are subject to a
|
|
@@ -38,6 +38,7 @@ module Stripe
|
|
|
38
38
|
extend Stripe::APIOperations::Create
|
|
39
39
|
include Stripe::APIOperations::Delete
|
|
40
40
|
extend Stripe::APIOperations::List
|
|
41
|
+
extend Stripe::APIOperations::NestedResource
|
|
41
42
|
extend Stripe::APIOperations::Search
|
|
42
43
|
include Stripe::APIOperations::Save
|
|
43
44
|
|
|
@@ -46,11 +47,29 @@ module Stripe
|
|
|
46
47
|
"invoice"
|
|
47
48
|
end
|
|
48
49
|
|
|
50
|
+
nested_resource_class_methods :line, operations: %i[list]
|
|
51
|
+
|
|
49
52
|
# 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.
|
|
50
53
|
def self.create(params = {}, opts = {})
|
|
51
54
|
request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
|
|
52
55
|
end
|
|
53
56
|
|
|
57
|
+
# At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
|
|
58
|
+
#
|
|
59
|
+
# Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount.
|
|
60
|
+
#
|
|
61
|
+
# You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_details.proration_date parameter when doing the actual subscription update. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_details.proration_date value passed in the request.
|
|
62
|
+
#
|
|
63
|
+
# Note: Currency conversion calculations use the latest exchange rates. Exchange rates may vary between the time of the preview and the time of the actual invoice creation. [Learn more](https://docs.stripe.com/currencies/conversions)
|
|
64
|
+
def self.create_preview(params = {}, opts = {})
|
|
65
|
+
request_stripe_object(
|
|
66
|
+
method: :post,
|
|
67
|
+
path: "/v1/invoices/create_preview",
|
|
68
|
+
params: params,
|
|
69
|
+
opts: opts
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
54
73
|
# Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
|
|
55
74
|
def self.delete(id, params = {}, opts = {})
|
|
56
75
|
request_stripe_object(
|
|
@@ -182,7 +201,9 @@ module Stripe
|
|
|
182
201
|
#
|
|
183
202
|
# Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount.
|
|
184
203
|
#
|
|
185
|
-
# You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the
|
|
204
|
+
# You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_details.proration_date parameter when doing the actual subscription update. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_details.proration_date value passed in the request.
|
|
205
|
+
#
|
|
206
|
+
# Note: Currency conversion calculations use the latest exchange rates. Exchange rates may vary between the time of the preview and the time of the actual invoice creation. [Learn more](https://docs.stripe.com/currencies/conversions)
|
|
186
207
|
def self.upcoming(params = {}, opts = {})
|
|
187
208
|
request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts)
|
|
188
209
|
end
|
|
@@ -9,6 +9,7 @@ module Stripe
|
|
|
9
9
|
#
|
|
10
10
|
# Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations)
|
|
11
11
|
class Authorization < APIResource
|
|
12
|
+
extend Gem::Deprecate
|
|
12
13
|
extend Stripe::APIOperations::List
|
|
13
14
|
include Stripe::APIOperations::Save
|
|
14
15
|
|
|
@@ -27,6 +28,7 @@ module Stripe
|
|
|
27
28
|
opts: opts
|
|
28
29
|
)
|
|
29
30
|
end
|
|
31
|
+
deprecate :approve, :none, 2024, 3
|
|
30
32
|
|
|
31
33
|
# [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
|
|
32
34
|
# This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
|
|
@@ -38,6 +40,10 @@ module Stripe
|
|
|
38
40
|
opts: opts
|
|
39
41
|
)
|
|
40
42
|
end
|
|
43
|
+
class << self
|
|
44
|
+
extend Gem::Deprecate
|
|
45
|
+
deprecate :approve, :none, 2024, 3
|
|
46
|
+
end
|
|
41
47
|
|
|
42
48
|
# [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
|
|
43
49
|
# This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
|
|
@@ -49,6 +55,7 @@ module Stripe
|
|
|
49
55
|
opts: opts
|
|
50
56
|
)
|
|
51
57
|
end
|
|
58
|
+
deprecate :decline, :none, 2024, 3
|
|
52
59
|
|
|
53
60
|
# [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
|
|
54
61
|
# This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
|
|
@@ -60,6 +67,10 @@ module Stripe
|
|
|
60
67
|
opts: opts
|
|
61
68
|
)
|
|
62
69
|
end
|
|
70
|
+
class << self
|
|
71
|
+
extend Gem::Deprecate
|
|
72
|
+
deprecate :decline, :none, 2024, 3
|
|
73
|
+
end
|
|
63
74
|
|
|
64
75
|
# Returns a list of Issuing Authorization objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
|
65
76
|
def self.list(filters = {}, opts = {})
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
module Stripe
|
|
5
|
-
# Login Links are single-use
|
|
5
|
+
# Login Links are single-use URLs for a connected account to access the Express Dashboard. The connected account's [account.controller.stripe_dashboard.type](https://stripe.com/api/accounts/object#account_object-controller-stripe_dashboard-type) must be `express` to have access to the Express Dashboard.
|
|
6
6
|
class LoginLink < APIResource
|
|
7
7
|
OBJECT_NAME = "login_link"
|
|
8
8
|
def self.object_name
|
|
@@ -4,10 +4,9 @@
|
|
|
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
|
|
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
|
-
#
|
|
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
11
|
include Stripe::APIOperations::Save
|
|
13
12
|
|
|
@@ -14,7 +14,7 @@ module Stripe
|
|
|
14
14
|
# transfer only if the destination account has enough balance to cover the
|
|
15
15
|
# reversal.
|
|
16
16
|
#
|
|
17
|
-
# Related guide: [
|
|
17
|
+
# Related guide: [Reverse transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#reverse-transfers)
|
|
18
18
|
class Reversal < APIResource
|
|
19
19
|
include Stripe::APIOperations::Save
|
|
20
20
|
|
|
@@ -8,13 +8,13 @@ module Stripe
|
|
|
8
8
|
#
|
|
9
9
|
# Create a SetupIntent when you're ready to collect your customer's payment credentials.
|
|
10
10
|
# Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid.
|
|
11
|
-
# The SetupIntent transitions through multiple [statuses](https://stripe.com/
|
|
11
|
+
# The SetupIntent transitions through multiple [statuses](https://docs.stripe.com/payments/intents#intent-statuses) as it guides
|
|
12
12
|
# you through the setup process.
|
|
13
13
|
#
|
|
14
14
|
# Successful SetupIntents result in payment credentials that are optimized for future payments.
|
|
15
15
|
# For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) might need to be run through
|
|
16
|
-
# [Strong Customer Authentication](https://stripe.com/
|
|
17
|
-
# to streamline later [off-session payments](https://stripe.com/
|
|
16
|
+
# [Strong Customer Authentication](https://docs.stripe.com/strong-customer-authentication) during payment method collection
|
|
17
|
+
# to streamline later [off-session payments](https://docs.stripe.com/payments/setup-intents).
|
|
18
18
|
# If you use the SetupIntent with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer),
|
|
19
19
|
# it automatically attaches the resulting payment method to that Customer after successful setup.
|
|
20
20
|
# We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on
|
|
@@ -22,7 +22,7 @@ module Stripe
|
|
|
22
22
|
#
|
|
23
23
|
# By using SetupIntents, you can reduce friction for your customers, even as regulations change over time.
|
|
24
24
|
#
|
|
25
|
-
# Related guide: [Setup Intents API](https://stripe.com/
|
|
25
|
+
# Related guide: [Setup Intents API](https://docs.stripe.com/payments/setup-intents)
|
|
26
26
|
class SetupIntent < APIResource
|
|
27
27
|
extend Stripe::APIOperations::Create
|
|
28
28
|
extend Stripe::APIOperations::List
|
|
@@ -19,7 +19,7 @@ module Stripe
|
|
|
19
19
|
#
|
|
20
20
|
# You can't store or use tokens more than once. To store card or bank account
|
|
21
21
|
# information for later use, create [Customer](https://stripe.com/docs/api#customers)
|
|
22
|
-
# objects or [
|
|
22
|
+
# objects or [External accounts](https://stripe.com/api#external_accounts).
|
|
23
23
|
# [Radar](https://stripe.com/docs/radar), our integrated solution for automatic fraud protection,
|
|
24
24
|
# performs best with integrations that use client-side tokenization.
|
|
25
25
|
class Token < APIResource
|
|
@@ -31,7 +31,7 @@ module Stripe
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
# Creates a single-use token that represents a bank account's details.
|
|
34
|
-
# You can use this token with any API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a [
|
|
34
|
+
# You can use this token with any API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a [connected account](https://stripe.com/docs/api#accounts) where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is application, which includes Custom accounts.
|
|
35
35
|
def self.create(params = {}, opts = {})
|
|
36
36
|
request_stripe_object(method: :post, path: "/v1/tokens", params: params, opts: opts)
|
|
37
37
|
end
|
|
@@ -124,6 +124,26 @@ module Stripe
|
|
|
124
124
|
opts: opts
|
|
125
125
|
)
|
|
126
126
|
end
|
|
127
|
+
|
|
128
|
+
# Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
|
129
|
+
def self.update(id, params = {}, opts = {})
|
|
130
|
+
request_stripe_object(
|
|
131
|
+
method: :post,
|
|
132
|
+
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s", { id: CGI.escape(id) }),
|
|
133
|
+
params: params,
|
|
134
|
+
opts: opts
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
|
139
|
+
def update(params = {}, opts = {})
|
|
140
|
+
@resource.request_stripe_object(
|
|
141
|
+
method: :post,
|
|
142
|
+
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s", { id: CGI.escape(@resource["id"]) }),
|
|
143
|
+
params: params,
|
|
144
|
+
opts: opts
|
|
145
|
+
)
|
|
146
|
+
end
|
|
127
147
|
end
|
|
128
148
|
end
|
|
129
149
|
end
|
|
@@ -124,6 +124,26 @@ module Stripe
|
|
|
124
124
|
opts: opts
|
|
125
125
|
)
|
|
126
126
|
end
|
|
127
|
+
|
|
128
|
+
# Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
|
129
|
+
def self.update(outbound_transfer, params = {}, opts = {})
|
|
130
|
+
request_stripe_object(
|
|
131
|
+
method: :post,
|
|
132
|
+
path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(outbound_transfer) }),
|
|
133
|
+
params: params,
|
|
134
|
+
opts: opts
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
|
139
|
+
def update(params = {}, opts = {})
|
|
140
|
+
@resource.request_stripe_object(
|
|
141
|
+
method: :post,
|
|
142
|
+
path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(@resource["id"]) }),
|
|
143
|
+
params: params,
|
|
144
|
+
opts: opts
|
|
145
|
+
)
|
|
146
|
+
end
|
|
127
147
|
end
|
|
128
148
|
end
|
|
129
149
|
end
|
|
@@ -6,6 +6,8 @@ module Stripe
|
|
|
6
6
|
# metered billing of subscription prices.
|
|
7
7
|
#
|
|
8
8
|
# Related guide: [Metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing)
|
|
9
|
+
#
|
|
10
|
+
# This is our legacy usage-based billing API. See the [updated usage-based billing docs](https://docs.stripe.com/billing/subscriptions/usage-based).
|
|
9
11
|
class UsageRecord < APIResource
|
|
10
12
|
OBJECT_NAME = "usage_record"
|
|
11
13
|
def self.object_name
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
module Stripe
|
|
5
|
-
# You can configure [webhook endpoints](https://stripe.com/
|
|
5
|
+
# You can configure [webhook endpoints](https://docs.stripe.com/webhooks/) via the API to be
|
|
6
6
|
# notified about events that happen in your Stripe account or connected
|
|
7
7
|
# accounts.
|
|
8
8
|
#
|
|
9
9
|
# Most users configure webhooks from [the dashboard](https://dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.
|
|
10
10
|
#
|
|
11
|
-
# Related guide: [Setting up webhooks](https://stripe.com/
|
|
11
|
+
# Related guide: [Setting up webhooks](https://docs.stripe.com/webhooks/configure)
|
|
12
12
|
class WebhookEndpoint < APIResource
|
|
13
13
|
extend Stripe::APIOperations::Create
|
|
14
14
|
include Stripe::APIOperations::Delete
|
data/lib/stripe/stripe_client.rb
CHANGED
|
@@ -18,6 +18,11 @@ module Stripe
|
|
|
18
18
|
@system_profiler = SystemProfiler.new
|
|
19
19
|
@last_request_metrics = nil
|
|
20
20
|
|
|
21
|
+
# The following attribute is only used to log whether or not
|
|
22
|
+
# StripeClient#request has been called. To be removed in a
|
|
23
|
+
# future major version.
|
|
24
|
+
@usage = []
|
|
25
|
+
|
|
21
26
|
@config = case config_arg
|
|
22
27
|
when Hash
|
|
23
28
|
Stripe.config.reverse_duplicate_merge(config_arg)
|
|
@@ -110,7 +115,7 @@ module Stripe
|
|
|
110
115
|
# both socket errors that may represent an intermittent problem and some
|
|
111
116
|
# special HTTP statuses.
|
|
112
117
|
def self.should_retry?(error,
|
|
113
|
-
|
|
118
|
+
num_retries:, config: Stripe.config)
|
|
114
119
|
return false if num_retries >= config.max_network_retries
|
|
115
120
|
|
|
116
121
|
case error
|
|
@@ -143,15 +148,12 @@ module Stripe
|
|
|
143
148
|
# These 429s are safe to retry.
|
|
144
149
|
return true if error.http_status == 429 && error.code == "lock_timeout"
|
|
145
150
|
|
|
146
|
-
# 500
|
|
151
|
+
# Retry on 500, 503, and other internal errors.
|
|
147
152
|
#
|
|
148
|
-
#
|
|
149
|
-
#
|
|
150
|
-
#
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
# 503 Service Unavailable
|
|
154
|
-
error.http_status == 503
|
|
153
|
+
# Note that we expect the stripe-should-retry header to be false
|
|
154
|
+
# in most cases when a 500 is returned, since our idempotency framework
|
|
155
|
+
# would typically replay it anyway.
|
|
156
|
+
true if error.http_status >= 500
|
|
155
157
|
else
|
|
156
158
|
false
|
|
157
159
|
end
|
|
@@ -188,7 +190,9 @@ module Stripe
|
|
|
188
190
|
# client = StripeClient.new
|
|
189
191
|
# charge, resp = client.request { Charge.create }
|
|
190
192
|
#
|
|
193
|
+
|
|
191
194
|
def request
|
|
195
|
+
@usage = ["stripe_client_request"]
|
|
192
196
|
old_stripe_client = self.class.current_thread_context.active_client
|
|
193
197
|
self.class.current_thread_context.active_client = self
|
|
194
198
|
|
|
@@ -203,10 +207,14 @@ module Stripe
|
|
|
203
207
|
res = yield
|
|
204
208
|
[res, self.class.current_thread_context.last_responses[object_id]]
|
|
205
209
|
ensure
|
|
210
|
+
@usage = []
|
|
206
211
|
self.class.current_thread_context.active_client = old_stripe_client
|
|
207
212
|
self.class.current_thread_context.last_responses.delete(object_id)
|
|
208
213
|
end
|
|
209
214
|
end
|
|
215
|
+
deprecate :request, "the `last_response` property on the returned resource (see " \
|
|
216
|
+
"https://github.com/stripe/stripe-ruby?tab=readme-ov-file#accessing-a-response-object " \
|
|
217
|
+
"for usage examples)", 2024, 6
|
|
210
218
|
|
|
211
219
|
def execute_request(method, path,
|
|
212
220
|
api_base: nil, api_key: nil, headers: {}, params: {}, usage: [])
|
|
@@ -490,7 +498,7 @@ module Stripe
|
|
|
490
498
|
end
|
|
491
499
|
|
|
492
500
|
http_resp =
|
|
493
|
-
execute_request_with_rescues(
|
|
501
|
+
execute_request_with_rescues(api_base, headers, usage, context) do
|
|
494
502
|
self.class
|
|
495
503
|
.default_connection_manager(config)
|
|
496
504
|
.execute_request(method, url,
|
|
@@ -560,7 +568,7 @@ module Stripe
|
|
|
560
568
|
http_status >= 400
|
|
561
569
|
end
|
|
562
570
|
|
|
563
|
-
private def execute_request_with_rescues(
|
|
571
|
+
private def execute_request_with_rescues(api_base, headers, usage, context)
|
|
564
572
|
num_retries = 0
|
|
565
573
|
|
|
566
574
|
begin
|
|
@@ -586,7 +594,7 @@ module Stripe
|
|
|
586
594
|
if config.enable_telemetry? && context.request_id
|
|
587
595
|
request_duration_ms = (request_duration * 1000).to_i
|
|
588
596
|
@last_request_metrics =
|
|
589
|
-
StripeRequestMetrics.new(context.request_id, request_duration_ms, usage: usage)
|
|
597
|
+
StripeRequestMetrics.new(context.request_id, request_duration_ms, usage: usage + @usage)
|
|
590
598
|
end
|
|
591
599
|
|
|
592
600
|
# We rescue all exceptions from a request so that we have an easy spot to
|
|
@@ -611,7 +619,6 @@ module Stripe
|
|
|
611
619
|
user_data, resp, headers)
|
|
612
620
|
|
|
613
621
|
if self.class.should_retry?(e,
|
|
614
|
-
method: method,
|
|
615
622
|
num_retries: num_retries,
|
|
616
623
|
config: config)
|
|
617
624
|
num_retries += 1
|
data/lib/stripe/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stripe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 11.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-06-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Stripe is the easiest way to accept payments online. See https://stripe.com
|
|
14
14
|
for details.
|
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
216
216
|
- !ruby/object:Gem::Version
|
|
217
217
|
version: '0'
|
|
218
218
|
requirements: []
|
|
219
|
-
rubygems_version: 3.3.
|
|
219
|
+
rubygems_version: 3.3.27
|
|
220
220
|
signing_key:
|
|
221
221
|
specification_version: 4
|
|
222
222
|
summary: Ruby bindings for the Stripe API
|