dodopayments 2.32.2 → 2.34.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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/type/enum.rb +11 -11
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +3 -0
  6. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +3 -0
  7. data/lib/dodopayments/models/charge_type.rb +33 -0
  8. data/lib/dodopayments/models/checkout_session_flags.rb +3 -0
  9. data/lib/dodopayments/models/checkout_session_preview_response.rb +12 -1
  10. data/lib/dodopayments/models/invoices/payment_retrieve_params.rb +14 -1
  11. data/lib/dodopayments/models/invoices/payment_retrieve_payout_params.rb +14 -1
  12. data/lib/dodopayments/models/invoices/payment_retrieve_refund_params.rb +14 -1
  13. data/lib/dodopayments/models/manual_retry_state.rb +27 -1
  14. data/lib/dodopayments/models/payment.rb +69 -7
  15. data/lib/dodopayments/models/payment_list_response.rb +94 -5
  16. data/lib/dodopayments/models/price.rb +56 -20
  17. data/lib/dodopayments/models/product_collection.rb +2 -0
  18. data/lib/dodopayments/models/product_collection_create_params.rb +2 -0
  19. data/lib/dodopayments/models/product_collection_update_params.rb +2 -0
  20. data/lib/dodopayments/models/product_collections/group_update_params.rb +2 -1
  21. data/lib/dodopayments/models/refund.rb +11 -1
  22. data/lib/dodopayments/models/refund_list_item.rb +11 -1
  23. data/lib/dodopayments/models/subscription_active_webhook_event.rb +10 -1
  24. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +10 -1
  25. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +10 -1
  26. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +10 -1
  27. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +10 -1
  28. data/lib/dodopayments/models/subscription_past_due_webhook_event.rb +10 -1
  29. data/lib/dodopayments/models/subscription_paused_webhook_event.rb +10 -1
  30. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +10 -1
  31. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +10 -1
  32. data/lib/dodopayments/models/subscription_service_period.rb +50 -0
  33. data/lib/dodopayments/models/subscription_unpaused_webhook_event.rb +10 -1
  34. data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +10 -1
  35. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +10 -1
  36. data/lib/dodopayments/models/update_subscription_plan_req.rb +1 -0
  37. data/lib/dodopayments/models/webhook_payload.rb +10 -1
  38. data/lib/dodopayments/models.rb +4 -0
  39. data/lib/dodopayments/resources/invoices/payments.rb +30 -6
  40. data/lib/dodopayments/version.rb +1 -1
  41. data/lib/dodopayments.rb +2 -0
  42. data/rbi/dodopayments/models/balance_ledger_entry.rbi +15 -0
  43. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +15 -0
  44. data/rbi/dodopayments/models/charge_type.rbi +37 -0
  45. data/rbi/dodopayments/models/checkout_session_flags.rbi +6 -0
  46. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +14 -0
  47. data/rbi/dodopayments/models/invoices/payment_retrieve_params.rbi +17 -1
  48. data/rbi/dodopayments/models/invoices/payment_retrieve_payout_params.rbi +21 -2
  49. data/rbi/dodopayments/models/invoices/payment_retrieve_refund_params.rbi +21 -2
  50. data/rbi/dodopayments/models/manual_retry_state.rbi +28 -0
  51. data/rbi/dodopayments/models/payment.rbi +85 -6
  52. data/rbi/dodopayments/models/payment_list_response.rbi +113 -4
  53. data/rbi/dodopayments/models/price.rbi +96 -24
  54. data/rbi/dodopayments/models/product_collection.rbi +10 -0
  55. data/rbi/dodopayments/models/product_collection_create_params.rbi +10 -0
  56. data/rbi/dodopayments/models/product_collection_update_params.rbi +10 -0
  57. data/rbi/dodopayments/models/product_collections/group_update_params.rbi +4 -2
  58. data/rbi/dodopayments/models/refund.rbi +12 -0
  59. data/rbi/dodopayments/models/refund_list_item.rbi +12 -0
  60. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +18 -3
  61. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +18 -3
  62. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +18 -3
  63. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +18 -3
  64. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +18 -3
  65. data/rbi/dodopayments/models/subscription_past_due_webhook_event.rbi +18 -3
  66. data/rbi/dodopayments/models/subscription_paused_webhook_event.rbi +18 -3
  67. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +18 -3
  68. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +18 -3
  69. data/rbi/dodopayments/models/subscription_service_period.rbi +75 -0
  70. data/rbi/dodopayments/models/subscription_unpaused_webhook_event.rbi +18 -3
  71. data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +18 -3
  72. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +18 -3
  73. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +5 -0
  74. data/rbi/dodopayments/models/webhook_payload.rbi +14 -1
  75. data/rbi/dodopayments/models.rbi +4 -0
  76. data/rbi/dodopayments/resources/invoices/payments.rbi +12 -0
  77. data/rbi/dodopayments/resources/product_collections/groups.rbi +2 -1
  78. data/sig/dodopayments/models/balance_ledger_entry.rbs +6 -0
  79. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +6 -0
  80. data/sig/dodopayments/models/charge_type.rbs +16 -0
  81. data/sig/dodopayments/models/checkout_session_preview_response.rbs +5 -0
  82. data/sig/dodopayments/models/invoices/payment_retrieve_params.rbs +7 -1
  83. data/sig/dodopayments/models/invoices/payment_retrieve_payout_params.rbs +8 -1
  84. data/sig/dodopayments/models/invoices/payment_retrieve_refund_params.rbs +8 -1
  85. data/sig/dodopayments/models/manual_retry_state.rbs +15 -0
  86. data/sig/dodopayments/models/payment.rbs +25 -0
  87. data/sig/dodopayments/models/payment_list_response.rbs +40 -0
  88. data/sig/dodopayments/models/product_collection.rbs +4 -0
  89. data/sig/dodopayments/models/product_collection_create_params.rbs +4 -0
  90. data/sig/dodopayments/models/product_collection_update_params.rbs +4 -0
  91. data/sig/dodopayments/models/refund.rbs +5 -0
  92. data/sig/dodopayments/models/refund_list_item.rbs +5 -0
  93. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +7 -3
  94. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +7 -3
  95. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +7 -3
  96. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +7 -3
  97. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +7 -3
  98. data/sig/dodopayments/models/subscription_past_due_webhook_event.rbs +7 -3
  99. data/sig/dodopayments/models/subscription_paused_webhook_event.rbs +7 -3
  100. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +7 -3
  101. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +7 -3
  102. data/sig/dodopayments/models/subscription_service_period.rbs +35 -0
  103. data/sig/dodopayments/models/subscription_unpaused_webhook_event.rbs +7 -3
  104. data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +7 -3
  105. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +7 -3
  106. data/sig/dodopayments/models/update_subscription_plan_req.rbs +2 -0
  107. data/sig/dodopayments/models/webhook_payload.rbs +12 -2
  108. data/sig/dodopayments/models.rbs +4 -0
  109. data/sig/dodopayments/resources/invoices/payments.rbs +3 -0
  110. metadata +8 -2
@@ -48,6 +48,12 @@ module Dodopayments
48
48
  sig { returns(T::Array[Dodopayments::Dispute]) }
49
49
  attr_accessor :disputes
50
50
 
51
+ # True when this payment also bills metered usage or credit overage. The usage is
52
+ # for the billing cycle before the service period, not for the service period. The
53
+ # value is set for each payment status. It is false when `charge_type` is null.
54
+ sig { returns(T::Boolean) }
55
+ attr_accessor :includes_usage
56
+
51
57
  # True when one payment starts more than one subscription. Read this field to find
52
58
  # the payment type. Do not read the length of `subscription_ids`. Do not read
53
59
  # `subscription_id` for null.
@@ -82,6 +88,17 @@ module Dodopayments
82
88
  sig { returns(Integer) }
83
89
  attr_accessor :retry_attempt
84
90
 
91
+ # The service period of each subscription that this payment pays for. The order is
92
+ # the same as `subscription_ids`. For a plan change charge, the period starts at
93
+ # the plan change and ends at the next billing date. The list is empty unless the
94
+ # payment status is `succeeded`. The list is also empty for a one-time payment, an
95
+ # on-demand charge, or a payment method update. The list is set for `new`,
96
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
97
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
98
+ # only. That payment does not extend the service period.
99
+ sig { returns(T::Array[Dodopayments::SubscriptionServicePeriod]) }
100
+ attr_accessor :service_periods
101
+
85
102
  # The amount that will be credited to your Dodo balance after currency conversion
86
103
  # and processing. Especially relevant for adaptive pricing where the customer's
87
104
  # payment currency differs from your settlement currency.
@@ -106,6 +123,18 @@ module Dodopayments
106
123
  sig { returns(Integer) }
107
124
  attr_accessor :total_amount
108
125
 
126
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
127
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
128
+ # expiry of the physical card.
129
+ sig { returns(T.nilable(String)) }
130
+ attr_accessor :card_exp_month
131
+
132
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
133
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
134
+ # expiry of the physical card.
135
+ sig { returns(T.nilable(String)) }
136
+ attr_accessor :card_exp_year
137
+
109
138
  # Cardholder name
110
139
  sig { returns(T.nilable(String)) }
111
140
  attr_accessor :card_holder_name
@@ -118,14 +147,22 @@ module Dodopayments
118
147
  sig { returns(T.nilable(String)) }
119
148
  attr_accessor :card_last_four
120
149
 
121
- # Card network like VISA, MASTERCARD etc.
150
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
151
+ # payments can carry other casing.
122
152
  sig { returns(T.nilable(String)) }
123
153
  attr_accessor :card_network
124
154
 
125
- # The type of card DEBIT or CREDIT
155
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
156
+ # can carry other casing.
126
157
  sig { returns(T.nilable(String)) }
127
158
  attr_accessor :card_type
128
159
 
160
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
161
+ # The value is set for each payment status, not only for `succeeded`. The value is
162
+ # null when this payment charges no subscription.
163
+ sig { returns(T.nilable(Dodopayments::ChargeType::TaggedSymbol)) }
164
+ attr_accessor :charge_type
165
+
129
166
  # If payment is made using a checkout session, this field is set to the id of the
130
167
  # session.
131
168
  sig { returns(T.nilable(String)) }
@@ -157,7 +194,9 @@ module Dodopayments
157
194
  sig { returns(T.nilable(String)) }
158
195
  attr_accessor :invoice_id
159
196
 
160
- # URL to download the invoice PDF for this payment.
197
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
198
+ # download the invoice PDF for this payment. The URL has no signed token. If the
199
+ # business asks for a credential on its invoice links, the URL needs an API key.
161
200
  sig { returns(T.nilable(String)) }
162
201
  attr_accessor :invoice_url
163
202
 
@@ -223,6 +262,7 @@ module Dodopayments
223
262
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
224
263
  digital_products_delivered: T::Boolean,
225
264
  disputes: T::Array[Dodopayments::Dispute::OrHash],
265
+ includes_usage: T::Boolean,
226
266
  is_multi_subscription: T::Boolean,
227
267
  is_update_payment_method: T::Boolean,
228
268
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
@@ -230,15 +270,20 @@ module Dodopayments
230
270
  payment_provider: Dodopayments::Payment::PaymentProvider::OrSymbol,
231
271
  refunds: T::Array[Dodopayments::RefundListItem::OrHash],
232
272
  retry_attempt: Integer,
273
+ service_periods:
274
+ T::Array[Dodopayments::SubscriptionServicePeriod::OrHash],
233
275
  settlement_amount: Integer,
234
276
  settlement_currency: Dodopayments::Currency::OrSymbol,
235
277
  subscription_ids: T::Array[String],
236
278
  total_amount: Integer,
279
+ card_exp_month: T.nilable(String),
280
+ card_exp_year: T.nilable(String),
237
281
  card_holder_name: T.nilable(String),
238
282
  card_issuing_country: T.nilable(Dodopayments::CountryCode::OrSymbol),
239
283
  card_last_four: T.nilable(String),
240
284
  card_network: T.nilable(String),
241
285
  card_type: T.nilable(String),
286
+ charge_type: T.nilable(Dodopayments::ChargeType::OrSymbol),
242
287
  checkout_session_id: T.nilable(String),
243
288
  custom_field_responses:
244
289
  T.nilable(T::Array[Dodopayments::CustomFieldResponse::OrHash]),
@@ -279,6 +324,10 @@ module Dodopayments
279
324
  digital_products_delivered:,
280
325
  # List of disputes associated with this payment
281
326
  disputes:,
327
+ # True when this payment also bills metered usage or credit overage. The usage is
328
+ # for the billing cycle before the service period, not for the service period. The
329
+ # value is set for each payment status. It is false when `charge_type` is null.
330
+ includes_usage:,
282
331
  # True when one payment starts more than one subscription. Read this field to find
283
332
  # the payment type. Do not read the length of `subscription_ids`. Do not read
284
333
  # `subscription_id` for null.
@@ -299,6 +348,15 @@ module Dodopayments
299
348
  # payment, `1`+ for each scheduled off-session retry after a failed renewal.
300
349
  # Always `0` for non-subscription payments.
301
350
  retry_attempt:,
351
+ # The service period of each subscription that this payment pays for. The order is
352
+ # the same as `subscription_ids`. For a plan change charge, the period starts at
353
+ # the plan change and ends at the next billing date. The list is empty unless the
354
+ # payment status is `succeeded`. The list is also empty for a one-time payment, an
355
+ # on-demand charge, or a payment method update. The list is set for `new`,
356
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
357
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
358
+ # only. That payment does not extend the service period.
359
+ service_periods:,
302
360
  # The amount that will be credited to your Dodo balance after currency conversion
303
361
  # and processing. Especially relevant for adaptive pricing where the customer's
304
362
  # payment currency differs from your settlement currency.
@@ -315,16 +373,30 @@ module Dodopayments
315
373
  # unit (e.g. cents for USD, yen for JPY, fils for KWD — see the currency's decimal
316
374
  # places)
317
375
  total_amount:,
376
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
377
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
378
+ # expiry of the physical card.
379
+ card_exp_month: nil,
380
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
381
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
382
+ # expiry of the physical card.
383
+ card_exp_year: nil,
318
384
  # Cardholder name
319
385
  card_holder_name: nil,
320
386
  # ISO2 country code of the card
321
387
  card_issuing_country: nil,
322
388
  # The last four digits of the card
323
389
  card_last_four: nil,
324
- # Card network like VISA, MASTERCARD etc.
390
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
391
+ # payments can carry other casing.
325
392
  card_network: nil,
326
- # The type of card DEBIT or CREDIT
393
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
394
+ # can carry other casing.
327
395
  card_type: nil,
396
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
397
+ # The value is set for each payment status, not only for `succeeded`. The value is
398
+ # null when this payment charges no subscription.
399
+ charge_type: nil,
328
400
  # If payment is made using a checkout session, this field is set to the id of the
329
401
  # session.
330
402
  checkout_session_id: nil,
@@ -342,7 +414,9 @@ module Dodopayments
342
414
  error_message: nil,
343
415
  # Invoice ID for this payment. Uses India-specific invoice ID if available.
344
416
  invoice_id: nil,
345
- # URL to download the invoice PDF for this payment.
417
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
418
+ # download the invoice PDF for this payment. The URL has no signed token. If the
419
+ # business asks for a credential on its invoice links, the URL needs an API key.
346
420
  invoice_url: nil,
347
421
  # Checkout URL
348
422
  payment_link: nil,
@@ -386,6 +460,7 @@ module Dodopayments
386
460
  customer: Dodopayments::CustomerLimitedDetails,
387
461
  digital_products_delivered: T::Boolean,
388
462
  disputes: T::Array[Dodopayments::Dispute],
463
+ includes_usage: T::Boolean,
389
464
  is_multi_subscription: T::Boolean,
390
465
  is_update_payment_method: T::Boolean,
391
466
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
@@ -394,16 +469,20 @@ module Dodopayments
394
469
  Dodopayments::Payment::PaymentProvider::TaggedSymbol,
395
470
  refunds: T::Array[Dodopayments::RefundListItem],
396
471
  retry_attempt: Integer,
472
+ service_periods: T::Array[Dodopayments::SubscriptionServicePeriod],
397
473
  settlement_amount: Integer,
398
474
  settlement_currency: Dodopayments::Currency::TaggedSymbol,
399
475
  subscription_ids: T::Array[String],
400
476
  total_amount: Integer,
477
+ card_exp_month: T.nilable(String),
478
+ card_exp_year: T.nilable(String),
401
479
  card_holder_name: T.nilable(String),
402
480
  card_issuing_country:
403
481
  T.nilable(Dodopayments::CountryCode::TaggedSymbol),
404
482
  card_last_four: T.nilable(String),
405
483
  card_network: T.nilable(String),
406
484
  card_type: T.nilable(String),
485
+ charge_type: T.nilable(Dodopayments::ChargeType::TaggedSymbol),
407
486
  checkout_session_id: T.nilable(String),
408
487
  custom_field_responses:
409
488
  T.nilable(T::Array[Dodopayments::CustomFieldResponse]),
@@ -34,6 +34,12 @@ module Dodopayments
34
34
  sig { returns(T::Boolean) }
35
35
  attr_accessor :has_license_key
36
36
 
37
+ # True when this payment also bills metered usage or credit overage. The usage is
38
+ # for the billing cycle before the service period, not for the service period. The
39
+ # value is set for each payment status. It is false when `charge_type` is null.
40
+ sig { returns(T::Boolean) }
41
+ attr_accessor :includes_usage
42
+
37
43
  # True when one payment starts more than one subscription. Read this field to find
38
44
  # the payment type. Do not read the length of `subscription_ids`. Do not read
39
45
  # `subscription_id` for null.
@@ -56,6 +62,23 @@ module Dodopayments
56
62
  end
57
63
  attr_accessor :payment_provider
58
64
 
65
+ # The retry attempt number of this payment. The value is `0` for the original
66
+ # payment. Each retry after a failed subscription renewal adds `1`. The value is
67
+ # always `0` for a payment that is not for a subscription.
68
+ sig { returns(Integer) }
69
+ attr_accessor :retry_attempt
70
+
71
+ # The service period of each subscription that this payment pays for. The order is
72
+ # the same as `subscription_ids`. For a plan change charge, the period starts at
73
+ # the plan change and ends at the next billing date. The list is empty unless the
74
+ # payment status is `succeeded`. The list is also empty for a one-time payment, an
75
+ # on-demand charge, or a payment method update. The list is set for `new`,
76
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
77
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
78
+ # only. That payment does not extend the service period.
79
+ sig { returns(T::Array[Dodopayments::SubscriptionServicePeriod]) }
80
+ attr_accessor :service_periods
81
+
59
82
  # Every subscription that this payment starts or charges, in a stable order. It is
60
83
  # empty for a one-time payment. It holds the value of `subscription_id` when the
61
84
  # payment names one subscription.
@@ -65,14 +88,43 @@ module Dodopayments
65
88
  sig { returns(Integer) }
66
89
  attr_accessor :total_amount
67
90
 
91
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
92
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
93
+ # expiry of the physical card.
94
+ sig { returns(T.nilable(String)) }
95
+ attr_accessor :card_exp_month
96
+
97
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
98
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
99
+ # expiry of the physical card.
100
+ sig { returns(T.nilable(String)) }
101
+ attr_accessor :card_exp_year
102
+
68
103
  # The last four digits of the card
69
104
  sig { returns(T.nilable(String)) }
70
105
  attr_accessor :card_last_four
71
106
 
72
- # Card network like VISA, MASTERCARD etc.
107
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
108
+ # payments can carry other casing.
73
109
  sig { returns(T.nilable(String)) }
74
110
  attr_accessor :card_network
75
111
 
112
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
113
+ # can carry other casing.
114
+ sig { returns(T.nilable(String)) }
115
+ attr_accessor :card_type
116
+
117
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
118
+ # The value is set for each payment status, not only for `succeeded`. The value is
119
+ # null when this payment charges no subscription.
120
+ sig { returns(T.nilable(Dodopayments::ChargeType::TaggedSymbol)) }
121
+ attr_accessor :charge_type
122
+
123
+ # The ID of the checkout session for this payment. The value is null when the
124
+ # payment does not use a checkout session.
125
+ sig { returns(T.nilable(String)) }
126
+ attr_accessor :checkout_session_id
127
+
76
128
  # The most recent dispute status for this payment. None if no disputes exist.
77
129
  sig { returns(T.nilable(Dodopayments::DisputeStatus::TaggedSymbol)) }
78
130
  attr_accessor :dispute_status
@@ -81,7 +133,9 @@ module Dodopayments
81
133
  sig { returns(T.nilable(String)) }
82
134
  attr_accessor :invoice_id
83
135
 
84
- # URL to download the invoice PDF for this payment.
136
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
137
+ # download the invoice PDF for this payment. The URL has no signed token. If the
138
+ # business asks for a credential on its invoice links, the URL needs an API key.
85
139
  sig { returns(T.nilable(String)) }
86
140
  attr_accessor :invoice_url
87
141
 
@@ -112,15 +166,24 @@ module Dodopayments
112
166
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
113
167
  digital_products_delivered: T::Boolean,
114
168
  has_license_key: T::Boolean,
169
+ includes_usage: T::Boolean,
115
170
  is_multi_subscription: T::Boolean,
116
171
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
117
172
  payment_id: String,
118
173
  payment_provider:
119
174
  Dodopayments::Models::PaymentListResponse::PaymentProvider::OrSymbol,
175
+ retry_attempt: Integer,
176
+ service_periods:
177
+ T::Array[Dodopayments::SubscriptionServicePeriod::OrHash],
120
178
  subscription_ids: T::Array[String],
121
179
  total_amount: Integer,
180
+ card_exp_month: T.nilable(String),
181
+ card_exp_year: T.nilable(String),
122
182
  card_last_four: T.nilable(String),
123
183
  card_network: T.nilable(String),
184
+ card_type: T.nilable(String),
185
+ charge_type: T.nilable(Dodopayments::ChargeType::OrSymbol),
186
+ checkout_session_id: T.nilable(String),
124
187
  dispute_status: T.nilable(Dodopayments::DisputeStatus::OrSymbol),
125
188
  invoice_id: T.nilable(String),
126
189
  invoice_url: T.nilable(String),
@@ -138,6 +201,10 @@ module Dodopayments
138
201
  customer:,
139
202
  digital_products_delivered:,
140
203
  has_license_key:,
204
+ # True when this payment also bills metered usage or credit overage. The usage is
205
+ # for the billing cycle before the service period, not for the service period. The
206
+ # value is set for each payment status. It is false when `charge_type` is null.
207
+ includes_usage:,
141
208
  # True when one payment starts more than one subscription. Read this field to find
142
209
  # the payment type. Do not read the length of `subscription_ids`. Do not read
143
210
  # `subscription_id` for null.
@@ -148,20 +215,54 @@ module Dodopayments
148
215
  # Which processor handled this payment. `stripe` / `adyen` for BYOP routes (the
149
216
  # merchant's own payment connector); `dodo` for everything Dodo processed itself.
150
217
  payment_provider:,
218
+ # The retry attempt number of this payment. The value is `0` for the original
219
+ # payment. Each retry after a failed subscription renewal adds `1`. The value is
220
+ # always `0` for a payment that is not for a subscription.
221
+ retry_attempt:,
222
+ # The service period of each subscription that this payment pays for. The order is
223
+ # the same as `subscription_ids`. For a plan change charge, the period starts at
224
+ # the plan change and ends at the next billing date. The list is empty unless the
225
+ # payment status is `succeeded`. The list is also empty for a one-time payment, an
226
+ # on-demand charge, or a payment method update. The list is set for `new`,
227
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
228
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
229
+ # only. That payment does not extend the service period.
230
+ service_periods:,
151
231
  # Every subscription that this payment starts or charges, in a stable order. It is
152
232
  # empty for a one-time payment. It holds the value of `subscription_id` when the
153
233
  # payment names one subscription.
154
234
  subscription_ids:,
155
235
  total_amount:,
236
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
237
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
238
+ # expiry of the physical card.
239
+ card_exp_month: nil,
240
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
241
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
242
+ # expiry of the physical card.
243
+ card_exp_year: nil,
156
244
  # The last four digits of the card
157
245
  card_last_four: nil,
158
- # Card network like VISA, MASTERCARD etc.
246
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
247
+ # payments can carry other casing.
159
248
  card_network: nil,
249
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
250
+ # can carry other casing.
251
+ card_type: nil,
252
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
253
+ # The value is set for each payment status, not only for `succeeded`. The value is
254
+ # null when this payment charges no subscription.
255
+ charge_type: nil,
256
+ # The ID of the checkout session for this payment. The value is null when the
257
+ # payment does not use a checkout session.
258
+ checkout_session_id: nil,
160
259
  # The most recent dispute status for this payment. None if no disputes exist.
161
260
  dispute_status: nil,
162
261
  # Invoice ID for this payment. Uses India-specific invoice ID if available.
163
262
  invoice_id: nil,
164
- # URL to download the invoice PDF for this payment.
263
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
264
+ # download the invoice PDF for this payment. The URL has no signed token. If the
265
+ # business asks for a credential on its invoice links, the URL needs an API key.
165
266
  invoice_url: nil,
166
267
  payment_method: nil,
167
268
  payment_method_type: nil,
@@ -182,15 +283,23 @@ module Dodopayments
182
283
  customer: Dodopayments::CustomerLimitedDetails,
183
284
  digital_products_delivered: T::Boolean,
184
285
  has_license_key: T::Boolean,
286
+ includes_usage: T::Boolean,
185
287
  is_multi_subscription: T::Boolean,
186
288
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
187
289
  payment_id: String,
188
290
  payment_provider:
189
291
  Dodopayments::Models::PaymentListResponse::PaymentProvider::TaggedSymbol,
292
+ retry_attempt: Integer,
293
+ service_periods: T::Array[Dodopayments::SubscriptionServicePeriod],
190
294
  subscription_ids: T::Array[String],
191
295
  total_amount: Integer,
296
+ card_exp_month: T.nilable(String),
297
+ card_exp_year: T.nilable(String),
192
298
  card_last_four: T.nilable(String),
193
299
  card_network: T.nilable(String),
300
+ card_type: T.nilable(String),
301
+ charge_type: T.nilable(Dodopayments::ChargeType::TaggedSymbol),
302
+ checkout_session_id: T.nilable(String),
194
303
  dispute_status:
195
304
  T.nilable(Dodopayments::DisputeStatus::TaggedSymbol),
196
305
  invoice_id: T.nilable(String),
@@ -167,12 +167,14 @@ module Dodopayments
167
167
  sig { returns(Dodopayments::Currency::OrSymbol) }
168
168
  attr_accessor :currency
169
169
 
170
- # Number of units for the payment frequency. For example, a value of `1` with a
171
- # `payment_frequency_interval` of `month` represents monthly payments.
170
+ # Number of `payment_frequency_interval` units between two charges. This field
171
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
172
+ # `month` charges the customer every month.
172
173
  sig { returns(Integer) }
173
174
  attr_accessor :payment_frequency_count
174
175
 
175
- # The time interval for the payment frequency (e.g., day, month, year).
176
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
177
+ # `payment_frequency_count`.
176
178
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
177
179
  attr_accessor :payment_frequency_interval
178
180
 
@@ -181,12 +183,28 @@ module Dodopayments
181
183
  sig { returns(Integer) }
182
184
  attr_accessor :price
183
185
 
184
- # Number of units for the subscription period. For example, a value of `12` with a
185
- # `subscription_period_interval` of `month` represents a one-year subscription.
186
+ # Number of `subscription_period_interval` units for the total duration of the
187
+ # subscription. This field does not set the billing cycle. Use
188
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
189
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
190
+ # subscription expires. Dodo Payments can still retry a failed payment for an
191
+ # earlier billing cycle.
192
+ #
193
+ # For a subscription that renews until the customer cancels it, set this to `20`
194
+ # with a `subscription_period_interval` of `year`. This is the recommended value
195
+ # and also the maximum. The subscription expires after 20 years if the customer
196
+ # does not cancel it before then.
197
+ #
198
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
199
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
200
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
201
+ # the subscription then expires after one month.
186
202
  sig { returns(Integer) }
187
203
  attr_accessor :subscription_period_count
188
204
 
189
- # The time interval for the subscription period (e.g., day, month, year).
205
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
206
+ # it with `subscription_period_count`. The recommended value is `year`, with a
207
+ # `subscription_period_count` of `20`.
190
208
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
191
209
  attr_accessor :subscription_period_interval
192
210
 
@@ -280,18 +298,36 @@ module Dodopayments
280
298
  def self.new(
281
299
  # The currency in which the payment is made.
282
300
  currency:,
283
- # Number of units for the payment frequency. For example, a value of `1` with a
284
- # `payment_frequency_interval` of `month` represents monthly payments.
301
+ # Number of `payment_frequency_interval` units between two charges. This field
302
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
303
+ # `month` charges the customer every month.
285
304
  payment_frequency_count:,
286
- # The time interval for the payment frequency (e.g., day, month, year).
305
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
306
+ # `payment_frequency_count`.
287
307
  payment_frequency_interval:,
288
308
  # The payment amount. Represented in the lowest denomination of the currency
289
309
  # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
290
310
  price:,
291
- # Number of units for the subscription period. For example, a value of `12` with a
292
- # `subscription_period_interval` of `month` represents a one-year subscription.
311
+ # Number of `subscription_period_interval` units for the total duration of the
312
+ # subscription. This field does not set the billing cycle. Use
313
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
314
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
315
+ # subscription expires. Dodo Payments can still retry a failed payment for an
316
+ # earlier billing cycle.
317
+ #
318
+ # For a subscription that renews until the customer cancels it, set this to `20`
319
+ # with a `subscription_period_interval` of `year`. This is the recommended value
320
+ # and also the maximum. The subscription expires after 20 years if the customer
321
+ # does not cancel it before then.
322
+ #
323
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
324
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
325
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
326
+ # the subscription then expires after one month.
293
327
  subscription_period_count:,
294
- # The time interval for the subscription period (e.g., day, month, year).
328
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
329
+ # it with `subscription_period_count`. The recommended value is `year`, with a
330
+ # `subscription_period_count` of `20`.
295
331
  subscription_period_interval:,
296
332
  # Deprecated: use `discount_bps` instead.
297
333
  #
@@ -372,21 +408,39 @@ module Dodopayments
372
408
  sig { returns(Integer) }
373
409
  attr_accessor :fixed_price
374
410
 
375
- # Number of units for the payment frequency. For example, a value of `1` with a
376
- # `payment_frequency_interval` of `month` represents monthly payments.
411
+ # Number of `payment_frequency_interval` units between two charges. This field
412
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
413
+ # `month` charges the customer every month.
377
414
  sig { returns(Integer) }
378
415
  attr_accessor :payment_frequency_count
379
416
 
380
- # The time interval for the payment frequency (e.g., day, month, year).
417
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
418
+ # `payment_frequency_count`.
381
419
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
382
420
  attr_accessor :payment_frequency_interval
383
421
 
384
- # Number of units for the subscription period. For example, a value of `12` with a
385
- # `subscription_period_interval` of `month` represents a one-year subscription.
422
+ # Number of `subscription_period_interval` units for the total duration of the
423
+ # subscription. This field does not set the billing cycle. Use
424
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
425
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
426
+ # subscription expires. Dodo Payments can still retry a failed payment for an
427
+ # earlier billing cycle.
428
+ #
429
+ # For a subscription that renews until the customer cancels it, set this to `20`
430
+ # with a `subscription_period_interval` of `year`. This is the recommended value
431
+ # and also the maximum. The subscription expires after 20 years if the customer
432
+ # does not cancel it before then.
433
+ #
434
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
435
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
436
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
437
+ # the subscription then expires after one month.
386
438
  sig { returns(Integer) }
387
439
  attr_accessor :subscription_period_count
388
440
 
389
- # The time interval for the subscription period (e.g., day, month, year).
441
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
442
+ # it with `subscription_period_count`. The recommended value is `year`, with a
443
+ # `subscription_period_count` of `20`.
390
444
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
391
445
  attr_accessor :subscription_period_interval
392
446
 
@@ -451,15 +505,33 @@ module Dodopayments
451
505
  # The fixed payment amount. Represented in the lowest denomination of the currency
452
506
  # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
453
507
  fixed_price:,
454
- # Number of units for the payment frequency. For example, a value of `1` with a
455
- # `payment_frequency_interval` of `month` represents monthly payments.
508
+ # Number of `payment_frequency_interval` units between two charges. This field
509
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
510
+ # `month` charges the customer every month.
456
511
  payment_frequency_count:,
457
- # The time interval for the payment frequency (e.g., day, month, year).
512
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
513
+ # `payment_frequency_count`.
458
514
  payment_frequency_interval:,
459
- # Number of units for the subscription period. For example, a value of `12` with a
460
- # `subscription_period_interval` of `month` represents a one-year subscription.
515
+ # Number of `subscription_period_interval` units for the total duration of the
516
+ # subscription. This field does not set the billing cycle. Use
517
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
518
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
519
+ # subscription expires. Dodo Payments can still retry a failed payment for an
520
+ # earlier billing cycle.
521
+ #
522
+ # For a subscription that renews until the customer cancels it, set this to `20`
523
+ # with a `subscription_period_interval` of `year`. This is the recommended value
524
+ # and also the maximum. The subscription expires after 20 years if the customer
525
+ # does not cancel it before then.
526
+ #
527
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
528
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
529
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
530
+ # the subscription then expires after one month.
461
531
  subscription_period_count:,
462
- # The time interval for the subscription period (e.g., day, month, year).
532
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
533
+ # it with `subscription_period_count`. The recommended value is `year`, with a
534
+ # `subscription_period_count` of `20`.
463
535
  subscription_period_interval:,
464
536
  # Deprecated: use `discount_bps` instead.
465
537
  #
@@ -350,6 +350,11 @@ module Dodopayments
350
350
  :do_not_bill,
351
351
  Dodopayments::ProductCollection::ProrationBillingModeOnDowngrade::TaggedSymbol
352
352
  )
353
+ PRORATED_IMMEDIATELY_KEEP_CYCLE =
354
+ T.let(
355
+ :prorated_immediately_keep_cycle,
356
+ Dodopayments::ProductCollection::ProrationBillingModeOnDowngrade::TaggedSymbol
357
+ )
353
358
 
354
359
  sig do
355
360
  override.returns(
@@ -396,6 +401,11 @@ module Dodopayments
396
401
  :do_not_bill,
397
402
  Dodopayments::ProductCollection::ProrationBillingModeOnUpgrade::TaggedSymbol
398
403
  )
404
+ PRORATED_IMMEDIATELY_KEEP_CYCLE =
405
+ T.let(
406
+ :prorated_immediately_keep_cycle,
407
+ Dodopayments::ProductCollection::ProrationBillingModeOnUpgrade::TaggedSymbol
408
+ )
399
409
 
400
410
  sig do
401
411
  override.returns(
@@ -330,6 +330,11 @@ module Dodopayments
330
330
  :do_not_bill,
331
331
  Dodopayments::ProductCollectionCreateParams::ProrationBillingModeOnDowngrade::TaggedSymbol
332
332
  )
333
+ PRORATED_IMMEDIATELY_KEEP_CYCLE =
334
+ T.let(
335
+ :prorated_immediately_keep_cycle,
336
+ Dodopayments::ProductCollectionCreateParams::ProrationBillingModeOnDowngrade::TaggedSymbol
337
+ )
333
338
 
334
339
  sig do
335
340
  override.returns(
@@ -376,6 +381,11 @@ module Dodopayments
376
381
  :do_not_bill,
377
382
  Dodopayments::ProductCollectionCreateParams::ProrationBillingModeOnUpgrade::TaggedSymbol
378
383
  )
384
+ PRORATED_IMMEDIATELY_KEEP_CYCLE =
385
+ T.let(
386
+ :prorated_immediately_keep_cycle,
387
+ Dodopayments::ProductCollectionCreateParams::ProrationBillingModeOnUpgrade::TaggedSymbol
388
+ )
379
389
 
380
390
  sig do
381
391
  override.returns(