dodopayments 1.49.0 → 1.51.1

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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +17 -51
  4. data/lib/dodopayments/client.rb +4 -4
  5. data/lib/dodopayments/internal/transport/base_client.rb +1 -4
  6. data/lib/dodopayments/internal/transport/pooled_net_requester.rb +1 -9
  7. data/lib/dodopayments/internal/type/base_model.rb +6 -11
  8. data/lib/dodopayments/internal/util.rb +1 -1
  9. data/lib/dodopayments/models/checkout_session_create_params.rb +14 -0
  10. data/lib/dodopayments/models/checkout_session_request.rb +347 -0
  11. data/lib/dodopayments/models/checkout_session_response.rb +25 -0
  12. data/lib/dodopayments/models/on_demand_subscription.rb +58 -0
  13. data/lib/dodopayments/models/payment_create_params.rb +1 -4
  14. data/lib/dodopayments/models/subscription.rb +9 -1
  15. data/lib/dodopayments/models/subscription_create_params.rb +3 -56
  16. data/lib/dodopayments/models/subscription_update_params.rb +9 -1
  17. data/lib/dodopayments/models/webhook_create_params.rb +1 -4
  18. data/lib/dodopayments/models/{webhook_create_response.rb → webhook_details.rb} +2 -2
  19. data/lib/dodopayments/models.rb +10 -2
  20. data/lib/dodopayments/resources/checkout_sessions.rb +61 -0
  21. data/lib/dodopayments/resources/subscriptions.rb +2 -2
  22. data/lib/dodopayments/resources/webhooks.rb +8 -8
  23. data/lib/dodopayments/version.rb +1 -1
  24. data/lib/dodopayments.rb +7 -7
  25. data/rbi/dodopayments/client.rbi +3 -3
  26. data/rbi/dodopayments/errors.rbi +2 -2
  27. data/rbi/dodopayments/models/checkout_session_create_params.rbi +32 -0
  28. data/rbi/dodopayments/models/checkout_session_request.rbi +652 -0
  29. data/rbi/dodopayments/models/checkout_session_response.rbi +40 -0
  30. data/rbi/dodopayments/models/dispute.rbi +4 -4
  31. data/rbi/dodopayments/models/get_dispute.rbi +4 -4
  32. data/rbi/dodopayments/models/license_key.rbi +2 -2
  33. data/rbi/dodopayments/models/on_demand_subscription.rbi +86 -0
  34. data/rbi/dodopayments/models/payment.rbi +8 -8
  35. data/rbi/dodopayments/models/refund.rbi +4 -4
  36. data/rbi/dodopayments/models/subscription.rbi +21 -11
  37. data/rbi/dodopayments/models/subscription_create_params.rbi +4 -90
  38. data/rbi/dodopayments/models/subscription_update_params.rbi +2 -0
  39. data/rbi/dodopayments/models/{webhook_list_response.rbi → webhook_details.rbi} +2 -5
  40. data/rbi/dodopayments/models.rbi +11 -2
  41. data/rbi/dodopayments/resources/checkout_sessions.rbi +80 -0
  42. data/rbi/dodopayments/resources/subscriptions.rbi +2 -2
  43. data/rbi/dodopayments/resources/webhooks.rbi +4 -4
  44. data/sig/dodopayments/client.rbs +2 -2
  45. data/sig/dodopayments/models/checkout_session_create_params.rbs +15 -0
  46. data/sig/dodopayments/models/checkout_session_request.rbs +277 -0
  47. data/sig/dodopayments/models/checkout_session_response.rbs +16 -0
  48. data/sig/dodopayments/models/on_demand_subscription.rbs +40 -0
  49. data/sig/dodopayments/models/subscription.rbs +8 -3
  50. data/sig/dodopayments/models/subscription_create_params.rbs +4 -41
  51. data/sig/dodopayments/models/{webhook_list_response.rbs → webhook_details.rbs} +2 -2
  52. data/sig/dodopayments/models.rbs +10 -2
  53. data/sig/dodopayments/resources/checkout_sessions.rbs +24 -0
  54. data/sig/dodopayments/resources/subscriptions.rbs +1 -1
  55. data/sig/dodopayments/resources/webhooks.rbs +4 -4
  56. metadata +20 -20
  57. data/lib/dodopayments/models/webhook_list_response.rb +0 -88
  58. data/lib/dodopayments/models/webhook_retrieve_response.rb +0 -88
  59. data/lib/dodopayments/models/webhook_update_response.rb +0 -88
  60. data/lib/dodopayments/models/your_webhook_url_create_params.rb +0 -32
  61. data/lib/dodopayments/resources/your_webhook_url.rb +0 -56
  62. data/rbi/dodopayments/models/webhook_create_response.rbi +0 -112
  63. data/rbi/dodopayments/models/webhook_retrieve_response.rbi +0 -112
  64. data/rbi/dodopayments/models/webhook_update_response.rbi +0 -112
  65. data/rbi/dodopayments/models/your_webhook_url_create_params.rbi +0 -56
  66. data/rbi/dodopayments/resources/your_webhook_url.rbi +0 -51
  67. data/sig/dodopayments/models/webhook_create_response.rbs +0 -60
  68. data/sig/dodopayments/models/webhook_retrieve_response.rbs +0 -60
  69. data/sig/dodopayments/models/webhook_update_response.rbs +0 -60
  70. data/sig/dodopayments/models/your_webhook_url_create_params.rbs +0 -42
  71. data/sig/dodopayments/resources/your_webhook_url.rbs +0 -18
@@ -39,11 +39,11 @@ module Dodopayments
39
39
  attr_accessor :dispute_id
40
40
 
41
41
  # The current stage of the dispute process.
42
- sig { returns(Dodopayments::DisputeStage::OrSymbol) }
42
+ sig { returns(Dodopayments::DisputeStage::TaggedSymbol) }
43
43
  attr_accessor :dispute_stage
44
44
 
45
45
  # The current status of the dispute.
46
- sig { returns(Dodopayments::DisputeStatus::OrSymbol) }
46
+ sig { returns(Dodopayments::DisputeStatus::TaggedSymbol) }
47
47
  attr_accessor :dispute_status
48
48
 
49
49
  # The unique identifier of the payment associated with the dispute.
@@ -109,8 +109,8 @@ module Dodopayments
109
109
  currency: String,
110
110
  customer: Dodopayments::CustomerLimitedDetails,
111
111
  dispute_id: String,
112
- dispute_stage: Dodopayments::DisputeStage::OrSymbol,
113
- dispute_status: Dodopayments::DisputeStatus::OrSymbol,
112
+ dispute_stage: Dodopayments::DisputeStage::TaggedSymbol,
113
+ dispute_status: Dodopayments::DisputeStatus::TaggedSymbol,
114
114
  payment_id: String,
115
115
  reason: T.nilable(String),
116
116
  remarks: T.nilable(String)
@@ -41,7 +41,7 @@ module Dodopayments
41
41
  attr_accessor :product_id
42
42
 
43
43
  # The current status of the license key (e.g., active, inactive, expired).
44
- sig { returns(Dodopayments::LicenseKeyStatus::OrSymbol) }
44
+ sig { returns(Dodopayments::LicenseKeyStatus::TaggedSymbol) }
45
45
  attr_accessor :status
46
46
 
47
47
  # The maximum number of activations allowed for this license key.
@@ -113,7 +113,7 @@ module Dodopayments
113
113
  key: String,
114
114
  payment_id: String,
115
115
  product_id: String,
116
- status: Dodopayments::LicenseKeyStatus::OrSymbol,
116
+ status: Dodopayments::LicenseKeyStatus::TaggedSymbol,
117
117
  activations_limit: T.nilable(Integer),
118
118
  expires_at: T.nilable(Time),
119
119
  subscription_id: T.nilable(String)
@@ -0,0 +1,86 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class OnDemandSubscription < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::OnDemandSubscription,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # If set as True, does not perform any charge and only authorizes payment method
15
+ # details for future use.
16
+ sig { returns(T::Boolean) }
17
+ attr_accessor :mandate_only
18
+
19
+ # Whether adaptive currency fees should be included in the product_price (true) or
20
+ # added on top (false). This field is ignored if adaptive pricing is not enabled
21
+ # for the business.
22
+ sig { returns(T.nilable(T::Boolean)) }
23
+ attr_accessor :adaptive_currency_fees_inclusive
24
+
25
+ # Optional currency of the product price. If not specified, defaults to the
26
+ # currency of the product.
27
+ sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
28
+ attr_accessor :product_currency
29
+
30
+ # Optional product description override for billing and line items. If not
31
+ # specified, the stored description of the product will be used.
32
+ sig { returns(T.nilable(String)) }
33
+ attr_accessor :product_description
34
+
35
+ # Product price for the initial charge to customer If not specified the stored
36
+ # price of the product will be used Represented in the lowest denomination of the
37
+ # currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
38
+ sig { returns(T.nilable(Integer)) }
39
+ attr_accessor :product_price
40
+
41
+ sig do
42
+ params(
43
+ mandate_only: T::Boolean,
44
+ adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
45
+ product_currency: T.nilable(Dodopayments::Currency::OrSymbol),
46
+ product_description: T.nilable(String),
47
+ product_price: T.nilable(Integer)
48
+ ).returns(T.attached_class)
49
+ end
50
+ def self.new(
51
+ # If set as True, does not perform any charge and only authorizes payment method
52
+ # details for future use.
53
+ mandate_only:,
54
+ # Whether adaptive currency fees should be included in the product_price (true) or
55
+ # added on top (false). This field is ignored if adaptive pricing is not enabled
56
+ # for the business.
57
+ adaptive_currency_fees_inclusive: nil,
58
+ # Optional currency of the product price. If not specified, defaults to the
59
+ # currency of the product.
60
+ product_currency: nil,
61
+ # Optional product description override for billing and line items. If not
62
+ # specified, the stored description of the product will be used.
63
+ product_description: nil,
64
+ # Product price for the initial charge to customer If not specified the stored
65
+ # price of the product will be used Represented in the lowest denomination of the
66
+ # currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
67
+ product_price: nil
68
+ )
69
+ end
70
+
71
+ sig do
72
+ override.returns(
73
+ {
74
+ mandate_only: T::Boolean,
75
+ adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
76
+ product_currency: T.nilable(Dodopayments::Currency::OrSymbol),
77
+ product_description: T.nilable(String),
78
+ product_price: T.nilable(Integer)
79
+ }
80
+ )
81
+ end
82
+ def to_hash
83
+ end
84
+ end
85
+ end
86
+ end
@@ -28,7 +28,7 @@ module Dodopayments
28
28
  attr_accessor :created_at
29
29
 
30
30
  # Currency used for the payment
31
- sig { returns(Dodopayments::Currency::OrSymbol) }
31
+ sig { returns(Dodopayments::Currency::TaggedSymbol) }
32
32
  attr_accessor :currency
33
33
 
34
34
  # Details about the customer who made the payment
@@ -69,7 +69,7 @@ module Dodopayments
69
69
  # The currency in which the settlement_amount will be credited to your Dodo
70
70
  # balance. This may differ from the customer's payment currency in adaptive
71
71
  # pricing scenarios.
72
- sig { returns(Dodopayments::Currency::OrSymbol) }
72
+ sig { returns(Dodopayments::Currency::TaggedSymbol) }
73
73
  attr_accessor :settlement_currency
74
74
 
75
75
  # Total amount charged to the customer including tax, in smallest currency unit
@@ -78,7 +78,7 @@ module Dodopayments
78
78
  attr_accessor :total_amount
79
79
 
80
80
  # ISO2 country code of the card
81
- sig { returns(T.nilable(Dodopayments::CountryCode::OrSymbol)) }
81
+ sig { returns(T.nilable(Dodopayments::CountryCode::TaggedSymbol)) }
82
82
  attr_accessor :card_issuing_country
83
83
 
84
84
  # The last four digits of the card
@@ -128,7 +128,7 @@ module Dodopayments
128
128
  attr_accessor :settlement_tax
129
129
 
130
130
  # Current status of the payment intent
131
- sig { returns(T.nilable(Dodopayments::IntentStatus::OrSymbol)) }
131
+ sig { returns(T.nilable(Dodopayments::IntentStatus::TaggedSymbol)) }
132
132
  attr_accessor :status
133
133
 
134
134
  # Identifier of the subscription if payment is part of a subscription
@@ -256,7 +256,7 @@ module Dodopayments
256
256
  brand_id: String,
257
257
  business_id: String,
258
258
  created_at: Time,
259
- currency: Dodopayments::Currency::OrSymbol,
259
+ currency: Dodopayments::Currency::TaggedSymbol,
260
260
  customer: Dodopayments::CustomerLimitedDetails,
261
261
  digital_products_delivered: T::Boolean,
262
262
  disputes: T::Array[Dodopayments::Dispute],
@@ -264,10 +264,10 @@ module Dodopayments
264
264
  payment_id: String,
265
265
  refunds: T::Array[Dodopayments::Refund],
266
266
  settlement_amount: Integer,
267
- settlement_currency: Dodopayments::Currency::OrSymbol,
267
+ settlement_currency: Dodopayments::Currency::TaggedSymbol,
268
268
  total_amount: Integer,
269
269
  card_issuing_country:
270
- T.nilable(Dodopayments::CountryCode::OrSymbol),
270
+ T.nilable(Dodopayments::CountryCode::TaggedSymbol),
271
271
  card_last_four: T.nilable(String),
272
272
  card_network: T.nilable(String),
273
273
  card_type: T.nilable(String),
@@ -280,7 +280,7 @@ module Dodopayments
280
280
  product_cart:
281
281
  T.nilable(T::Array[Dodopayments::Payment::ProductCart]),
282
282
  settlement_tax: T.nilable(Integer),
283
- status: T.nilable(Dodopayments::IntentStatus::OrSymbol),
283
+ status: T.nilable(Dodopayments::IntentStatus::TaggedSymbol),
284
284
  subscription_id: T.nilable(String),
285
285
  tax: T.nilable(Integer),
286
286
  updated_at: T.nilable(Time)
@@ -29,7 +29,7 @@ module Dodopayments
29
29
  attr_accessor :refund_id
30
30
 
31
31
  # The current status of the refund.
32
- sig { returns(Dodopayments::RefundStatus::OrSymbol) }
32
+ sig { returns(Dodopayments::RefundStatus::TaggedSymbol) }
33
33
  attr_accessor :status
34
34
 
35
35
  # The refunded amount.
@@ -37,7 +37,7 @@ module Dodopayments
37
37
  attr_accessor :amount
38
38
 
39
39
  # The currency of the refund, represented as an ISO 4217 currency code.
40
- sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
40
+ sig { returns(T.nilable(Dodopayments::Currency::TaggedSymbol)) }
41
41
  attr_accessor :currency
42
42
 
43
43
  # The reason provided for the refund, if any. Optional.
@@ -87,9 +87,9 @@ module Dodopayments
87
87
  is_partial: T::Boolean,
88
88
  payment_id: String,
89
89
  refund_id: String,
90
- status: Dodopayments::RefundStatus::OrSymbol,
90
+ status: Dodopayments::RefundStatus::TaggedSymbol,
91
91
  amount: T.nilable(Integer),
92
- currency: T.nilable(Dodopayments::Currency::OrSymbol),
92
+ currency: T.nilable(Dodopayments::Currency::TaggedSymbol),
93
93
  reason: T.nilable(String)
94
94
  }
95
95
  )
@@ -28,7 +28,7 @@ module Dodopayments
28
28
  attr_accessor :created_at
29
29
 
30
30
  # Currency used for the subscription payments
31
- sig { returns(Dodopayments::Currency::OrSymbol) }
31
+ sig { returns(Dodopayments::Currency::TaggedSymbol) }
32
32
  attr_accessor :currency
33
33
 
34
34
  # Customer details associated with the subscription
@@ -58,7 +58,7 @@ module Dodopayments
58
58
  attr_accessor :payment_frequency_count
59
59
 
60
60
  # Time interval for payment frequency (e.g. month, year)
61
- sig { returns(Dodopayments::TimeInterval::OrSymbol) }
61
+ sig { returns(Dodopayments::TimeInterval::TaggedSymbol) }
62
62
  attr_accessor :payment_frequency_interval
63
63
 
64
64
  # Timestamp of the last payment. Indicates the start of current billing period
@@ -79,7 +79,7 @@ module Dodopayments
79
79
  attr_accessor :recurring_pre_tax_amount
80
80
 
81
81
  # Current status of the subscription
82
- sig { returns(Dodopayments::SubscriptionStatus::OrSymbol) }
82
+ sig { returns(Dodopayments::SubscriptionStatus::TaggedSymbol) }
83
83
  attr_accessor :status
84
84
 
85
85
  # Unique identifier for the subscription
@@ -91,7 +91,7 @@ module Dodopayments
91
91
  attr_accessor :subscription_period_count
92
92
 
93
93
  # Time interval for the subscription period (e.g. month, year)
94
- sig { returns(Dodopayments::TimeInterval::OrSymbol) }
94
+ sig { returns(Dodopayments::TimeInterval::TaggedSymbol) }
95
95
  attr_accessor :subscription_period_interval
96
96
 
97
97
  # Indicates if the recurring_pre_tax_amount is tax inclusive
@@ -114,6 +114,10 @@ module Dodopayments
114
114
  sig { returns(T.nilable(String)) }
115
115
  attr_accessor :discount_id
116
116
 
117
+ # Timestamp when the subscription will expire
118
+ sig { returns(T.nilable(Time)) }
119
+ attr_accessor :expires_at
120
+
117
121
  # Response struct representing subscription details
118
122
  sig do
119
123
  params(
@@ -140,7 +144,8 @@ module Dodopayments
140
144
  trial_period_days: Integer,
141
145
  cancelled_at: T.nilable(Time),
142
146
  discount_cycles_remaining: T.nilable(Integer),
143
- discount_id: T.nilable(String)
147
+ discount_id: T.nilable(String),
148
+ expires_at: T.nilable(Time)
144
149
  ).returns(T.attached_class)
145
150
  end
146
151
  def self.new(
@@ -193,7 +198,9 @@ module Dodopayments
193
198
  # Number of remaining discount cycles if discount is applied
194
199
  discount_cycles_remaining: nil,
195
200
  # The discount id if discount is applied
196
- discount_id: nil
201
+ discount_id: nil,
202
+ # Timestamp when the subscription will expire
203
+ expires_at: nil
197
204
  )
198
205
  end
199
206
 
@@ -204,26 +211,29 @@ module Dodopayments
204
211
  billing: Dodopayments::BillingAddress,
205
212
  cancel_at_next_billing_date: T::Boolean,
206
213
  created_at: Time,
207
- currency: Dodopayments::Currency::OrSymbol,
214
+ currency: Dodopayments::Currency::TaggedSymbol,
208
215
  customer: Dodopayments::CustomerLimitedDetails,
209
216
  metadata: T::Hash[Symbol, String],
210
217
  next_billing_date: Time,
211
218
  on_demand: T::Boolean,
212
219
  payment_frequency_count: Integer,
213
- payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
220
+ payment_frequency_interval:
221
+ Dodopayments::TimeInterval::TaggedSymbol,
214
222
  previous_billing_date: Time,
215
223
  product_id: String,
216
224
  quantity: Integer,
217
225
  recurring_pre_tax_amount: Integer,
218
- status: Dodopayments::SubscriptionStatus::OrSymbol,
226
+ status: Dodopayments::SubscriptionStatus::TaggedSymbol,
219
227
  subscription_id: String,
220
228
  subscription_period_count: Integer,
221
- subscription_period_interval: Dodopayments::TimeInterval::OrSymbol,
229
+ subscription_period_interval:
230
+ Dodopayments::TimeInterval::TaggedSymbol,
222
231
  tax_inclusive: T::Boolean,
223
232
  trial_period_days: Integer,
224
233
  cancelled_at: T.nilable(Time),
225
234
  discount_cycles_remaining: T.nilable(Integer),
226
- discount_id: T.nilable(String)
235
+ discount_id: T.nilable(String),
236
+ expires_at: T.nilable(Time)
227
237
  }
228
238
  )
229
239
  end
@@ -68,15 +68,12 @@ module Dodopayments
68
68
  sig { params(metadata: T::Hash[Symbol, String]).void }
69
69
  attr_writer :metadata
70
70
 
71
- sig do
72
- returns(T.nilable(Dodopayments::SubscriptionCreateParams::OnDemand))
73
- end
71
+ sig { returns(T.nilable(Dodopayments::OnDemandSubscription)) }
74
72
  attr_reader :on_demand
75
73
 
76
74
  sig do
77
75
  params(
78
- on_demand:
79
- T.nilable(Dodopayments::SubscriptionCreateParams::OnDemand::OrHash)
76
+ on_demand: T.nilable(Dodopayments::OnDemandSubscription::OrHash)
80
77
  ).void
81
78
  end
82
79
  attr_writer :on_demand
@@ -122,8 +119,7 @@ module Dodopayments
122
119
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
123
120
  discount_code: T.nilable(String),
124
121
  metadata: T::Hash[Symbol, String],
125
- on_demand:
126
- T.nilable(Dodopayments::SubscriptionCreateParams::OnDemand::OrHash),
122
+ on_demand: T.nilable(Dodopayments::OnDemandSubscription::OrHash),
127
123
  payment_link: T.nilable(T::Boolean),
128
124
  return_url: T.nilable(String),
129
125
  show_saved_payment_methods: T::Boolean,
@@ -191,8 +187,7 @@ module Dodopayments
191
187
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
192
188
  discount_code: T.nilable(String),
193
189
  metadata: T::Hash[Symbol, String],
194
- on_demand:
195
- T.nilable(Dodopayments::SubscriptionCreateParams::OnDemand),
190
+ on_demand: T.nilable(Dodopayments::OnDemandSubscription),
196
191
  payment_link: T.nilable(T::Boolean),
197
192
  return_url: T.nilable(String),
198
193
  show_saved_payment_methods: T::Boolean,
@@ -204,87 +199,6 @@ module Dodopayments
204
199
  end
205
200
  def to_hash
206
201
  end
207
-
208
- class OnDemand < Dodopayments::Internal::Type::BaseModel
209
- OrHash =
210
- T.type_alias do
211
- T.any(
212
- Dodopayments::SubscriptionCreateParams::OnDemand,
213
- Dodopayments::Internal::AnyHash
214
- )
215
- end
216
-
217
- # If set as True, does not perform any charge and only authorizes payment method
218
- # details for future use.
219
- sig { returns(T::Boolean) }
220
- attr_accessor :mandate_only
221
-
222
- # Whether adaptive currency fees should be included in the product_price (true) or
223
- # added on top (false). This field is ignored if adaptive pricing is not enabled
224
- # for the business.
225
- sig { returns(T.nilable(T::Boolean)) }
226
- attr_accessor :adaptive_currency_fees_inclusive
227
-
228
- # Optional currency of the product price. If not specified, defaults to the
229
- # currency of the product.
230
- sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
231
- attr_accessor :product_currency
232
-
233
- # Optional product description override for billing and line items. If not
234
- # specified, the stored description of the product will be used.
235
- sig { returns(T.nilable(String)) }
236
- attr_accessor :product_description
237
-
238
- # Product price for the initial charge to customer If not specified the stored
239
- # price of the product will be used Represented in the lowest denomination of the
240
- # currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
241
- sig { returns(T.nilable(Integer)) }
242
- attr_accessor :product_price
243
-
244
- sig do
245
- params(
246
- mandate_only: T::Boolean,
247
- adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
248
- product_currency: T.nilable(Dodopayments::Currency::OrSymbol),
249
- product_description: T.nilable(String),
250
- product_price: T.nilable(Integer)
251
- ).returns(T.attached_class)
252
- end
253
- def self.new(
254
- # If set as True, does not perform any charge and only authorizes payment method
255
- # details for future use.
256
- mandate_only:,
257
- # Whether adaptive currency fees should be included in the product_price (true) or
258
- # added on top (false). This field is ignored if adaptive pricing is not enabled
259
- # for the business.
260
- adaptive_currency_fees_inclusive: nil,
261
- # Optional currency of the product price. If not specified, defaults to the
262
- # currency of the product.
263
- product_currency: nil,
264
- # Optional product description override for billing and line items. If not
265
- # specified, the stored description of the product will be used.
266
- product_description: nil,
267
- # Product price for the initial charge to customer If not specified the stored
268
- # price of the product will be used Represented in the lowest denomination of the
269
- # currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
270
- product_price: nil
271
- )
272
- end
273
-
274
- sig do
275
- override.returns(
276
- {
277
- mandate_only: T::Boolean,
278
- adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
279
- product_currency: T.nilable(Dodopayments::Currency::OrSymbol),
280
- product_description: T.nilable(String),
281
- product_price: T.nilable(Integer)
282
- }
283
- )
284
- end
285
- def to_hash
286
- end
287
- end
288
202
  end
289
203
  end
290
204
  end
@@ -22,6 +22,7 @@ module Dodopayments
22
22
  end
23
23
  attr_writer :billing
24
24
 
25
+ # When set, the subscription will remain active until the end of billing period
25
26
  sig { returns(T.nilable(T::Boolean)) }
26
27
  attr_accessor :cancel_at_next_billing_date
27
28
 
@@ -71,6 +72,7 @@ module Dodopayments
71
72
  end
72
73
  def self.new(
73
74
  billing: nil,
75
+ # When set, the subscription will remain active until the end of billing period
74
76
  cancel_at_next_billing_date: nil,
75
77
  disable_on_demand: nil,
76
78
  metadata: nil,
@@ -2,13 +2,10 @@
2
2
 
3
3
  module Dodopayments
4
4
  module Models
5
- class WebhookListResponse < Dodopayments::Internal::Type::BaseModel
5
+ class WebhookDetails < Dodopayments::Internal::Type::BaseModel
6
6
  OrHash =
7
7
  T.type_alias do
8
- T.any(
9
- Dodopayments::Models::WebhookListResponse,
10
- Dodopayments::Internal::AnyHash
11
- )
8
+ T.any(Dodopayments::WebhookDetails, Dodopayments::Internal::AnyHash)
12
9
  end
13
10
 
14
11
  # The webhook's ID.
@@ -33,6 +33,13 @@ module Dodopayments
33
33
 
34
34
  BrandUpdateParams = Dodopayments::Models::BrandUpdateParams
35
35
 
36
+ CheckoutSessionCreateParams =
37
+ Dodopayments::Models::CheckoutSessionCreateParams
38
+
39
+ CheckoutSessionRequest = Dodopayments::Models::CheckoutSessionRequest
40
+
41
+ CheckoutSessionResponse = Dodopayments::Models::CheckoutSessionResponse
42
+
36
43
  CountryCode = Dodopayments::Models::CountryCode
37
44
 
38
45
  CreateNewCustomer = Dodopayments::Models::CreateNewCustomer
@@ -121,6 +128,8 @@ module Dodopayments
121
128
 
122
129
  NewCustomer = Dodopayments::Models::NewCustomer
123
130
 
131
+ OnDemandSubscription = Dodopayments::Models::OnDemandSubscription
132
+
124
133
  OneTimeProductCartItem = Dodopayments::Models::OneTimeProductCartItem
125
134
 
126
135
  Payment = Dodopayments::Models::Payment
@@ -193,6 +202,8 @@ module Dodopayments
193
202
 
194
203
  WebhookDeleteParams = Dodopayments::Models::WebhookDeleteParams
195
204
 
205
+ WebhookDetails = Dodopayments::Models::WebhookDetails
206
+
196
207
  WebhookEventType = Dodopayments::Models::WebhookEventType
197
208
 
198
209
  WebhookListParams = Dodopayments::Models::WebhookListParams
@@ -207,6 +218,4 @@ module Dodopayments
207
218
  Webhooks = Dodopayments::Models::Webhooks
208
219
 
209
220
  WebhookUpdateParams = Dodopayments::Models::WebhookUpdateParams
210
-
211
- YourWebhookURLCreateParams = Dodopayments::Models::YourWebhookURLCreateParams
212
221
  end
@@ -0,0 +1,80 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class CheckoutSessions
6
+ sig do
7
+ params(
8
+ product_cart:
9
+ T::Array[Dodopayments::CheckoutSessionRequest::ProductCart::OrHash],
10
+ allowed_payment_method_types:
11
+ T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
12
+ billing_address:
13
+ T.nilable(
14
+ Dodopayments::CheckoutSessionRequest::BillingAddress::OrHash
15
+ ),
16
+ billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
17
+ confirm: T::Boolean,
18
+ customer:
19
+ T.nilable(
20
+ T.any(
21
+ Dodopayments::AttachExistingCustomer::OrHash,
22
+ Dodopayments::NewCustomer::OrHash
23
+ )
24
+ ),
25
+ customization:
26
+ Dodopayments::CheckoutSessionRequest::Customization::OrHash,
27
+ discount_code: T.nilable(String),
28
+ feature_flags:
29
+ Dodopayments::CheckoutSessionRequest::FeatureFlags::OrHash,
30
+ metadata: T.nilable(T::Hash[Symbol, String]),
31
+ return_url: T.nilable(String),
32
+ show_saved_payment_methods: T::Boolean,
33
+ subscription_data:
34
+ T.nilable(
35
+ Dodopayments::CheckoutSessionRequest::SubscriptionData::OrHash
36
+ ),
37
+ request_options: Dodopayments::RequestOptions::OrHash
38
+ ).returns(Dodopayments::CheckoutSessionResponse)
39
+ end
40
+ def create(
41
+ product_cart:,
42
+ # Customers will never see payment methods that are not in this list. However,
43
+ # adding a method here does not guarantee customers will see it. Availability
44
+ # still depends on other factors (e.g., customer location, merchant settings).
45
+ #
46
+ # Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment
47
+ # methods are unavailable, checkout session will fail.
48
+ allowed_payment_method_types: nil,
49
+ # Billing address information for the session
50
+ billing_address: nil,
51
+ # This field is ingored if adaptive pricing is disabled
52
+ billing_currency: nil,
53
+ # If confirm is true, all the details will be finalized. If required data is
54
+ # missing, an API error is thrown.
55
+ confirm: nil,
56
+ # Customer details for the session
57
+ customer: nil,
58
+ # Customization for the checkout session page
59
+ customization: nil,
60
+ discount_code: nil,
61
+ feature_flags: nil,
62
+ # Additional metadata associated with the payment. Defaults to empty if not
63
+ # provided.
64
+ metadata: nil,
65
+ # The url to redirect after payment failure or success.
66
+ return_url: nil,
67
+ # Display saved payment methods of a returning customer False by default
68
+ show_saved_payment_methods: nil,
69
+ subscription_data: nil,
70
+ request_options: {}
71
+ )
72
+ end
73
+
74
+ # @api private
75
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
76
+ def self.new(client:)
77
+ end
78
+ end
79
+ end
80
+ end
@@ -19,8 +19,7 @@ module Dodopayments
19
19
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
20
20
  discount_code: T.nilable(String),
21
21
  metadata: T::Hash[Symbol, String],
22
- on_demand:
23
- T.nilable(Dodopayments::SubscriptionCreateParams::OnDemand::OrHash),
22
+ on_demand: T.nilable(Dodopayments::OnDemandSubscription::OrHash),
24
23
  payment_link: T.nilable(T::Boolean),
25
24
  return_url: T.nilable(String),
26
25
  show_saved_payment_methods: T::Boolean,
@@ -104,6 +103,7 @@ module Dodopayments
104
103
  # Subscription Id
105
104
  subscription_id,
106
105
  billing: nil,
106
+ # When set, the subscription will remain active until the end of billing period
107
107
  cancel_at_next_billing_date: nil,
108
108
  disable_on_demand: nil,
109
109
  metadata: nil,
@@ -18,7 +18,7 @@ module Dodopayments
18
18
  metadata: T.nilable(T::Hash[Symbol, String]),
19
19
  rate_limit: T.nilable(Integer),
20
20
  request_options: Dodopayments::RequestOptions::OrHash
21
- ).returns(Dodopayments::Models::WebhookCreateResponse)
21
+ ).returns(Dodopayments::WebhookDetails)
22
22
  end
23
23
  def create(
24
24
  # Url of the webhook
@@ -48,7 +48,7 @@ module Dodopayments
48
48
  params(
49
49
  webhook_id: String,
50
50
  request_options: Dodopayments::RequestOptions::OrHash
51
- ).returns(Dodopayments::Models::WebhookRetrieveResponse)
51
+ ).returns(Dodopayments::WebhookDetails)
52
52
  end
53
53
  def retrieve(webhook_id, request_options: {})
54
54
  end
@@ -65,7 +65,7 @@ module Dodopayments
65
65
  rate_limit: T.nilable(Integer),
66
66
  url: T.nilable(String),
67
67
  request_options: Dodopayments::RequestOptions::OrHash
68
- ).returns(Dodopayments::Models::WebhookUpdateResponse)
68
+ ).returns(Dodopayments::WebhookDetails)
69
69
  end
70
70
  def update(
71
71
  webhook_id,
@@ -95,7 +95,7 @@ module Dodopayments
95
95
  request_options: Dodopayments::RequestOptions::OrHash
96
96
  ).returns(
97
97
  Dodopayments::Internal::CursorPagePagination[
98
- Dodopayments::Models::WebhookListResponse
98
+ Dodopayments::WebhookDetails
99
99
  ]
100
100
  )
101
101
  end
@@ -15,6 +15,8 @@ module Dodopayments
15
15
 
16
16
  attr_reader bearer_token: String
17
17
 
18
+ attr_reader checkout_sessions: Dodopayments::Resources::CheckoutSessions
19
+
18
20
  attr_reader payments: Dodopayments::Resources::Payments
19
21
 
20
22
  attr_reader subscriptions: Dodopayments::Resources::Subscriptions
@@ -49,8 +51,6 @@ module Dodopayments
49
51
 
50
52
  attr_reader webhooks: Dodopayments::Resources::Webhooks
51
53
 
52
- attr_reader your_webhook_url: Dodopayments::Resources::YourWebhookURL
53
-
54
54
  private def auth_headers: -> ::Hash[String, String]
55
55
 
56
56
  def initialize: (