dodopayments 1.47.0 → 1.51.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 +24 -0
- data/README.md +17 -51
- data/lib/dodopayments/client.rb +4 -4
- data/lib/dodopayments/internal/transport/base_client.rb +1 -4
- data/lib/dodopayments/internal/transport/pooled_net_requester.rb +1 -9
- data/lib/dodopayments/internal/type/base_model.rb +6 -11
- data/lib/dodopayments/internal/util.rb +1 -1
- data/lib/dodopayments/models/checkout_session_create_params.rb +14 -0
- data/lib/dodopayments/models/checkout_session_request.rb +347 -0
- data/lib/dodopayments/models/checkout_session_response.rb +25 -0
- data/lib/dodopayments/models/on_demand_subscription.rb +58 -0
- data/lib/dodopayments/models/payment_create_params.rb +1 -4
- data/lib/dodopayments/models/subscription.rb +9 -1
- data/lib/dodopayments/models/subscription_create_params.rb +3 -56
- data/lib/dodopayments/models/subscription_update_params.rb +16 -2
- data/lib/dodopayments/models/webhook_create_params.rb +6 -9
- data/lib/dodopayments/models/{webhook_create_response.rb → webhook_details.rb} +2 -2
- data/lib/dodopayments/models/webhook_retrieve_secret_params.rb +14 -0
- data/lib/dodopayments/models/webhook_retrieve_secret_response.rb +16 -0
- data/lib/dodopayments/models.rb +12 -2
- data/lib/dodopayments/resources/checkout_sessions.rb +61 -0
- data/lib/dodopayments/resources/subscriptions.rb +5 -3
- data/lib/dodopayments/resources/webhooks.rb +29 -10
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +9 -7
- data/rbi/dodopayments/client.rbi +3 -3
- data/rbi/dodopayments/errors.rbi +2 -2
- data/rbi/dodopayments/models/checkout_session_create_params.rbi +32 -0
- data/rbi/dodopayments/models/checkout_session_request.rbi +652 -0
- data/rbi/dodopayments/models/checkout_session_response.rbi +40 -0
- data/rbi/dodopayments/models/dispute.rbi +4 -4
- data/rbi/dodopayments/models/get_dispute.rbi +4 -4
- data/rbi/dodopayments/models/license_key.rbi +2 -2
- data/rbi/dodopayments/models/on_demand_subscription.rbi +86 -0
- data/rbi/dodopayments/models/payment.rbi +8 -8
- data/rbi/dodopayments/models/refund.rbi +4 -4
- data/rbi/dodopayments/models/subscription.rbi +21 -11
- data/rbi/dodopayments/models/subscription_create_params.rbi +4 -90
- data/rbi/dodopayments/models/subscription_update_params.rbi +8 -0
- data/rbi/dodopayments/models/webhook_create_params.rbi +6 -6
- data/rbi/dodopayments/models/{webhook_list_response.rbi → webhook_details.rbi} +2 -5
- data/rbi/dodopayments/models/webhook_retrieve_secret_params.rbi +32 -0
- data/rbi/dodopayments/models/webhook_retrieve_secret_response.rbi +26 -0
- data/rbi/dodopayments/models.rbi +14 -2
- data/rbi/dodopayments/resources/checkout_sessions.rbi +80 -0
- data/rbi/dodopayments/resources/subscriptions.rbi +4 -2
- data/rbi/dodopayments/resources/webhooks.rbi +17 -7
- data/sig/dodopayments/client.rbs +2 -2
- data/sig/dodopayments/models/checkout_session_create_params.rbs +15 -0
- data/sig/dodopayments/models/checkout_session_request.rbs +277 -0
- data/sig/dodopayments/models/checkout_session_response.rbs +16 -0
- data/sig/dodopayments/models/on_demand_subscription.rbs +40 -0
- data/sig/dodopayments/models/subscription.rbs +8 -3
- data/sig/dodopayments/models/subscription_create_params.rbs +4 -41
- data/sig/dodopayments/models/subscription_update_params.rbs +5 -0
- data/sig/dodopayments/models/{webhook_list_response.rbs → webhook_details.rbs} +2 -2
- data/sig/dodopayments/models/webhook_retrieve_secret_params.rbs +15 -0
- data/sig/dodopayments/models/webhook_retrieve_secret_response.rbs +13 -0
- data/sig/dodopayments/models.rbs +12 -2
- data/sig/dodopayments/resources/checkout_sessions.rbs +24 -0
- data/sig/dodopayments/resources/subscriptions.rbs +2 -1
- data/sig/dodopayments/resources/webhooks.rbs +9 -4
- metadata +26 -20
- data/lib/dodopayments/models/webhook_list_response.rb +0 -88
- data/lib/dodopayments/models/webhook_retrieve_response.rb +0 -88
- data/lib/dodopayments/models/webhook_update_response.rb +0 -88
- data/lib/dodopayments/models/your_webhook_url_create_params.rb +0 -32
- data/lib/dodopayments/resources/your_webhook_url.rb +0 -56
- data/rbi/dodopayments/models/webhook_create_response.rbi +0 -112
- data/rbi/dodopayments/models/webhook_retrieve_response.rbi +0 -112
- data/rbi/dodopayments/models/webhook_update_response.rbi +0 -112
- data/rbi/dodopayments/models/your_webhook_url_create_params.rbi +0 -56
- data/rbi/dodopayments/resources/your_webhook_url.rbi +0 -51
- data/sig/dodopayments/models/webhook_create_response.rbs +0 -60
- data/sig/dodopayments/models/webhook_retrieve_response.rbs +0 -60
- data/sig/dodopayments/models/webhook_update_response.rbs +0 -60
- data/sig/dodopayments/models/your_webhook_url_create_params.rbs +0 -42
- data/sig/dodopayments/resources/your_webhook_url.rbs +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27b3f4907ed54bf17daf2d0d0b698348ccb9a185922dc5b53238e2a0ecb34ac3
|
4
|
+
data.tar.gz: a422263192ffa157e37b623c4091e0547b73af221444f82845206c6129d16bfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6931eea775b0bb4a8ca4cdd9cadbc435cfa749807a658eb62b46d18d610d70bfa8a030d11d01eb87a70ffb97ee2ada7e792722c57e62b2bc49c101805fd0843
|
7
|
+
data.tar.gz: 73cb30d62ed8ebf413366dc102e691603733adf2f1aedd5207e64790e5195920a82f80be81ec958ce99ebe9ff701ddbb0c21f779e94a58c4c6a82291778ea4d3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.51.0 (2025-08-22)
|
4
|
+
|
5
|
+
Full Changelog: [v1.49.0...v1.51.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.49.0...v1.51.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** updated example ([69716fa](https://github.com/dodopayments/dodopayments-ruby/commit/69716fa0a72aed7d3b725fbe8ec395a0174c992e))
|
10
|
+
* **api:** updated openapi spec to v1.51.0 and added checkout sessions ([5704e81](https://github.com/dodopayments/dodopayments-ruby/commit/5704e81025036b184d5fec8a9958fcd07ed11a3d))
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* bump sorbet version and fix new type errors from the breaking change ([16a3d4d](https://github.com/dodopayments/dodopayments-ruby/commit/16a3d4d2aea39fd0b8b4fef79b5abb8ac5e5a7d6))
|
16
|
+
|
17
|
+
## 1.49.0 (2025-08-13)
|
18
|
+
|
19
|
+
Full Changelog: [v1.47.0...v1.49.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.47.0...v1.49.0)
|
20
|
+
|
21
|
+
### Features
|
22
|
+
|
23
|
+
* **api:** manual updates ([f9127c5](https://github.com/dodopayments/dodopayments-ruby/commit/f9127c578fca2e4304bcf47a394f9fa8b778f4a3))
|
24
|
+
* **api:** manual updates ([84efbc4](https://github.com/dodopayments/dodopayments-ruby/commit/84efbc4d2c7daceafb7db5232283025e0711908b))
|
25
|
+
* **api:** updated code for v1.49.0 ([9290571](https://github.com/dodopayments/dodopayments-ruby/commit/9290571193e4a5dee306b847d2a007529f46cd50))
|
26
|
+
|
3
27
|
## 1.47.0 (2025-08-13)
|
4
28
|
|
5
29
|
Full Changelog: [v1.22.0...v1.47.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.22.0...v1.47.0)
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
17
17
|
<!-- x-release-please-start-version -->
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
gem "dodopayments", "~> 1.
|
20
|
+
gem "dodopayments", "~> 1.51.0"
|
21
21
|
```
|
22
22
|
|
23
23
|
<!-- x-release-please-end -->
|
@@ -33,13 +33,9 @@ dodo_payments = Dodopayments::Client.new(
|
|
33
33
|
environment: "test_mode" # defaults to "live_mode"
|
34
34
|
)
|
35
35
|
|
36
|
-
|
37
|
-
billing: {city: "city", country: "AF", state: "state", street: "street", zipcode: "zipcode"},
|
38
|
-
customer: {customer_id: "customer_id"},
|
39
|
-
product_cart: [{product_id: "product_id", quantity: 0}]
|
40
|
-
)
|
36
|
+
checkout_session_response = dodo_payments.checkout_sessions.create(product_cart: [{product_id: "product_id", quantity: 0}])
|
41
37
|
|
42
|
-
puts(
|
38
|
+
puts(checkout_session_response.session_id)
|
43
39
|
```
|
44
40
|
|
45
41
|
### Pagination
|
@@ -76,11 +72,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
|
|
76
72
|
|
77
73
|
```ruby
|
78
74
|
begin
|
79
|
-
|
80
|
-
billing: {city: "city", country: "AF", state: "state", street: "street", zipcode: "zipcode"},
|
81
|
-
customer: {customer_id: "customer_id"},
|
82
|
-
product_cart: [{product_id: "product_id", quantity: 0}]
|
83
|
-
)
|
75
|
+
checkout_session = dodo_payments.checkout_sessions.create(product_cart: [{product_id: "product_id", quantity: 0}])
|
84
76
|
rescue Dodopayments::Errors::APIConnectionError => e
|
85
77
|
puts("The server could not be reached")
|
86
78
|
puts(e.cause) # an underlying Exception, likely raised within `net/http`
|
@@ -123,9 +115,7 @@ dodo_payments = Dodopayments::Client.new(
|
|
123
115
|
)
|
124
116
|
|
125
117
|
# Or, configure per-request:
|
126
|
-
dodo_payments.
|
127
|
-
billing: {city: "city", country: "AF", state: "state", street: "street", zipcode: "zipcode"},
|
128
|
-
customer: {customer_id: "customer_id"},
|
118
|
+
dodo_payments.checkout_sessions.create(
|
129
119
|
product_cart: [{product_id: "product_id", quantity: 0}],
|
130
120
|
request_options: {max_retries: 5}
|
131
121
|
)
|
@@ -142,9 +132,7 @@ dodo_payments = Dodopayments::Client.new(
|
|
142
132
|
)
|
143
133
|
|
144
134
|
# Or, configure per-request:
|
145
|
-
dodo_payments.
|
146
|
-
billing: {city: "city", country: "AF", state: "state", street: "street", zipcode: "zipcode"},
|
147
|
-
customer: {customer_id: "customer_id"},
|
135
|
+
dodo_payments.checkout_sessions.create(
|
148
136
|
product_cart: [{product_id: "product_id", quantity: 0}],
|
149
137
|
request_options: {timeout: 5}
|
150
138
|
)
|
@@ -177,10 +165,8 @@ You can send undocumented parameters to any endpoint, and read undocumented resp
|
|
177
165
|
Note: the `extra_` parameters of the same name overrides the documented parameters.
|
178
166
|
|
179
167
|
```ruby
|
180
|
-
|
181
|
-
dodo_payments.
|
182
|
-
billing: {city: "city", country: "AF", state: "state", street: "street", zipcode: "zipcode"},
|
183
|
-
customer: {customer_id: "customer_id"},
|
168
|
+
checkout_session_response =
|
169
|
+
dodo_payments.checkout_sessions.create(
|
184
170
|
product_cart: [{product_id: "product_id", quantity: 0}],
|
185
171
|
request_options: {
|
186
172
|
extra_query: {my_query_parameter: value},
|
@@ -189,7 +175,7 @@ payment =
|
|
189
175
|
}
|
190
176
|
)
|
191
177
|
|
192
|
-
puts(
|
178
|
+
puts(checkout_session_response[:my_undocumented_property])
|
193
179
|
```
|
194
180
|
|
195
181
|
#### Undocumented request params
|
@@ -227,16 +213,8 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
|
|
227
213
|
You can provide typesafe request parameters like so:
|
228
214
|
|
229
215
|
```ruby
|
230
|
-
dodo_payments.
|
231
|
-
|
232
|
-
city: "city",
|
233
|
-
country: "AF",
|
234
|
-
state: "state",
|
235
|
-
street: "street",
|
236
|
-
zipcode: "zipcode"
|
237
|
-
),
|
238
|
-
customer: Dodopayments::AttachExistingCustomer.new(customer_id: "customer_id"),
|
239
|
-
product_cart: [Dodopayments::OneTimeProductCartItem.new(product_id: "product_id", quantity: 0)]
|
216
|
+
dodo_payments.checkout_sessions.create(
|
217
|
+
product_cart: [Dodopayments::CheckoutSessionRequest::ProductCart.new(product_id: "product_id", quantity: 0)]
|
240
218
|
)
|
241
219
|
```
|
242
220
|
|
@@ -244,25 +222,13 @@ Or, equivalently:
|
|
244
222
|
|
245
223
|
```ruby
|
246
224
|
# Hashes work, but are not typesafe:
|
247
|
-
dodo_payments.
|
248
|
-
billing: {city: "city", country: "AF", state: "state", street: "street", zipcode: "zipcode"},
|
249
|
-
customer: {customer_id: "customer_id"},
|
250
|
-
product_cart: [{product_id: "product_id", quantity: 0}]
|
251
|
-
)
|
225
|
+
dodo_payments.checkout_sessions.create(product_cart: [{product_id: "product_id", quantity: 0}])
|
252
226
|
|
253
227
|
# You can also splat a full Params class:
|
254
|
-
params = Dodopayments::
|
255
|
-
|
256
|
-
city: "city",
|
257
|
-
country: "AF",
|
258
|
-
state: "state",
|
259
|
-
street: "street",
|
260
|
-
zipcode: "zipcode"
|
261
|
-
),
|
262
|
-
customer: Dodopayments::AttachExistingCustomer.new(customer_id: "customer_id"),
|
263
|
-
product_cart: [Dodopayments::OneTimeProductCartItem.new(product_id: "product_id", quantity: 0)]
|
228
|
+
params = Dodopayments::CheckoutSessionCreateParams.new(
|
229
|
+
product_cart: [Dodopayments::CheckoutSessionRequest::ProductCart.new(product_id: "product_id", quantity: 0)]
|
264
230
|
)
|
265
|
-
dodo_payments.
|
231
|
+
dodo_payments.checkout_sessions.create(**params)
|
266
232
|
```
|
267
233
|
|
268
234
|
### Enums
|
@@ -281,13 +247,13 @@ Enum parameters have a "relaxed" type, so you can either pass in enum constants
|
|
281
247
|
|
282
248
|
```ruby
|
283
249
|
# Using the enum constants preserves the tagged type information:
|
284
|
-
dodo_payments.
|
250
|
+
dodo_payments.checkout_sessions.create(
|
285
251
|
billing_currency: Dodopayments::Currency::AED,
|
286
252
|
# …
|
287
253
|
)
|
288
254
|
|
289
255
|
# Literal values are also permissible:
|
290
|
-
dodo_payments.
|
256
|
+
dodo_payments.checkout_sessions.create(
|
291
257
|
billing_currency: :AED,
|
292
258
|
# …
|
293
259
|
)
|
data/lib/dodopayments/client.rb
CHANGED
@@ -24,6 +24,9 @@ module Dodopayments
|
|
24
24
|
# @return [String]
|
25
25
|
attr_reader :bearer_token
|
26
26
|
|
27
|
+
# @return [Dodopayments::Resources::CheckoutSessions]
|
28
|
+
attr_reader :checkout_sessions
|
29
|
+
|
27
30
|
# @return [Dodopayments::Resources::Payments]
|
28
31
|
attr_reader :payments
|
29
32
|
|
@@ -75,9 +78,6 @@ module Dodopayments
|
|
75
78
|
# @return [Dodopayments::Resources::Webhooks]
|
76
79
|
attr_reader :webhooks
|
77
80
|
|
78
|
-
# @return [Dodopayments::Resources::YourWebhookURL]
|
79
|
-
attr_reader :your_webhook_url
|
80
|
-
|
81
81
|
# @api private
|
82
82
|
#
|
83
83
|
# @return [Hash{String=>String}]
|
@@ -136,6 +136,7 @@ module Dodopayments
|
|
136
136
|
max_retry_delay: max_retry_delay
|
137
137
|
)
|
138
138
|
|
139
|
+
@checkout_sessions = Dodopayments::Resources::CheckoutSessions.new(client: self)
|
139
140
|
@payments = Dodopayments::Resources::Payments.new(client: self)
|
140
141
|
@subscriptions = Dodopayments::Resources::Subscriptions.new(client: self)
|
141
142
|
@invoices = Dodopayments::Resources::Invoices.new(client: self)
|
@@ -153,7 +154,6 @@ module Dodopayments
|
|
153
154
|
@addons = Dodopayments::Resources::Addons.new(client: self)
|
154
155
|
@brands = Dodopayments::Resources::Brands.new(client: self)
|
155
156
|
@webhooks = Dodopayments::Resources::Webhooks.new(client: self)
|
156
|
-
@your_webhook_url = Dodopayments::Resources::YourWebhookURL.new(client: self)
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|
@@ -367,10 +367,7 @@ module Dodopayments
|
|
367
367
|
# @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
|
368
368
|
def send_request(request, redirect_count:, retry_count:, send_retry_header:)
|
369
369
|
url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
|
370
|
-
input = {
|
371
|
-
**request.except(:timeout),
|
372
|
-
deadline: Dodopayments::Internal::Util.monotonic_secs + timeout
|
373
|
-
}
|
370
|
+
input = {**request.except(:timeout), deadline: Dodopayments::Internal::Util.monotonic_secs + timeout}
|
374
371
|
|
375
372
|
if send_retry_header
|
376
373
|
headers["x-stainless-retry-count"] = retry_count.to_s
|
@@ -193,15 +193,7 @@ module Dodopayments
|
|
193
193
|
end
|
194
194
|
|
195
195
|
define_sorbet_constant!(:Request) do
|
196
|
-
T.type_alias
|
197
|
-
{
|
198
|
-
method: Symbol,
|
199
|
-
url: URI::Generic,
|
200
|
-
headers: T::Hash[String, String],
|
201
|
-
body: T.anything,
|
202
|
-
deadline: Float
|
203
|
-
}
|
204
|
-
end
|
196
|
+
T.type_alias { {method: Symbol, url: URI::Generic, headers: T::Hash[String, String], body: T.anything, deadline: Float} }
|
205
197
|
end
|
206
198
|
end
|
207
199
|
end
|
@@ -64,14 +64,7 @@ module Dodopayments
|
|
64
64
|
setter = :"#{name_sym}="
|
65
65
|
api_name = info.fetch(:api_name, name_sym)
|
66
66
|
nilable = info.fetch(:nil?, false)
|
67
|
-
const =
|
68
|
-
info.fetch(
|
69
|
-
:const,
|
70
|
-
Dodopayments::Internal::OMIT
|
71
|
-
)
|
72
|
-
else
|
73
|
-
Dodopayments::Internal::OMIT
|
74
|
-
end
|
67
|
+
const = required && !nilable ? info.fetch(:const, Dodopayments::Internal::OMIT) : Dodopayments::Internal::OMIT
|
75
68
|
|
76
69
|
[name_sym, setter].each { undef_method(_1) } if known_fields.key?(name_sym)
|
77
70
|
|
@@ -445,9 +438,11 @@ module Dodopayments
|
|
445
438
|
# @return [Hash{Symbol=>Object}]
|
446
439
|
#
|
447
440
|
# @example
|
448
|
-
# # `
|
449
|
-
#
|
450
|
-
#
|
441
|
+
# # `checkout_session_request` is a `Dodopayments::CheckoutSessionRequest`
|
442
|
+
# checkout_session_request => {
|
443
|
+
# product_cart: product_cart,
|
444
|
+
# allowed_payment_method_types: allowed_payment_method_types,
|
445
|
+
# billing_address: billing_address
|
451
446
|
# }
|
452
447
|
def deconstruct_keys(keys)
|
453
448
|
(keys || self.class.known_fields.keys)
|
@@ -244,7 +244,7 @@ module Dodopayments
|
|
244
244
|
#
|
245
245
|
# @return [String]
|
246
246
|
def uri_origin(uri)
|
247
|
-
"#{uri.scheme}://#{uri.host}#{uri.port
|
247
|
+
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
|
248
248
|
end
|
249
249
|
|
250
250
|
# @api private
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::CheckoutSessions#create
|
6
|
+
class CheckoutSessionCreateParams < Dodopayments::Models::CheckoutSessionRequest
|
7
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
8
|
+
include Dodopayments::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!method initialize(request_options: {})
|
11
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,347 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
class CheckoutSessionRequest < Dodopayments::Internal::Type::BaseModel
|
6
|
+
# @!attribute product_cart
|
7
|
+
#
|
8
|
+
# @return [Array<Dodopayments::Models::CheckoutSessionRequest::ProductCart>]
|
9
|
+
required :product_cart,
|
10
|
+
-> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::CheckoutSessionRequest::ProductCart] }
|
11
|
+
|
12
|
+
# @!attribute allowed_payment_method_types
|
13
|
+
# Customers will never see payment methods that are not in this list. However,
|
14
|
+
# adding a method here does not guarantee customers will see it. Availability
|
15
|
+
# still depends on other factors (e.g., customer location, merchant settings).
|
16
|
+
#
|
17
|
+
# Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment
|
18
|
+
# methods are unavailable, checkout session will fail.
|
19
|
+
#
|
20
|
+
# @return [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil]
|
21
|
+
optional :allowed_payment_method_types,
|
22
|
+
-> { Dodopayments::Internal::Type::ArrayOf[enum: Dodopayments::PaymentMethodTypes] },
|
23
|
+
nil?: true
|
24
|
+
|
25
|
+
# @!attribute billing_address
|
26
|
+
# Billing address information for the session
|
27
|
+
#
|
28
|
+
# @return [Dodopayments::Models::CheckoutSessionRequest::BillingAddress, nil]
|
29
|
+
optional :billing_address, -> { Dodopayments::CheckoutSessionRequest::BillingAddress }, nil?: true
|
30
|
+
|
31
|
+
# @!attribute billing_currency
|
32
|
+
# This field is ingored if adaptive pricing is disabled
|
33
|
+
#
|
34
|
+
# @return [Symbol, Dodopayments::Models::Currency, nil]
|
35
|
+
optional :billing_currency, enum: -> { Dodopayments::Currency }, nil?: true
|
36
|
+
|
37
|
+
# @!attribute confirm
|
38
|
+
# If confirm is true, all the details will be finalized. If required data is
|
39
|
+
# missing, an API error is thrown.
|
40
|
+
#
|
41
|
+
# @return [Boolean, nil]
|
42
|
+
optional :confirm, Dodopayments::Internal::Type::Boolean
|
43
|
+
|
44
|
+
# @!attribute customer
|
45
|
+
# Customer details for the session
|
46
|
+
#
|
47
|
+
# @return [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::NewCustomer, nil]
|
48
|
+
optional :customer, union: -> { Dodopayments::CustomerRequest }, nil?: true
|
49
|
+
|
50
|
+
# @!attribute customization
|
51
|
+
# Customization for the checkout session page
|
52
|
+
#
|
53
|
+
# @return [Dodopayments::Models::CheckoutSessionRequest::Customization, nil]
|
54
|
+
optional :customization, -> { Dodopayments::CheckoutSessionRequest::Customization }
|
55
|
+
|
56
|
+
# @!attribute discount_code
|
57
|
+
#
|
58
|
+
# @return [String, nil]
|
59
|
+
optional :discount_code, String, nil?: true
|
60
|
+
|
61
|
+
# @!attribute feature_flags
|
62
|
+
#
|
63
|
+
# @return [Dodopayments::Models::CheckoutSessionRequest::FeatureFlags, nil]
|
64
|
+
optional :feature_flags, -> { Dodopayments::CheckoutSessionRequest::FeatureFlags }
|
65
|
+
|
66
|
+
# @!attribute metadata
|
67
|
+
# Additional metadata associated with the payment. Defaults to empty if not
|
68
|
+
# provided.
|
69
|
+
#
|
70
|
+
# @return [Hash{Symbol=>String}, nil]
|
71
|
+
optional :metadata, Dodopayments::Internal::Type::HashOf[String], nil?: true
|
72
|
+
|
73
|
+
# @!attribute return_url
|
74
|
+
# The url to redirect after payment failure or success.
|
75
|
+
#
|
76
|
+
# @return [String, nil]
|
77
|
+
optional :return_url, String, nil?: true
|
78
|
+
|
79
|
+
# @!attribute show_saved_payment_methods
|
80
|
+
# Display saved payment methods of a returning customer False by default
|
81
|
+
#
|
82
|
+
# @return [Boolean, nil]
|
83
|
+
optional :show_saved_payment_methods, Dodopayments::Internal::Type::Boolean
|
84
|
+
|
85
|
+
# @!attribute subscription_data
|
86
|
+
#
|
87
|
+
# @return [Dodopayments::Models::CheckoutSessionRequest::SubscriptionData, nil]
|
88
|
+
optional :subscription_data, -> { Dodopayments::CheckoutSessionRequest::SubscriptionData }, nil?: true
|
89
|
+
|
90
|
+
# @!method initialize(product_cart:, allowed_payment_method_types: nil, billing_address: nil, billing_currency: nil, confirm: nil, customer: nil, customization: nil, discount_code: nil, feature_flags: nil, metadata: nil, return_url: nil, show_saved_payment_methods: nil, subscription_data: nil)
|
91
|
+
# Some parameter documentations has been truncated, see
|
92
|
+
# {Dodopayments::Models::CheckoutSessionRequest} for more details.
|
93
|
+
#
|
94
|
+
# @param product_cart [Array<Dodopayments::Models::CheckoutSessionRequest::ProductCart>]
|
95
|
+
#
|
96
|
+
# @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil] Customers will never see payment methods that are not in this list.
|
97
|
+
#
|
98
|
+
# @param billing_address [Dodopayments::Models::CheckoutSessionRequest::BillingAddress, nil] Billing address information for the session
|
99
|
+
#
|
100
|
+
# @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] This field is ingored if adaptive pricing is disabled
|
101
|
+
#
|
102
|
+
# @param confirm [Boolean] If confirm is true, all the details will be finalized. If required data is missi
|
103
|
+
#
|
104
|
+
# @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::NewCustomer, nil] Customer details for the session
|
105
|
+
#
|
106
|
+
# @param customization [Dodopayments::Models::CheckoutSessionRequest::Customization] Customization for the checkout session page
|
107
|
+
#
|
108
|
+
# @param discount_code [String, nil]
|
109
|
+
#
|
110
|
+
# @param feature_flags [Dodopayments::Models::CheckoutSessionRequest::FeatureFlags]
|
111
|
+
#
|
112
|
+
# @param metadata [Hash{Symbol=>String}, nil] Additional metadata associated with the payment. Defaults to empty if not provid
|
113
|
+
#
|
114
|
+
# @param return_url [String, nil] The url to redirect after payment failure or success.
|
115
|
+
#
|
116
|
+
# @param show_saved_payment_methods [Boolean] Display saved payment methods of a returning customer False by default
|
117
|
+
#
|
118
|
+
# @param subscription_data [Dodopayments::Models::CheckoutSessionRequest::SubscriptionData, nil]
|
119
|
+
|
120
|
+
class ProductCart < Dodopayments::Internal::Type::BaseModel
|
121
|
+
# @!attribute product_id
|
122
|
+
# unique id of the product
|
123
|
+
#
|
124
|
+
# @return [String]
|
125
|
+
required :product_id, String
|
126
|
+
|
127
|
+
# @!attribute quantity
|
128
|
+
#
|
129
|
+
# @return [Integer]
|
130
|
+
required :quantity, Integer
|
131
|
+
|
132
|
+
# @!attribute addons
|
133
|
+
# only valid if product is a subscription
|
134
|
+
#
|
135
|
+
# @return [Array<Dodopayments::Models::AttachAddon>, nil]
|
136
|
+
optional :addons, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::AttachAddon] }, nil?: true
|
137
|
+
|
138
|
+
# @!attribute amount
|
139
|
+
# Amount the customer pays if pay_what_you_want is enabled. If disabled then
|
140
|
+
# amount will be ignored Represented in the lowest denomination of the currency
|
141
|
+
# (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
|
142
|
+
# for one time payments
|
143
|
+
#
|
144
|
+
# If amount is not set for pay_what_you_want product, customer is allowed to
|
145
|
+
# select the amount.
|
146
|
+
#
|
147
|
+
# @return [Integer, nil]
|
148
|
+
optional :amount, Integer, nil?: true
|
149
|
+
|
150
|
+
# @!method initialize(product_id:, quantity:, addons: nil, amount: nil)
|
151
|
+
# Some parameter documentations has been truncated, see
|
152
|
+
# {Dodopayments::Models::CheckoutSessionRequest::ProductCart} for more details.
|
153
|
+
#
|
154
|
+
# @param product_id [String] unique id of the product
|
155
|
+
#
|
156
|
+
# @param quantity [Integer]
|
157
|
+
#
|
158
|
+
# @param addons [Array<Dodopayments::Models::AttachAddon>, nil] only valid if product is a subscription
|
159
|
+
#
|
160
|
+
# @param amount [Integer, nil] Amount the customer pays if pay_what_you_want is enabled. If disabled then amoun
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see Dodopayments::Models::CheckoutSessionRequest#billing_address
|
164
|
+
class BillingAddress < Dodopayments::Internal::Type::BaseModel
|
165
|
+
# @!attribute country
|
166
|
+
# Two-letter ISO country code (ISO 3166-1 alpha-2)
|
167
|
+
#
|
168
|
+
# @return [Symbol, Dodopayments::Models::CountryCode]
|
169
|
+
required :country, enum: -> { Dodopayments::CountryCode }
|
170
|
+
|
171
|
+
# @!attribute city
|
172
|
+
# City name
|
173
|
+
#
|
174
|
+
# @return [String, nil]
|
175
|
+
optional :city, String, nil?: true
|
176
|
+
|
177
|
+
# @!attribute state
|
178
|
+
# State or province name
|
179
|
+
#
|
180
|
+
# @return [String, nil]
|
181
|
+
optional :state, String, nil?: true
|
182
|
+
|
183
|
+
# @!attribute street
|
184
|
+
# Street address including house number and unit/apartment if applicable
|
185
|
+
#
|
186
|
+
# @return [String, nil]
|
187
|
+
optional :street, String, nil?: true
|
188
|
+
|
189
|
+
# @!attribute zipcode
|
190
|
+
# Postal code or ZIP code
|
191
|
+
#
|
192
|
+
# @return [String, nil]
|
193
|
+
optional :zipcode, String, nil?: true
|
194
|
+
|
195
|
+
# @!method initialize(country:, city: nil, state: nil, street: nil, zipcode: nil)
|
196
|
+
# Billing address information for the session
|
197
|
+
#
|
198
|
+
# @param country [Symbol, Dodopayments::Models::CountryCode] Two-letter ISO country code (ISO 3166-1 alpha-2)
|
199
|
+
#
|
200
|
+
# @param city [String, nil] City name
|
201
|
+
#
|
202
|
+
# @param state [String, nil] State or province name
|
203
|
+
#
|
204
|
+
# @param street [String, nil] Street address including house number and unit/apartment if applicable
|
205
|
+
#
|
206
|
+
# @param zipcode [String, nil] Postal code or ZIP code
|
207
|
+
end
|
208
|
+
|
209
|
+
# @see Dodopayments::Models::CheckoutSessionRequest#customization
|
210
|
+
class Customization < Dodopayments::Internal::Type::BaseModel
|
211
|
+
# @!attribute show_on_demand_tag
|
212
|
+
# Show on demand tag
|
213
|
+
#
|
214
|
+
# Default is true
|
215
|
+
#
|
216
|
+
# @return [Boolean, nil]
|
217
|
+
optional :show_on_demand_tag, Dodopayments::Internal::Type::Boolean
|
218
|
+
|
219
|
+
# @!attribute show_order_details
|
220
|
+
# Show order details by default
|
221
|
+
#
|
222
|
+
# Default is true
|
223
|
+
#
|
224
|
+
# @return [Boolean, nil]
|
225
|
+
optional :show_order_details, Dodopayments::Internal::Type::Boolean
|
226
|
+
|
227
|
+
# @!attribute theme
|
228
|
+
# Theme of the page
|
229
|
+
#
|
230
|
+
# Default is `System`.
|
231
|
+
#
|
232
|
+
# @return [Symbol, Dodopayments::Models::CheckoutSessionRequest::Customization::Theme, nil]
|
233
|
+
optional :theme, enum: -> { Dodopayments::CheckoutSessionRequest::Customization::Theme }
|
234
|
+
|
235
|
+
# @!method initialize(show_on_demand_tag: nil, show_order_details: nil, theme: nil)
|
236
|
+
# Some parameter documentations has been truncated, see
|
237
|
+
# {Dodopayments::Models::CheckoutSessionRequest::Customization} for more details.
|
238
|
+
#
|
239
|
+
# Customization for the checkout session page
|
240
|
+
#
|
241
|
+
# @param show_on_demand_tag [Boolean] Show on demand tag
|
242
|
+
#
|
243
|
+
# @param show_order_details [Boolean] Show order details by default
|
244
|
+
#
|
245
|
+
# @param theme [Symbol, Dodopayments::Models::CheckoutSessionRequest::Customization::Theme] Theme of the page
|
246
|
+
|
247
|
+
# Theme of the page
|
248
|
+
#
|
249
|
+
# Default is `System`.
|
250
|
+
#
|
251
|
+
# @see Dodopayments::Models::CheckoutSessionRequest::Customization#theme
|
252
|
+
module Theme
|
253
|
+
extend Dodopayments::Internal::Type::Enum
|
254
|
+
|
255
|
+
DARK = :dark
|
256
|
+
LIGHT = :light
|
257
|
+
SYSTEM = :system
|
258
|
+
|
259
|
+
# @!method self.values
|
260
|
+
# @return [Array<Symbol>]
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# @see Dodopayments::Models::CheckoutSessionRequest#feature_flags
|
265
|
+
class FeatureFlags < Dodopayments::Internal::Type::BaseModel
|
266
|
+
# @!attribute allow_currency_selection
|
267
|
+
# if customer is allowed to change currency, set it to true
|
268
|
+
#
|
269
|
+
# Default is true
|
270
|
+
#
|
271
|
+
# @return [Boolean, nil]
|
272
|
+
optional :allow_currency_selection, Dodopayments::Internal::Type::Boolean
|
273
|
+
|
274
|
+
# @!attribute allow_discount_code
|
275
|
+
# If the customer is allowed to apply discount code, set it to true.
|
276
|
+
#
|
277
|
+
# Default is true
|
278
|
+
#
|
279
|
+
# @return [Boolean, nil]
|
280
|
+
optional :allow_discount_code, Dodopayments::Internal::Type::Boolean
|
281
|
+
|
282
|
+
# @!attribute allow_phone_number_collection
|
283
|
+
# If phone number is collected from customer, set it to rue
|
284
|
+
#
|
285
|
+
# Default is true
|
286
|
+
#
|
287
|
+
# @return [Boolean, nil]
|
288
|
+
optional :allow_phone_number_collection, Dodopayments::Internal::Type::Boolean
|
289
|
+
|
290
|
+
# @!attribute allow_tax_id
|
291
|
+
# If the customer is allowed to add tax id, set it to true
|
292
|
+
#
|
293
|
+
# Default is true
|
294
|
+
#
|
295
|
+
# @return [Boolean, nil]
|
296
|
+
optional :allow_tax_id, Dodopayments::Internal::Type::Boolean
|
297
|
+
|
298
|
+
# @!attribute always_create_new_customer
|
299
|
+
# Set to true if a new customer object should be created. By default email is used
|
300
|
+
# to find an existing customer to attach the session to
|
301
|
+
#
|
302
|
+
# Default is false
|
303
|
+
#
|
304
|
+
# @return [Boolean, nil]
|
305
|
+
optional :always_create_new_customer, Dodopayments::Internal::Type::Boolean
|
306
|
+
|
307
|
+
# @!method initialize(allow_currency_selection: nil, allow_discount_code: nil, allow_phone_number_collection: nil, allow_tax_id: nil, always_create_new_customer: nil)
|
308
|
+
# Some parameter documentations has been truncated, see
|
309
|
+
# {Dodopayments::Models::CheckoutSessionRequest::FeatureFlags} for more details.
|
310
|
+
#
|
311
|
+
# @param allow_currency_selection [Boolean] if customer is allowed to change currency, set it to true
|
312
|
+
#
|
313
|
+
# @param allow_discount_code [Boolean] If the customer is allowed to apply discount code, set it to true.
|
314
|
+
#
|
315
|
+
# @param allow_phone_number_collection [Boolean] If phone number is collected from customer, set it to rue
|
316
|
+
#
|
317
|
+
# @param allow_tax_id [Boolean] If the customer is allowed to add tax id, set it to true
|
318
|
+
#
|
319
|
+
# @param always_create_new_customer [Boolean] Set to true if a new customer object should be created.
|
320
|
+
end
|
321
|
+
|
322
|
+
# @see Dodopayments::Models::CheckoutSessionRequest#subscription_data
|
323
|
+
class SubscriptionData < Dodopayments::Internal::Type::BaseModel
|
324
|
+
# @!attribute on_demand
|
325
|
+
#
|
326
|
+
# @return [Dodopayments::Models::OnDemandSubscription, nil]
|
327
|
+
optional :on_demand, -> { Dodopayments::OnDemandSubscription }, nil?: true
|
328
|
+
|
329
|
+
# @!attribute trial_period_days
|
330
|
+
# Optional trial period in days If specified, this value overrides the trial
|
331
|
+
# period set in the product's price Must be between 0 and 10000 days
|
332
|
+
#
|
333
|
+
# @return [Integer, nil]
|
334
|
+
optional :trial_period_days, Integer, nil?: true
|
335
|
+
|
336
|
+
# @!method initialize(on_demand: nil, trial_period_days: nil)
|
337
|
+
# Some parameter documentations has been truncated, see
|
338
|
+
# {Dodopayments::Models::CheckoutSessionRequest::SubscriptionData} for more
|
339
|
+
# details.
|
340
|
+
#
|
341
|
+
# @param on_demand [Dodopayments::Models::OnDemandSubscription, nil]
|
342
|
+
#
|
343
|
+
# @param trial_period_days [Integer, nil] Optional trial period in days If specified, this value overrides the trial perio
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|