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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -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 +16 -2
  17. data/lib/dodopayments/models/webhook_create_params.rb +6 -9
  18. data/lib/dodopayments/models/{webhook_create_response.rb → webhook_details.rb} +2 -2
  19. data/lib/dodopayments/models/webhook_retrieve_secret_params.rb +14 -0
  20. data/lib/dodopayments/models/webhook_retrieve_secret_response.rb +16 -0
  21. data/lib/dodopayments/models.rb +12 -2
  22. data/lib/dodopayments/resources/checkout_sessions.rb +61 -0
  23. data/lib/dodopayments/resources/subscriptions.rb +5 -3
  24. data/lib/dodopayments/resources/webhooks.rb +29 -10
  25. data/lib/dodopayments/version.rb +1 -1
  26. data/lib/dodopayments.rb +9 -7
  27. data/rbi/dodopayments/client.rbi +3 -3
  28. data/rbi/dodopayments/errors.rbi +2 -2
  29. data/rbi/dodopayments/models/checkout_session_create_params.rbi +32 -0
  30. data/rbi/dodopayments/models/checkout_session_request.rbi +652 -0
  31. data/rbi/dodopayments/models/checkout_session_response.rbi +40 -0
  32. data/rbi/dodopayments/models/dispute.rbi +4 -4
  33. data/rbi/dodopayments/models/get_dispute.rbi +4 -4
  34. data/rbi/dodopayments/models/license_key.rbi +2 -2
  35. data/rbi/dodopayments/models/on_demand_subscription.rbi +86 -0
  36. data/rbi/dodopayments/models/payment.rbi +8 -8
  37. data/rbi/dodopayments/models/refund.rbi +4 -4
  38. data/rbi/dodopayments/models/subscription.rbi +21 -11
  39. data/rbi/dodopayments/models/subscription_create_params.rbi +4 -90
  40. data/rbi/dodopayments/models/subscription_update_params.rbi +8 -0
  41. data/rbi/dodopayments/models/webhook_create_params.rbi +6 -6
  42. data/rbi/dodopayments/models/{webhook_list_response.rbi → webhook_details.rbi} +2 -5
  43. data/rbi/dodopayments/models/webhook_retrieve_secret_params.rbi +32 -0
  44. data/rbi/dodopayments/models/webhook_retrieve_secret_response.rbi +26 -0
  45. data/rbi/dodopayments/models.rbi +14 -2
  46. data/rbi/dodopayments/resources/checkout_sessions.rbi +80 -0
  47. data/rbi/dodopayments/resources/subscriptions.rbi +4 -2
  48. data/rbi/dodopayments/resources/webhooks.rbi +17 -7
  49. data/sig/dodopayments/client.rbs +2 -2
  50. data/sig/dodopayments/models/checkout_session_create_params.rbs +15 -0
  51. data/sig/dodopayments/models/checkout_session_request.rbs +277 -0
  52. data/sig/dodopayments/models/checkout_session_response.rbs +16 -0
  53. data/sig/dodopayments/models/on_demand_subscription.rbs +40 -0
  54. data/sig/dodopayments/models/subscription.rbs +8 -3
  55. data/sig/dodopayments/models/subscription_create_params.rbs +4 -41
  56. data/sig/dodopayments/models/subscription_update_params.rbs +5 -0
  57. data/sig/dodopayments/models/{webhook_list_response.rbs → webhook_details.rbs} +2 -2
  58. data/sig/dodopayments/models/webhook_retrieve_secret_params.rbs +15 -0
  59. data/sig/dodopayments/models/webhook_retrieve_secret_response.rbs +13 -0
  60. data/sig/dodopayments/models.rbs +12 -2
  61. data/sig/dodopayments/resources/checkout_sessions.rbs +24 -0
  62. data/sig/dodopayments/resources/subscriptions.rbs +2 -1
  63. data/sig/dodopayments/resources/webhooks.rbs +9 -4
  64. metadata +26 -20
  65. data/lib/dodopayments/models/webhook_list_response.rb +0 -88
  66. data/lib/dodopayments/models/webhook_retrieve_response.rb +0 -88
  67. data/lib/dodopayments/models/webhook_update_response.rb +0 -88
  68. data/lib/dodopayments/models/your_webhook_url_create_params.rb +0 -32
  69. data/lib/dodopayments/resources/your_webhook_url.rb +0 -56
  70. data/rbi/dodopayments/models/webhook_create_response.rbi +0 -112
  71. data/rbi/dodopayments/models/webhook_retrieve_response.rbi +0 -112
  72. data/rbi/dodopayments/models/webhook_update_response.rbi +0 -112
  73. data/rbi/dodopayments/models/your_webhook_url_create_params.rbi +0 -56
  74. data/rbi/dodopayments/resources/your_webhook_url.rbi +0 -51
  75. data/sig/dodopayments/models/webhook_create_response.rbs +0 -60
  76. data/sig/dodopayments/models/webhook_retrieve_response.rbs +0 -60
  77. data/sig/dodopayments/models/webhook_update_response.rbs +0 -60
  78. data/sig/dodopayments/models/your_webhook_url_create_params.rbs +0 -42
  79. data/sig/dodopayments/resources/your_webhook_url.rbs +0 -18
@@ -0,0 +1,40 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class CheckoutSessionResponse < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::CheckoutSessionResponse,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Checkout url
15
+ sig { returns(String) }
16
+ attr_accessor :checkout_url
17
+
18
+ # The ID of the created checkout session
19
+ sig { returns(String) }
20
+ attr_accessor :session_id
21
+
22
+ sig do
23
+ params(checkout_url: String, session_id: String).returns(
24
+ T.attached_class
25
+ )
26
+ end
27
+ def self.new(
28
+ # Checkout url
29
+ checkout_url:,
30
+ # The ID of the created checkout session
31
+ session_id:
32
+ )
33
+ end
34
+
35
+ sig { override.returns({ checkout_url: String, session_id: String }) }
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end
@@ -30,11 +30,11 @@ module Dodopayments
30
30
  attr_accessor :dispute_id
31
31
 
32
32
  # The current stage of the dispute process.
33
- sig { returns(Dodopayments::DisputeStage::OrSymbol) }
33
+ sig { returns(Dodopayments::DisputeStage::TaggedSymbol) }
34
34
  attr_accessor :dispute_stage
35
35
 
36
36
  # The current status of the dispute.
37
- sig { returns(Dodopayments::DisputeStatus::OrSymbol) }
37
+ sig { returns(Dodopayments::DisputeStatus::TaggedSymbol) }
38
38
  attr_accessor :dispute_status
39
39
 
40
40
  # The unique identifier of the payment associated with the dispute.
@@ -89,8 +89,8 @@ module Dodopayments
89
89
  created_at: Time,
90
90
  currency: String,
91
91
  dispute_id: String,
92
- dispute_stage: Dodopayments::DisputeStage::OrSymbol,
93
- dispute_status: Dodopayments::DisputeStatus::OrSymbol,
92
+ dispute_stage: Dodopayments::DisputeStage::TaggedSymbol,
93
+ dispute_status: Dodopayments::DisputeStatus::TaggedSymbol,
94
94
  payment_id: String,
95
95
  remarks: T.nilable(String)
96
96
  }
@@ -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
 
@@ -45,6 +46,9 @@ module Dodopayments
45
46
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
46
47
  attr_accessor :metadata
47
48
 
49
+ sig { returns(T.nilable(Time)) }
50
+ attr_accessor :next_billing_date
51
+
48
52
  sig { returns(T.nilable(Dodopayments::SubscriptionStatus::OrSymbol)) }
49
53
  attr_accessor :status
50
54
 
@@ -60,6 +64,7 @@ module Dodopayments
60
64
  Dodopayments::SubscriptionUpdateParams::DisableOnDemand::OrHash
61
65
  ),
62
66
  metadata: T.nilable(T::Hash[Symbol, String]),
67
+ next_billing_date: T.nilable(Time),
63
68
  status: T.nilable(Dodopayments::SubscriptionStatus::OrSymbol),
64
69
  tax_id: T.nilable(String),
65
70
  request_options: Dodopayments::RequestOptions::OrHash
@@ -67,9 +72,11 @@ module Dodopayments
67
72
  end
68
73
  def self.new(
69
74
  billing: nil,
75
+ # When set, the subscription will remain active until the end of billing period
70
76
  cancel_at_next_billing_date: nil,
71
77
  disable_on_demand: nil,
72
78
  metadata: nil,
79
+ next_billing_date: nil,
73
80
  status: nil,
74
81
  tax_id: nil,
75
82
  request_options: {}
@@ -86,6 +93,7 @@ module Dodopayments
86
93
  Dodopayments::SubscriptionUpdateParams::DisableOnDemand
87
94
  ),
88
95
  metadata: T.nilable(T::Hash[Symbol, String]),
96
+ next_billing_date: T.nilable(Time),
89
97
  status: T.nilable(Dodopayments::SubscriptionStatus::OrSymbol),
90
98
  tax_id: T.nilable(String),
91
99
  request_options: Dodopayments::RequestOptions
@@ -18,9 +18,6 @@ module Dodopayments
18
18
  sig { returns(String) }
19
19
  attr_accessor :url
20
20
 
21
- # Filter events to the webhook.
22
- #
23
- # Webhook event will only be sent for events in the list.
24
21
  sig { returns(T.nilable(String)) }
25
22
  attr_accessor :description
26
23
 
@@ -30,6 +27,9 @@ module Dodopayments
30
27
  sig { returns(T.nilable(T::Boolean)) }
31
28
  attr_accessor :disabled
32
29
 
30
+ # Filter events to the webhook.
31
+ #
32
+ # Webhook event will only be sent for events in the list.
33
33
  sig do
34
34
  returns(T.nilable(T::Array[Dodopayments::WebhookEventType::OrSymbol]))
35
35
  end
@@ -73,14 +73,14 @@ module Dodopayments
73
73
  def self.new(
74
74
  # Url of the webhook
75
75
  url:,
76
- # Filter events to the webhook.
77
- #
78
- # Webhook event will only be sent for events in the list.
79
76
  description: nil,
80
77
  # Create the webhook in a disabled state.
81
78
  #
82
79
  # Default is false
83
80
  disabled: nil,
81
+ # Filter events to the webhook.
82
+ #
83
+ # Webhook event will only be sent for events in the list.
84
84
  filter_types: nil,
85
85
  # Custom headers to be passed
86
86
  headers: 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.
@@ -0,0 +1,32 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class WebhookRetrieveSecretParams < Dodopayments::Internal::Type::BaseModel
6
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
7
+ include Dodopayments::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Dodopayments::WebhookRetrieveSecretParams,
13
+ Dodopayments::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ params(request_options: Dodopayments::RequestOptions::OrHash).returns(
19
+ T.attached_class
20
+ )
21
+ end
22
+ def self.new(request_options: {})
23
+ end
24
+
25
+ sig do
26
+ override.returns({ request_options: Dodopayments::RequestOptions })
27
+ end
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,26 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class WebhookRetrieveSecretResponse < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::Models::WebhookRetrieveSecretResponse,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :secret
16
+
17
+ sig { params(secret: String).returns(T.attached_class) }
18
+ def self.new(secret:)
19
+ end
20
+
21
+ sig { override.returns({ secret: String }) }
22
+ def to_hash
23
+ end
24
+ end
25
+ end
26
+ end