dodopayments 2.28.0 → 2.30.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +7 -0
  6. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +7 -0
  7. data/lib/dodopayments/models/checkout_session_flags.rb +30 -1
  8. data/lib/dodopayments/models/checkout_session_preview_response.rb +86 -4
  9. data/lib/dodopayments/models/checkout_session_request.rb +4 -1
  10. data/lib/dodopayments/models/customers/email_failure_code.rb +1 -0
  11. data/lib/dodopayments/models/customers/email_log_item.rb +4 -12
  12. data/lib/dodopayments/models/customers/email_policies.rb +14 -1
  13. data/lib/dodopayments/models/discount_create_params.rb +11 -8
  14. data/lib/dodopayments/models/discount_update_params.rb +6 -5
  15. data/lib/dodopayments/models/moderation_category.rb +31 -0
  16. data/lib/dodopayments/models/moderation_category_provenance.rb +150 -0
  17. data/lib/dodopayments/models/moderation_category_scores.rb +150 -0
  18. data/lib/dodopayments/models/moderation_decision.rb +18 -0
  19. data/lib/dodopayments/models/moderation_provenance.rb +18 -0
  20. data/lib/dodopayments/models/moderation_retrieve_usage_params.rb +14 -0
  21. data/lib/dodopayments/models/moderation_retrieve_usage_response.rb +61 -0
  22. data/lib/dodopayments/models/moderation_screen_params.rb +44 -0
  23. data/lib/dodopayments/models/moderation_screen_response.rb +99 -0
  24. data/lib/dodopayments/models/payment.rb +25 -3
  25. data/lib/dodopayments/models/payment_list_response.rb +21 -1
  26. data/lib/dodopayments/models/payouts/breakup/detail_list_response.rb +5 -4
  27. data/lib/dodopayments/models/payouts/breakup_retrieve_response.rb +17 -1
  28. data/lib/dodopayments/models.rb +14 -0
  29. data/lib/dodopayments/resources/checkout_sessions.rb +2 -2
  30. data/lib/dodopayments/resources/moderation.rb +81 -0
  31. data/lib/dodopayments/resources/payouts/breakup/details.rb +4 -4
  32. data/lib/dodopayments/version.rb +1 -1
  33. data/lib/dodopayments.rb +10 -0
  34. data/rbi/dodopayments/client.rbi +3 -0
  35. data/rbi/dodopayments/models/balance_ledger_entry.rbi +35 -0
  36. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +35 -0
  37. data/rbi/dodopayments/models/checkout_session_flags.rbi +48 -0
  38. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +130 -6
  39. data/rbi/dodopayments/models/checkout_session_request.rbi +6 -0
  40. data/rbi/dodopayments/models/customers/email_failure_code.rbi +5 -0
  41. data/rbi/dodopayments/models/customers/email_log_item.rbi +4 -12
  42. data/rbi/dodopayments/models/customers/email_policies.rbi +15 -3
  43. data/rbi/dodopayments/models/discount_create_params.rbi +18 -12
  44. data/rbi/dodopayments/models/discount_update_params.rbi +8 -6
  45. data/rbi/dodopayments/models/moderation_category.rbi +88 -0
  46. data/rbi/dodopayments/models/moderation_category_provenance.rbi +184 -0
  47. data/rbi/dodopayments/models/moderation_category_scores.rbi +171 -0
  48. data/rbi/dodopayments/models/moderation_decision.rbi +27 -0
  49. data/rbi/dodopayments/models/moderation_provenance.rbi +28 -0
  50. data/rbi/dodopayments/models/moderation_retrieve_usage_params.rbi +32 -0
  51. data/rbi/dodopayments/models/moderation_retrieve_usage_response.rbi +104 -0
  52. data/rbi/dodopayments/models/moderation_screen_params.rbi +68 -0
  53. data/rbi/dodopayments/models/moderation_screen_response.rbi +135 -0
  54. data/rbi/dodopayments/models/payment.rbi +30 -2
  55. data/rbi/dodopayments/models/payment_list_response.rbi +24 -0
  56. data/rbi/dodopayments/models/payouts/breakup/detail_list_response.rbi +8 -6
  57. data/rbi/dodopayments/models/payouts/breakup_retrieve_response.rbi +19 -2
  58. data/rbi/dodopayments/models.rbi +16 -0
  59. data/rbi/dodopayments/resources/checkout_sessions.rbi +6 -0
  60. data/rbi/dodopayments/resources/discounts.rbi +5 -3
  61. data/rbi/dodopayments/resources/moderation.rbi +64 -0
  62. data/rbi/dodopayments/resources/payouts/breakup/details.rbi +4 -4
  63. data/sig/dodopayments/client.rbs +2 -0
  64. data/sig/dodopayments/models/balance_ledger_entry.rbs +14 -0
  65. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +14 -0
  66. data/sig/dodopayments/models/checkout_session_flags.rbs +14 -0
  67. data/sig/dodopayments/models/checkout_session_preview_response.rbs +52 -0
  68. data/sig/dodopayments/models/customers/email_failure_code.rbs +2 -0
  69. data/sig/dodopayments/models/customers/email_log_item.rbs +0 -5
  70. data/sig/dodopayments/models/customers/email_policies.rbs +8 -3
  71. data/sig/dodopayments/models/moderation_category.rbs +46 -0
  72. data/sig/dodopayments/models/moderation_category_provenance.rbs +100 -0
  73. data/sig/dodopayments/models/moderation_category_scores.rbs +100 -0
  74. data/sig/dodopayments/models/moderation_decision.rbs +15 -0
  75. data/sig/dodopayments/models/moderation_provenance.rbs +14 -0
  76. data/sig/dodopayments/models/moderation_retrieve_usage_params.rbs +15 -0
  77. data/sig/dodopayments/models/moderation_retrieve_usage_response.rbs +42 -0
  78. data/sig/dodopayments/models/moderation_screen_params.rbs +32 -0
  79. data/sig/dodopayments/models/moderation_screen_response.rbs +65 -0
  80. data/sig/dodopayments/models/payment.rbs +10 -0
  81. data/sig/dodopayments/models/payment_list_response.rbs +10 -0
  82. data/sig/dodopayments/models.rbs +14 -0
  83. data/sig/dodopayments/resources/moderation.rbs +18 -0
  84. metadata +32 -2
@@ -0,0 +1,104 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class ModerationRetrieveUsageResponse < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::Models::ModerationRetrieveUsageResponse,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Your billable screens per UTC day for the last 30 days, charged or not. A day
15
+ # with no screens is not in the list.
16
+ sig do
17
+ returns(
18
+ T::Array[Dodopayments::Models::ModerationRetrieveUsageResponse::Daily]
19
+ )
20
+ end
21
+ attr_accessor :daily
22
+
23
+ # Billable screens still needed to fill the next block of 1000. A full block is
24
+ # charged within one hour, so this value is 1000 when your unbilled screens fill
25
+ # whole blocks.
26
+ sig { returns(Integer) }
27
+ attr_accessor :screens_to_next_block
28
+
29
+ # Billable screens that Dodo Payments has not charged for yet.
30
+ sig { returns(Integer) }
31
+ attr_accessor :unbilled_screens
32
+
33
+ # Your moderation usage.
34
+ sig do
35
+ params(
36
+ daily:
37
+ T::Array[
38
+ Dodopayments::Models::ModerationRetrieveUsageResponse::Daily::OrHash
39
+ ],
40
+ screens_to_next_block: Integer,
41
+ unbilled_screens: Integer
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(
45
+ # Your billable screens per UTC day for the last 30 days, charged or not. A day
46
+ # with no screens is not in the list.
47
+ daily:,
48
+ # Billable screens still needed to fill the next block of 1000. A full block is
49
+ # charged within one hour, so this value is 1000 when your unbilled screens fill
50
+ # whole blocks.
51
+ screens_to_next_block:,
52
+ # Billable screens that Dodo Payments has not charged for yet.
53
+ unbilled_screens:
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ daily:
61
+ T::Array[
62
+ Dodopayments::Models::ModerationRetrieveUsageResponse::Daily
63
+ ],
64
+ screens_to_next_block: Integer,
65
+ unbilled_screens: Integer
66
+ }
67
+ )
68
+ end
69
+ def to_hash
70
+ end
71
+
72
+ class Daily < Dodopayments::Internal::Type::BaseModel
73
+ OrHash =
74
+ T.type_alias do
75
+ T.any(
76
+ Dodopayments::Models::ModerationRetrieveUsageResponse::Daily,
77
+ Dodopayments::Internal::AnyHash
78
+ )
79
+ end
80
+
81
+ # The UTC day.
82
+ sig { returns(Date) }
83
+ attr_accessor :date
84
+
85
+ # Billable screens on that day.
86
+ sig { returns(Integer) }
87
+ attr_accessor :screens
88
+
89
+ sig { params(date: Date, screens: Integer).returns(T.attached_class) }
90
+ def self.new(
91
+ # The UTC day.
92
+ date:,
93
+ # Billable screens on that day.
94
+ screens:
95
+ )
96
+ end
97
+
98
+ sig { override.returns({ date: Date, screens: Integer }) }
99
+ def to_hash
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,68 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class ModerationScreenParams < 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::ModerationScreenParams,
13
+ Dodopayments::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The image to screen, as base64, with or without a `data:image/...;base64,`
18
+ # prefix. The formats are JPEG, PNG, WebP, GIF and BMP. The limit is 6991530
19
+ # base64 characters, and the decoded image must be at most 5 MiB.
20
+ sig { returns(T.nilable(String)) }
21
+ attr_accessor :image
22
+
23
+ # Your identifier for this screen, up to 128 characters, with no control
24
+ # characters. The response returns it in `request_id`.
25
+ sig { returns(T.nilable(String)) }
26
+ attr_accessor :request_id
27
+
28
+ # The text to screen, up to 8000 characters.
29
+ sig { returns(T.nilable(String)) }
30
+ attr_accessor :text
31
+
32
+ sig do
33
+ params(
34
+ image: T.nilable(String),
35
+ request_id: T.nilable(String),
36
+ text: T.nilable(String),
37
+ request_options: Dodopayments::RequestOptions::OrHash
38
+ ).returns(T.attached_class)
39
+ end
40
+ def self.new(
41
+ # The image to screen, as base64, with or without a `data:image/...;base64,`
42
+ # prefix. The formats are JPEG, PNG, WebP, GIF and BMP. The limit is 6991530
43
+ # base64 characters, and the decoded image must be at most 5 MiB.
44
+ image: nil,
45
+ # Your identifier for this screen, up to 128 characters, with no control
46
+ # characters. The response returns it in `request_id`.
47
+ request_id: nil,
48
+ # The text to screen, up to 8000 characters.
49
+ text: nil,
50
+ request_options: {}
51
+ )
52
+ end
53
+
54
+ sig do
55
+ override.returns(
56
+ {
57
+ image: T.nilable(String),
58
+ request_id: T.nilable(String),
59
+ text: T.nilable(String),
60
+ request_options: Dodopayments::RequestOptions
61
+ }
62
+ )
63
+ end
64
+ def to_hash
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,135 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class ModerationScreenResponse < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::Models::ModerationScreenResponse,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The probability, from 0 to 1, that the screen falls in each category.
15
+ sig { returns(Dodopayments::ModerationCategoryScores) }
16
+ attr_reader :categories
17
+
18
+ sig do
19
+ params(categories: Dodopayments::ModerationCategoryScores::OrHash).void
20
+ end
21
+ attr_writer :categories
22
+
23
+ # True when real-person likeness and sexual content together crossed their
24
+ # combined threshold, the pattern of a sexual deepfake.
25
+ sig { returns(T::Boolean) }
26
+ attr_accessor :compound_triggered
27
+
28
+ # The verdict. `allow` means the content passed. `deny` means block the content.
29
+ # `flag` means apply your own judgement. It is not a soft deny.
30
+ sig { returns(Dodopayments::ModerationDecision::TaggedSymbol) }
31
+ attr_accessor :decision
32
+
33
+ # The time the screen took, in milliseconds.
34
+ sig { returns(Integer) }
35
+ attr_accessor :latency_ms
36
+
37
+ # True when the text was also screened in a normalized form, with obfuscation such
38
+ # as invisible or look-alike characters removed.
39
+ sig { returns(T::Boolean) }
40
+ attr_accessor :normalized_applied
41
+
42
+ # Human-readable reasons for the decision. The wording can change, so do not parse
43
+ # it.
44
+ sig { returns(T::Array[String]) }
45
+ attr_accessor :notes
46
+
47
+ # The number of yes/no questions the model answered for this screen.
48
+ sig { returns(Integer) }
49
+ attr_accessor :passes
50
+
51
+ # How each score in `categories` was measured.
52
+ sig { returns(Dodopayments::ModerationCategoryProvenance) }
53
+ attr_reader :provenance
54
+
55
+ sig do
56
+ params(
57
+ provenance: Dodopayments::ModerationCategoryProvenance::OrHash
58
+ ).void
59
+ end
60
+ attr_writer :provenance
61
+
62
+ # The `request_id` you sent, or null.
63
+ sig { returns(T.nilable(String)) }
64
+ attr_accessor :request_id
65
+
66
+ # The categories whose score crossed the threshold of the category. It can be
67
+ # empty on a `flag` from the general check. `notes` then gives the reason.
68
+ sig { returns(T::Array[Dodopayments::ModerationCategory::TaggedSymbol]) }
69
+ attr_accessor :triggered
70
+
71
+ # The verdict of one screen.
72
+ sig do
73
+ params(
74
+ categories: Dodopayments::ModerationCategoryScores::OrHash,
75
+ compound_triggered: T::Boolean,
76
+ decision: Dodopayments::ModerationDecision::OrSymbol,
77
+ latency_ms: Integer,
78
+ normalized_applied: T::Boolean,
79
+ notes: T::Array[String],
80
+ passes: Integer,
81
+ provenance: Dodopayments::ModerationCategoryProvenance::OrHash,
82
+ request_id: T.nilable(String),
83
+ triggered: T::Array[Dodopayments::ModerationCategory::OrSymbol]
84
+ ).returns(T.attached_class)
85
+ end
86
+ def self.new(
87
+ # The probability, from 0 to 1, that the screen falls in each category.
88
+ categories:,
89
+ # True when real-person likeness and sexual content together crossed their
90
+ # combined threshold, the pattern of a sexual deepfake.
91
+ compound_triggered:,
92
+ # The verdict. `allow` means the content passed. `deny` means block the content.
93
+ # `flag` means apply your own judgement. It is not a soft deny.
94
+ decision:,
95
+ # The time the screen took, in milliseconds.
96
+ latency_ms:,
97
+ # True when the text was also screened in a normalized form, with obfuscation such
98
+ # as invisible or look-alike characters removed.
99
+ normalized_applied:,
100
+ # Human-readable reasons for the decision. The wording can change, so do not parse
101
+ # it.
102
+ notes:,
103
+ # The number of yes/no questions the model answered for this screen.
104
+ passes:,
105
+ # How each score in `categories` was measured.
106
+ provenance:,
107
+ # The `request_id` you sent, or null.
108
+ request_id:,
109
+ # The categories whose score crossed the threshold of the category. It can be
110
+ # empty on a `flag` from the general check. `notes` then gives the reason.
111
+ triggered:
112
+ )
113
+ end
114
+
115
+ sig do
116
+ override.returns(
117
+ {
118
+ categories: Dodopayments::ModerationCategoryScores,
119
+ compound_triggered: T::Boolean,
120
+ decision: Dodopayments::ModerationDecision::TaggedSymbol,
121
+ latency_ms: Integer,
122
+ normalized_applied: T::Boolean,
123
+ notes: T::Array[String],
124
+ passes: Integer,
125
+ provenance: Dodopayments::ModerationCategoryProvenance,
126
+ request_id: T.nilable(String),
127
+ triggered: T::Array[Dodopayments::ModerationCategory::TaggedSymbol]
128
+ }
129
+ )
130
+ end
131
+ def to_hash
132
+ end
133
+ end
134
+ end
135
+ end
@@ -48,6 +48,12 @@ module Dodopayments
48
48
  sig { returns(T::Array[Dodopayments::Dispute]) }
49
49
  attr_accessor :disputes
50
50
 
51
+ # True when one payment starts more than one subscription. Read this field to find
52
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
53
+ # `subscription_id` for null.
54
+ sig { returns(T::Boolean) }
55
+ attr_accessor :is_multi_subscription
56
+
51
57
  # Whether this payment was created solely to update a subscription's payment
52
58
  # method (a zero-/setup-amount charge). `false` for normal charges.
53
59
  sig { returns(T::Boolean) }
@@ -88,6 +94,12 @@ module Dodopayments
88
94
  sig { returns(Dodopayments::Currency::TaggedSymbol) }
89
95
  attr_accessor :settlement_currency
90
96
 
97
+ # Every subscription that this payment starts or charges, in a stable order. It is
98
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
99
+ # payment names one subscription.
100
+ sig { returns(T::Array[String]) }
101
+ attr_accessor :subscription_ids
102
+
91
103
  # Total amount charged to the customer including tax, in the currency's smallest
92
104
  # unit (e.g. cents for USD, yen for JPY, fils for KWD — see the currency's decimal
93
105
  # places)
@@ -186,7 +198,9 @@ module Dodopayments
186
198
  sig { returns(T.nilable(Dodopayments::IntentStatus::TaggedSymbol)) }
187
199
  attr_accessor :status
188
200
 
189
- # Identifier of the subscription if payment is part of a subscription
201
+ # Identifier of the subscription if payment is part of a subscription. A
202
+ # multi-subscription payment leaves this null, because no single subscription owns
203
+ # the payment. Read `subscription_ids` for those.
190
204
  sig { returns(T.nilable(String)) }
191
205
  attr_accessor :subscription_id
192
206
 
@@ -209,6 +223,7 @@ module Dodopayments
209
223
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
210
224
  digital_products_delivered: T::Boolean,
211
225
  disputes: T::Array[Dodopayments::Dispute::OrHash],
226
+ is_multi_subscription: T::Boolean,
212
227
  is_update_payment_method: T::Boolean,
213
228
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
214
229
  payment_id: String,
@@ -217,6 +232,7 @@ module Dodopayments
217
232
  retry_attempt: Integer,
218
233
  settlement_amount: Integer,
219
234
  settlement_currency: Dodopayments::Currency::OrSymbol,
235
+ subscription_ids: T::Array[String],
220
236
  total_amount: Integer,
221
237
  card_holder_name: T.nilable(String),
222
238
  card_issuing_country: T.nilable(Dodopayments::CountryCode::OrSymbol),
@@ -263,6 +279,10 @@ module Dodopayments
263
279
  digital_products_delivered:,
264
280
  # List of disputes associated with this payment
265
281
  disputes:,
282
+ # True when one payment starts more than one subscription. Read this field to find
283
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
284
+ # `subscription_id` for null.
285
+ is_multi_subscription:,
266
286
  # Whether this payment was created solely to update a subscription's payment
267
287
  # method (a zero-/setup-amount charge). `false` for normal charges.
268
288
  is_update_payment_method:,
@@ -287,6 +307,10 @@ module Dodopayments
287
307
  # balance. This may differ from the customer's payment currency in adaptive
288
308
  # pricing scenarios.
289
309
  settlement_currency:,
310
+ # Every subscription that this payment starts or charges, in a stable order. It is
311
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
312
+ # payment names one subscription.
313
+ subscription_ids:,
290
314
  # Total amount charged to the customer including tax, in the currency's smallest
291
315
  # unit (e.g. cents for USD, yen for JPY, fils for KWD — see the currency's decimal
292
316
  # places)
@@ -339,7 +363,9 @@ module Dodopayments
339
363
  settlement_tax: nil,
340
364
  # Current status of the payment intent
341
365
  status: nil,
342
- # Identifier of the subscription if payment is part of a subscription
366
+ # Identifier of the subscription if payment is part of a subscription. A
367
+ # multi-subscription payment leaves this null, because no single subscription owns
368
+ # the payment. Read `subscription_ids` for those.
343
369
  subscription_id: nil,
344
370
  # Amount of tax collected in the currency's smallest unit (e.g. cents for USD, yen
345
371
  # for JPY, fils for KWD)
@@ -360,6 +386,7 @@ module Dodopayments
360
386
  customer: Dodopayments::CustomerLimitedDetails,
361
387
  digital_products_delivered: T::Boolean,
362
388
  disputes: T::Array[Dodopayments::Dispute],
389
+ is_multi_subscription: T::Boolean,
363
390
  is_update_payment_method: T::Boolean,
364
391
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
365
392
  payment_id: String,
@@ -369,6 +396,7 @@ module Dodopayments
369
396
  retry_attempt: Integer,
370
397
  settlement_amount: Integer,
371
398
  settlement_currency: Dodopayments::Currency::TaggedSymbol,
399
+ subscription_ids: T::Array[String],
372
400
  total_amount: Integer,
373
401
  card_holder_name: T.nilable(String),
374
402
  card_issuing_country:
@@ -34,6 +34,12 @@ module Dodopayments
34
34
  sig { returns(T::Boolean) }
35
35
  attr_accessor :has_license_key
36
36
 
37
+ # True when one payment starts more than one subscription. Read this field to find
38
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
39
+ # `subscription_id` for null.
40
+ sig { returns(T::Boolean) }
41
+ attr_accessor :is_multi_subscription
42
+
37
43
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
38
44
  sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
39
45
  attr_accessor :metadata
@@ -50,6 +56,12 @@ module Dodopayments
50
56
  end
51
57
  attr_accessor :payment_provider
52
58
 
59
+ # Every subscription that this payment starts or charges, in a stable order. It is
60
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
61
+ # payment names one subscription.
62
+ sig { returns(T::Array[String]) }
63
+ attr_accessor :subscription_ids
64
+
53
65
  sig { returns(Integer) }
54
66
  attr_accessor :total_amount
55
67
 
@@ -100,10 +112,12 @@ module Dodopayments
100
112
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
101
113
  digital_products_delivered: T::Boolean,
102
114
  has_license_key: T::Boolean,
115
+ is_multi_subscription: T::Boolean,
103
116
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
104
117
  payment_id: String,
105
118
  payment_provider:
106
119
  Dodopayments::Models::PaymentListResponse::PaymentProvider::OrSymbol,
120
+ subscription_ids: T::Array[String],
107
121
  total_amount: Integer,
108
122
  card_last_four: T.nilable(String),
109
123
  card_network: T.nilable(String),
@@ -124,12 +138,20 @@ module Dodopayments
124
138
  customer:,
125
139
  digital_products_delivered:,
126
140
  has_license_key:,
141
+ # True when one payment starts more than one subscription. Read this field to find
142
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
143
+ # `subscription_id` for null.
144
+ is_multi_subscription:,
127
145
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
128
146
  metadata:,
129
147
  payment_id:,
130
148
  # Which processor handled this payment. `stripe` / `adyen` for BYOP routes (the
131
149
  # merchant's own payment connector); `dodo` for everything Dodo processed itself.
132
150
  payment_provider:,
151
+ # Every subscription that this payment starts or charges, in a stable order. It is
152
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
153
+ # payment names one subscription.
154
+ subscription_ids:,
133
155
  total_amount:,
134
156
  # The last four digits of the card
135
157
  card_last_four: nil,
@@ -160,10 +182,12 @@ module Dodopayments
160
182
  customer: Dodopayments::CustomerLimitedDetails,
161
183
  digital_products_delivered: T::Boolean,
162
184
  has_license_key: T::Boolean,
185
+ is_multi_subscription: T::Boolean,
163
186
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
164
187
  payment_id: String,
165
188
  payment_provider:
166
189
  Dodopayments::Models::PaymentListResponse::PaymentProvider::TaggedSymbol,
190
+ subscription_ids: T::Array[String],
167
191
  total_amount: Integer,
168
192
  card_last_four: T.nilable(String),
169
193
  card_network: T.nilable(String),
@@ -36,8 +36,9 @@ module Dodopayments
36
36
  attr_accessor :original_currency
37
37
 
38
38
  # Amount in the payout's currency, in that currency's smallest unit (cents for
39
- # USD, yen for JPY, fils for KWD). Uses cumulative rounding to ensure sum matches
40
- # payout total exactly.
39
+ # USD, yen for JPY, fils for KWD). The entry is converted at the rate the payout
40
+ # settled at. These amounts sum to the value of the entries, which can be less
41
+ # than the payout: the grouped breakup reports the difference as `unattributed`.
41
42
  sig { returns(Integer) }
42
43
  attr_accessor :payout_currency_amount
43
44
 
@@ -53,8 +54,8 @@ module Dodopayments
53
54
  sig { returns(T.nilable(String)) }
54
55
  attr_accessor :reference_object_id
55
56
 
56
- # Individual balance ledger entry for a payout, with amounts pro-rated into the
57
- # payout's currency.
57
+ # Individual balance ledger entry for a payout, converted into the payout's
58
+ # currency.
58
59
  sig do
59
60
  params(
60
61
  id: String,
@@ -82,8 +83,9 @@ module Dodopayments
82
83
  # Original currency as ISO 4217 code (e.g., "USD", "EUR").
83
84
  original_currency:,
84
85
  # Amount in the payout's currency, in that currency's smallest unit (cents for
85
- # USD, yen for JPY, fils for KWD). Uses cumulative rounding to ensure sum matches
86
- # payout total exactly.
86
+ # USD, yen for JPY, fils for KWD). The entry is converted at the rate the payout
87
+ # settled at. These amounts sum to the value of the entries, which can be less
88
+ # than the payout: the grouped breakup reports the difference as `unattributed`.
87
89
  payout_currency_amount:,
88
90
  # USD equivalent of the original amount (in cents).
89
91
  usd_equivalent_amount:,
@@ -13,7 +13,8 @@ module Dodopayments
13
13
  end
14
14
 
15
15
  # The type of balance ledger event (e.g., "payment", "refund", "dispute",
16
- # "payment_fees").
16
+ # "payment_fees"), or `unattributed` for the payout amount the entries do not
17
+ # account for.
17
18
  sig { returns(String) }
18
19
  attr_accessor :event_type
19
20
 
@@ -23,12 +24,28 @@ module Dodopayments
23
24
  attr_accessor :total
24
25
 
25
26
  # Payout breakup aggregated by event type, with amounts in the payout's currency.
27
+ #
28
+ # The rows sum to the payout amount. The last row can be `unattributed`, which is
29
+ # not a ledger event type. It holds the payout amount less the entries that fund
30
+ # it, and it takes either sign:
31
+ #
32
+ # - Positive: the entries come to less than the payout, so the payout drew on the
33
+ # balance an earlier cycle left over. A cycle of refunds and disputes produces a
34
+ # large positive value.
35
+ # - Negative: the entries come to more than the payout, and the remainder funds a
36
+ # later payout. This is the common case, for two reasons. The walk that claims
37
+ # the entries stops at the first one that reaches its target, so it passes the
38
+ # target by part of an entry. The target is also the gross debit, which holds
39
+ # the payout fee, and the fee is not a line here.
40
+ #
41
+ # The row is absent when the two are equal.
26
42
  sig do
27
43
  params(event_type: String, total: Integer).returns(T.attached_class)
28
44
  end
29
45
  def self.new(
30
46
  # The type of balance ledger event (e.g., "payment", "refund", "dispute",
31
- # "payment_fees").
47
+ # "payment_fees"), or `unattributed` for the payout amount the entries do not
48
+ # account for.
32
49
  event_type:,
33
50
  # Total amount for this event type in the payout's currency, in that currency's
34
51
  # smallest unit (cents for USD, yen for JPY, fils for KWD).
@@ -357,6 +357,22 @@ module Dodopayments
357
357
  MiscListSupportedCountriesParams =
358
358
  Dodopayments::Models::MiscListSupportedCountriesParams
359
359
 
360
+ ModerationCategory = Dodopayments::Models::ModerationCategory
361
+
362
+ ModerationCategoryProvenance =
363
+ Dodopayments::Models::ModerationCategoryProvenance
364
+
365
+ ModerationCategoryScores = Dodopayments::Models::ModerationCategoryScores
366
+
367
+ ModerationDecision = Dodopayments::Models::ModerationDecision
368
+
369
+ ModerationProvenance = Dodopayments::Models::ModerationProvenance
370
+
371
+ ModerationRetrieveUsageParams =
372
+ Dodopayments::Models::ModerationRetrieveUsageParams
373
+
374
+ ModerationScreenParams = Dodopayments::Models::ModerationScreenParams
375
+
360
376
  NewCustomer = Dodopayments::Models::NewCustomer
361
377
 
362
378
  OnDemandSubscription = Dodopayments::Models::OnDemandSubscription
@@ -42,6 +42,9 @@ module Dodopayments
42
42
  ).returns(Dodopayments::CheckoutSessionResponse)
43
43
  end
44
44
  def create(
45
+ # The products of the checkout. A cart holds at most 20 of them, one-time and
46
+ # subscription products together. An empty cart is valid for the
47
+ # product-collection flow, where the customer chooses the product later.
45
48
  product_cart:,
46
49
  # Customers will never see payment methods that are not in this list. However,
47
50
  # adding a method here does not guarantee customers will see it. Availability
@@ -163,6 +166,9 @@ module Dodopayments
163
166
  ).returns(Dodopayments::Models::CheckoutSessionPreviewResponse)
164
167
  end
165
168
  def preview(
169
+ # The products of the checkout. A cart holds at most 20 of them, one-time and
170
+ # subscription products together. An empty cart is valid for the
171
+ # product-collection flow, where the customer chooses the product later.
166
172
  product_cart:,
167
173
  # Customers will never see payment methods that are not in this list. However,
168
174
  # adding a method here does not guarantee customers will see it. Availability
@@ -46,9 +46,11 @@ module Dodopayments
46
46
  # - If omitted, a random 16-character code is generated.
47
47
  code: nil,
48
48
  # Per-currency options (flat deduction / percentage cap + minimum subtotal).
49
- # Required for `flat` codes (must include a resolvable default); optional
50
- # per-currency caps for `percentage` codes. Per-row invariants are checked in
51
- # `normalize_currency_options`, not via `#[validate(nested)]`.
49
+ # Checkout uses the row for the currency the buyer pays in. For any other currency
50
+ # it converts the default row. Required for `flat` codes (must include a
51
+ # resolvable default); optional per-currency caps for `percentage` codes. Per-row
52
+ # invariants are checked in `normalize_currency_options`, not via
53
+ # `#[validate(nested)]`.
52
54
  currency_options: nil,
53
55
  # Who may redeem this discount code. Defaults to `any` (unrestricted). `specific`
54
56
  # starts with zero attached customers (fails closed) until customers are attached
@@ -0,0 +1,64 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Moderation
6
+ # Shows how many billable screens you made and how close you are to your next
7
+ # charge.
8
+ #
9
+ # **Billing.** A billable screen is a live-mode screen that returns a verdict.
10
+ # Dodo Payments charges $0.30 for each full block of 1000 billable screens and
11
+ # debits the fee from your balance. Each full block is charged within one hour.
12
+ # Screens that do not fill a block stay unbilled until they do. Errors and
13
+ # test-mode screens are free and are not counted.
14
+ sig do
15
+ params(request_options: Dodopayments::RequestOptions::OrHash).returns(
16
+ Dodopayments::Models::ModerationRetrieveUsageResponse
17
+ )
18
+ end
19
+ def retrieve_usage(request_options: {})
20
+ end
21
+
22
+ # Screens text, an image, or both, and returns a verdict: `allow`, `flag` or
23
+ # `deny`. The API is fail-closed: do not generate when you get no verdict.
24
+ #
25
+ # **Pricing.** Dodo Payments charges $0.30 per 1000 billable screens and debits
26
+ # the fee from your balance. A billable screen is a live-mode screen that returns
27
+ # a verdict. Errors and test-mode screens are free.
28
+ #
29
+ # **429.** Honour `Retry-After` and retry. A 429 is a throughput limit, not a
30
+ # verdict.
31
+ #
32
+ # **Test mode** returns mock verdicts and never calls the model. The default
33
+ # verdict is `allow`. Put one of these strings in `text` to select another
34
+ # outcome: `dodo_mock_flag` (`flag`), `dodo_mock_deny` (`deny`),
35
+ # `dodo_mock_overloaded` (429) or `dodo_mock_not_ready` (503).
36
+ sig do
37
+ params(
38
+ image: T.nilable(String),
39
+ request_id: T.nilable(String),
40
+ text: T.nilable(String),
41
+ request_options: Dodopayments::RequestOptions::OrHash
42
+ ).returns(Dodopayments::Models::ModerationScreenResponse)
43
+ end
44
+ def screen(
45
+ # The image to screen, as base64, with or without a `data:image/...;base64,`
46
+ # prefix. The formats are JPEG, PNG, WebP, GIF and BMP. The limit is 6991530
47
+ # base64 characters, and the decoded image must be at most 5 MiB.
48
+ image: nil,
49
+ # Your identifier for this screen, up to 128 characters, with no control
50
+ # characters. The response returns it in `request_id`.
51
+ request_id: nil,
52
+ # The text to screen, up to 8000 characters.
53
+ text: nil,
54
+ request_options: {}
55
+ )
56
+ end
57
+
58
+ # @api private
59
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
60
+ def self.new(client:)
61
+ end
62
+ end
63
+ end
64
+ end