dodopayments 2.33.0 → 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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/type/enum.rb +11 -11
  5. data/lib/dodopayments/models/charge_type.rb +33 -0
  6. data/lib/dodopayments/models/checkout_session_preview_response.rb +12 -1
  7. data/lib/dodopayments/models/invoices/payment_retrieve_params.rb +14 -1
  8. data/lib/dodopayments/models/invoices/payment_retrieve_payout_params.rb +14 -1
  9. data/lib/dodopayments/models/invoices/payment_retrieve_refund_params.rb +14 -1
  10. data/lib/dodopayments/models/payment.rb +57 -8
  11. data/lib/dodopayments/models/payment_list_response.rb +63 -6
  12. data/lib/dodopayments/models/price.rb +56 -20
  13. data/lib/dodopayments/models/product_collections/group_update_params.rb +2 -1
  14. data/lib/dodopayments/models/subscription_service_period.rb +12 -1
  15. data/lib/dodopayments/models.rb +2 -0
  16. data/lib/dodopayments/resources/invoices/payments.rb +30 -6
  17. data/lib/dodopayments/version.rb +1 -1
  18. data/lib/dodopayments.rb +1 -0
  19. data/rbi/dodopayments/models/charge_type.rbi +37 -0
  20. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +14 -0
  21. data/rbi/dodopayments/models/invoices/payment_retrieve_params.rbi +17 -1
  22. data/rbi/dodopayments/models/invoices/payment_retrieve_payout_params.rbi +21 -2
  23. data/rbi/dodopayments/models/invoices/payment_retrieve_refund_params.rbi +21 -2
  24. data/rbi/dodopayments/models/payment.rbi +70 -8
  25. data/rbi/dodopayments/models/payment_list_response.rbi +76 -6
  26. data/rbi/dodopayments/models/price.rbi +96 -24
  27. data/rbi/dodopayments/models/product_collections/group_update_params.rbi +4 -2
  28. data/rbi/dodopayments/models/subscription_service_period.rbi +24 -4
  29. data/rbi/dodopayments/models.rbi +2 -0
  30. data/rbi/dodopayments/resources/invoices/payments.rbi +12 -0
  31. data/rbi/dodopayments/resources/product_collections/groups.rbi +2 -1
  32. data/sig/dodopayments/models/charge_type.rbs +16 -0
  33. data/sig/dodopayments/models/checkout_session_preview_response.rbs +5 -0
  34. data/sig/dodopayments/models/invoices/payment_retrieve_params.rbs +7 -1
  35. data/sig/dodopayments/models/invoices/payment_retrieve_payout_params.rbs +8 -1
  36. data/sig/dodopayments/models/invoices/payment_retrieve_refund_params.rbs +8 -1
  37. data/sig/dodopayments/models/payment.rbs +20 -0
  38. data/sig/dodopayments/models/payment_list_response.rbs +25 -0
  39. data/sig/dodopayments/models/subscription_service_period.rbs +10 -1
  40. data/sig/dodopayments/models.rbs +2 -0
  41. data/sig/dodopayments/resources/invoices/payments.rbs +3 -0
  42. metadata +5 -2
@@ -20,7 +20,8 @@ module Dodopayments
20
20
 
21
21
  # @!attribute group_name
22
22
  # Optional group name update: Some(Some(name)) = set name, Some(None) = clear
23
- # name, None = no change
23
+ # name, None = no change The API returns 422 if another group in the collection
24
+ # has no name.
24
25
  #
25
26
  # @return [String, nil]
26
27
  optional :group_name, String, nil?: true
@@ -9,6 +9,15 @@ module Dodopayments
9
9
  # @return [Time]
10
10
  required :ends_at, Time
11
11
 
12
+ # @!attribute proration_factor
13
+ # The part of one full billing period that the plan charge pays for. The value
14
+ # `"1"` is a full period. A value less than 1 is a partial period, for example
15
+ # after a plan change that keeps the billing cycle. For a plan change, this is the
16
+ # value of the new plan. The credit for the old plan is not in this value.
17
+ #
18
+ # @return [String]
19
+ required :proration_factor, String
20
+
12
21
  # @!attribute starts_at
13
22
  # Start of the service period. For a renewal, this is the billing date. For a plan
14
23
  # change that applies at the next billing date, this is the time when the change
@@ -23,7 +32,7 @@ module Dodopayments
23
32
  # @return [String]
24
33
  required :subscription_id, String
25
34
 
26
- # @!method initialize(ends_at:, starts_at:, subscription_id:)
35
+ # @!method initialize(ends_at:, proration_factor:, starts_at:, subscription_id:)
27
36
  # Some parameter documentations has been truncated, see
28
37
  # {Dodopayments::Models::SubscriptionServicePeriod} for more details.
29
38
  #
@@ -31,6 +40,8 @@ module Dodopayments
31
40
  #
32
41
  # @param ends_at [Time] End of the service period.
33
42
  #
43
+ # @param proration_factor [String] The part of one full billing period that the plan charge pays for. The value
44
+ #
34
45
  # @param starts_at [Time] Start of the service period. For a renewal, this is the billing date. For a
35
46
  #
36
47
  # @param subscription_id [String] Identifier of the subscription.
@@ -95,6 +95,8 @@ module Dodopayments
95
95
 
96
96
  CbbProrationBehavior = Dodopayments::Models::CbbProrationBehavior
97
97
 
98
+ ChargeType = Dodopayments::Models::ChargeType
99
+
98
100
  CheckoutSessionBillingAddress = Dodopayments::Models::CheckoutSessionBillingAddress
99
101
 
100
102
  CheckoutSessionCreateParams = Dodopayments::Models::CheckoutSessionCreateParams
@@ -4,60 +4,84 @@ module Dodopayments
4
4
  module Resources
5
5
  class Invoices
6
6
  class Payments
7
- # @overload retrieve(payment_id, request_options: {})
7
+ # Some parameter documentations has been truncated, see
8
+ # {Dodopayments::Models::Invoices::PaymentRetrieveParams} for more details.
9
+ #
10
+ # @overload retrieve(payment_id, token: nil, request_options: {})
8
11
  #
9
12
  # @param payment_id [String] Payment ID
10
13
  #
14
+ # @param token [String] The signed link token. If the business asks for a credential on its invoice link
15
+ #
11
16
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
12
17
  #
13
18
  # @return [StringIO]
14
19
  #
15
20
  # @see Dodopayments::Models::Invoices::PaymentRetrieveParams
16
21
  def retrieve(payment_id, params = {})
22
+ parsed, options = Dodopayments::Invoices::PaymentRetrieveParams.dump_request(params)
23
+ query = Dodopayments::Internal::Util.encode_query_params(parsed)
17
24
  @client.request(
18
25
  method: :get,
19
26
  path: ["invoices/payments/%1$s", payment_id],
27
+ query: query,
20
28
  headers: {"accept" => "application/pdf"},
21
29
  model: StringIO,
22
- options: params[:request_options]
30
+ options: options
23
31
  )
24
32
  end
25
33
 
26
- # @overload retrieve_payout(payout_id, request_options: {})
34
+ # Some parameter documentations has been truncated, see
35
+ # {Dodopayments::Models::Invoices::PaymentRetrievePayoutParams} for more details.
36
+ #
37
+ # @overload retrieve_payout(payout_id, token: nil, request_options: {})
27
38
  #
28
39
  # @param payout_id [String] Payout ID
29
40
  #
41
+ # @param token [String] The signed link token. If the business asks for a credential on its invoice link
42
+ #
30
43
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
31
44
  #
32
45
  # @return [StringIO]
33
46
  #
34
47
  # @see Dodopayments::Models::Invoices::PaymentRetrievePayoutParams
35
48
  def retrieve_payout(payout_id, params = {})
49
+ parsed, options = Dodopayments::Invoices::PaymentRetrievePayoutParams.dump_request(params)
50
+ query = Dodopayments::Internal::Util.encode_query_params(parsed)
36
51
  @client.request(
37
52
  method: :get,
38
53
  path: ["invoices/payouts/%1$s", payout_id],
54
+ query: query,
39
55
  headers: {"accept" => "application/pdf"},
40
56
  model: StringIO,
41
- options: params[:request_options]
57
+ options: options
42
58
  )
43
59
  end
44
60
 
45
- # @overload retrieve_refund(refund_id, request_options: {})
61
+ # Some parameter documentations has been truncated, see
62
+ # {Dodopayments::Models::Invoices::PaymentRetrieveRefundParams} for more details.
63
+ #
64
+ # @overload retrieve_refund(refund_id, token: nil, request_options: {})
46
65
  #
47
66
  # @param refund_id [String] Refund ID
48
67
  #
68
+ # @param token [String] The signed link token. If the business asks for a credential on its invoice link
69
+ #
49
70
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
50
71
  #
51
72
  # @return [StringIO]
52
73
  #
53
74
  # @see Dodopayments::Models::Invoices::PaymentRetrieveRefundParams
54
75
  def retrieve_refund(refund_id, params = {})
76
+ parsed, options = Dodopayments::Invoices::PaymentRetrieveRefundParams.dump_request(params)
77
+ query = Dodopayments::Internal::Util.encode_query_params(parsed)
55
78
  @client.request(
56
79
  method: :get,
57
80
  path: ["invoices/refunds/%1$s", refund_id],
81
+ query: query,
58
82
  headers: {"accept" => "application/pdf"},
59
83
  model: StringIO,
60
- options: params[:request_options]
84
+ options: options
61
85
  )
62
86
  end
63
87
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.33.0"
4
+ VERSION = "2.34.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -110,6 +110,7 @@ require_relative "dodopayments/models/brand_update_params"
110
110
  require_relative "dodopayments/models/cancellation_feedback"
111
111
  require_relative "dodopayments/models/cbb_overage_behavior"
112
112
  require_relative "dodopayments/models/cbb_proration_behavior"
113
+ require_relative "dodopayments/models/charge_type"
113
114
  require_relative "dodopayments/models/checkout_session_billing_address"
114
115
  require_relative "dodopayments/models/checkout_session_create_params"
115
116
  require_relative "dodopayments/models/checkout_session_customization"
@@ -0,0 +1,37 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # The type of subscription charge that a payment is for.
6
+ #
7
+ # A payment has one invoice, and the invoice has one type. Thus each payment has
8
+ # one charge type. A payment that charges no subscription has no charge type.
9
+ #
10
+ # - `new`: the first payment of one or more subscriptions. A retry of that payment
11
+ # is also `new`. A cart with new subscriptions and one-time products is `new`.
12
+ # Read the one-time products from `product_cart`.
13
+ # - `renewal`: a charge at the billing date. A dunning retry and a manual retry of
14
+ # that charge are also `renewal`. A `renewal` does not always extend the service
15
+ # period. For example, the usage settlement of a paused subscription is a
16
+ # `renewal` with `includes_usage` true and no entry in `service_periods`.
17
+ # Examine `service_periods` before you extend access.
18
+ # - `plan_change`: a charge for a plan change. The change applies now or at the
19
+ # next billing date.
20
+ # - `on_demand`: an on-demand charge of an on-demand subscription.
21
+ module ChargeType
22
+ extend Dodopayments::Internal::Type::Enum
23
+
24
+ TaggedSymbol = T.type_alias { T.all(Symbol, Dodopayments::ChargeType) }
25
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
26
+
27
+ NEW = T.let(:new, Dodopayments::ChargeType::TaggedSymbol)
28
+ RENEWAL = T.let(:renewal, Dodopayments::ChargeType::TaggedSymbol)
29
+ PLAN_CHANGE = T.let(:plan_change, Dodopayments::ChargeType::TaggedSymbol)
30
+ ON_DEMAND = T.let(:on_demand, Dodopayments::ChargeType::TaggedSymbol)
31
+
32
+ sig { override.returns(T::Array[Dodopayments::ChargeType::TaggedSymbol]) }
33
+ def self.values
34
+ end
35
+ end
36
+ end
37
+ end
@@ -409,6 +409,13 @@ module Dodopayments
409
409
  sig { returns(T.nilable(Integer)) }
410
410
  attr_accessor :discount_cycle
411
411
 
412
+ # The monthly equivalent of the yearly unit price after discounts, in minor units
413
+ # of `currency`. Only the hosted checkout sets it, when the business shows yearly
414
+ # plans as monthly. The value is only for display. The order summary shows the
415
+ # amounts that we charge.
416
+ sig { returns(T.nilable(Integer)) }
417
+ attr_accessor :monthly_equivalent
418
+
412
419
  # name of the product
413
420
  sig { returns(T.nilable(String)) }
414
421
  attr_accessor :name
@@ -447,6 +454,7 @@ module Dodopayments
447
454
  description: T.nilable(String),
448
455
  discount_amount: T.nilable(Integer),
449
456
  discount_cycle: T.nilable(Integer),
457
+ monthly_equivalent: T.nilable(Integer),
450
458
  name: T.nilable(String),
451
459
  tax: T.nilable(Integer)
452
460
  ).returns(T.attached_class)
@@ -483,6 +491,11 @@ module Dodopayments
483
491
  discount_amount: nil,
484
492
  # number of cycles the discount will apply
485
493
  discount_cycle: nil,
494
+ # The monthly equivalent of the yearly unit price after discounts, in minor units
495
+ # of `currency`. Only the hosted checkout sets it, when the business shows yearly
496
+ # plans as monthly. The value is only for display. The order summary shows the
497
+ # amounts that we charge.
498
+ monthly_equivalent: nil,
486
499
  # name of the product
487
500
  name: nil,
488
501
  # total tax
@@ -521,6 +534,7 @@ module Dodopayments
521
534
  description: T.nilable(String),
522
535
  discount_amount: T.nilable(Integer),
523
536
  discount_cycle: T.nilable(Integer),
537
+ monthly_equivalent: T.nilable(Integer),
524
538
  name: T.nilable(String),
525
539
  tax: T.nilable(Integer)
526
540
  }
@@ -18,19 +18,35 @@ module Dodopayments
18
18
  sig { returns(String) }
19
19
  attr_accessor :payment_id
20
20
 
21
+ # The signed link token. If the business asks for a credential on its invoice
22
+ # links, a valid token for this record replaces the credential.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :token
25
+
26
+ sig { params(token: String).void }
27
+ attr_writer :token
28
+
21
29
  sig do
22
30
  params(
23
31
  payment_id: String,
32
+ token: String,
24
33
  request_options: Dodopayments::RequestOptions::OrHash
25
34
  ).returns(T.attached_class)
26
35
  end
27
- def self.new(payment_id:, request_options: {})
36
+ def self.new(
37
+ payment_id:,
38
+ # The signed link token. If the business asks for a credential on its invoice
39
+ # links, a valid token for this record replaces the credential.
40
+ token: nil,
41
+ request_options: {}
42
+ )
28
43
  end
29
44
 
30
45
  sig do
31
46
  override.returns(
32
47
  {
33
48
  payment_id: String,
49
+ token: String,
34
50
  request_options: Dodopayments::RequestOptions
35
51
  }
36
52
  )
@@ -18,18 +18,37 @@ module Dodopayments
18
18
  sig { returns(String) }
19
19
  attr_accessor :payout_id
20
20
 
21
+ # The signed link token. If the business asks for a credential on its invoice
22
+ # links, a valid token for this record replaces the credential.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :token
25
+
26
+ sig { params(token: String).void }
27
+ attr_writer :token
28
+
21
29
  sig do
22
30
  params(
23
31
  payout_id: String,
32
+ token: String,
24
33
  request_options: Dodopayments::RequestOptions::OrHash
25
34
  ).returns(T.attached_class)
26
35
  end
27
- def self.new(payout_id:, request_options: {})
36
+ def self.new(
37
+ payout_id:,
38
+ # The signed link token. If the business asks for a credential on its invoice
39
+ # links, a valid token for this record replaces the credential.
40
+ token: nil,
41
+ request_options: {}
42
+ )
28
43
  end
29
44
 
30
45
  sig do
31
46
  override.returns(
32
- { payout_id: String, request_options: Dodopayments::RequestOptions }
47
+ {
48
+ payout_id: String,
49
+ token: String,
50
+ request_options: Dodopayments::RequestOptions
51
+ }
33
52
  )
34
53
  end
35
54
  def to_hash
@@ -18,18 +18,37 @@ module Dodopayments
18
18
  sig { returns(String) }
19
19
  attr_accessor :refund_id
20
20
 
21
+ # The signed link token. If the business asks for a credential on its invoice
22
+ # links, a valid token for this record replaces the credential.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :token
25
+
26
+ sig { params(token: String).void }
27
+ attr_writer :token
28
+
21
29
  sig do
22
30
  params(
23
31
  refund_id: String,
32
+ token: String,
24
33
  request_options: Dodopayments::RequestOptions::OrHash
25
34
  ).returns(T.attached_class)
26
35
  end
27
- def self.new(refund_id:, request_options: {})
36
+ def self.new(
37
+ refund_id:,
38
+ # The signed link token. If the business asks for a credential on its invoice
39
+ # links, a valid token for this record replaces the credential.
40
+ token: nil,
41
+ request_options: {}
42
+ )
28
43
  end
29
44
 
30
45
  sig do
31
46
  override.returns(
32
- { refund_id: String, request_options: Dodopayments::RequestOptions }
47
+ {
48
+ refund_id: String,
49
+ token: String,
50
+ request_options: Dodopayments::RequestOptions
51
+ }
33
52
  )
34
53
  end
35
54
  def to_hash
@@ -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.
@@ -86,7 +92,10 @@ module Dodopayments
86
92
  # the same as `subscription_ids`. For a plan change charge, the period starts at
87
93
  # the plan change and ends at the next billing date. The list is empty unless the
88
94
  # payment status is `succeeded`. The list is also empty for a one-time payment, an
89
- # on-demand charge, or a payment method update.
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.
90
99
  sig { returns(T::Array[Dodopayments::SubscriptionServicePeriod]) }
91
100
  attr_accessor :service_periods
92
101
 
@@ -114,6 +123,18 @@ module Dodopayments
114
123
  sig { returns(Integer) }
115
124
  attr_accessor :total_amount
116
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
+
117
138
  # Cardholder name
118
139
  sig { returns(T.nilable(String)) }
119
140
  attr_accessor :card_holder_name
@@ -126,14 +147,22 @@ module Dodopayments
126
147
  sig { returns(T.nilable(String)) }
127
148
  attr_accessor :card_last_four
128
149
 
129
- # Card network like VISA, MASTERCARD etc.
150
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
151
+ # payments can carry other casing.
130
152
  sig { returns(T.nilable(String)) }
131
153
  attr_accessor :card_network
132
154
 
133
- # 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.
134
157
  sig { returns(T.nilable(String)) }
135
158
  attr_accessor :card_type
136
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
+
137
166
  # If payment is made using a checkout session, this field is set to the id of the
138
167
  # session.
139
168
  sig { returns(T.nilable(String)) }
@@ -165,7 +194,9 @@ module Dodopayments
165
194
  sig { returns(T.nilable(String)) }
166
195
  attr_accessor :invoice_id
167
196
 
168
- # 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.
169
200
  sig { returns(T.nilable(String)) }
170
201
  attr_accessor :invoice_url
171
202
 
@@ -231,6 +262,7 @@ module Dodopayments
231
262
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
232
263
  digital_products_delivered: T::Boolean,
233
264
  disputes: T::Array[Dodopayments::Dispute::OrHash],
265
+ includes_usage: T::Boolean,
234
266
  is_multi_subscription: T::Boolean,
235
267
  is_update_payment_method: T::Boolean,
236
268
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
@@ -244,11 +276,14 @@ module Dodopayments
244
276
  settlement_currency: Dodopayments::Currency::OrSymbol,
245
277
  subscription_ids: T::Array[String],
246
278
  total_amount: Integer,
279
+ card_exp_month: T.nilable(String),
280
+ card_exp_year: T.nilable(String),
247
281
  card_holder_name: T.nilable(String),
248
282
  card_issuing_country: T.nilable(Dodopayments::CountryCode::OrSymbol),
249
283
  card_last_four: T.nilable(String),
250
284
  card_network: T.nilable(String),
251
285
  card_type: T.nilable(String),
286
+ charge_type: T.nilable(Dodopayments::ChargeType::OrSymbol),
252
287
  checkout_session_id: T.nilable(String),
253
288
  custom_field_responses:
254
289
  T.nilable(T::Array[Dodopayments::CustomFieldResponse::OrHash]),
@@ -289,6 +324,10 @@ module Dodopayments
289
324
  digital_products_delivered:,
290
325
  # List of disputes associated with this payment
291
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:,
292
331
  # True when one payment starts more than one subscription. Read this field to find
293
332
  # the payment type. Do not read the length of `subscription_ids`. Do not read
294
333
  # `subscription_id` for null.
@@ -313,7 +352,10 @@ module Dodopayments
313
352
  # the same as `subscription_ids`. For a plan change charge, the period starts at
314
353
  # the plan change and ends at the next billing date. The list is empty unless the
315
354
  # payment status is `succeeded`. The list is also empty for a one-time payment, an
316
- # on-demand charge, or a payment method update.
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.
317
359
  service_periods:,
318
360
  # The amount that will be credited to your Dodo balance after currency conversion
319
361
  # and processing. Especially relevant for adaptive pricing where the customer's
@@ -331,16 +373,30 @@ module Dodopayments
331
373
  # unit (e.g. cents for USD, yen for JPY, fils for KWD — see the currency's decimal
332
374
  # places)
333
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,
334
384
  # Cardholder name
335
385
  card_holder_name: nil,
336
386
  # ISO2 country code of the card
337
387
  card_issuing_country: nil,
338
388
  # The last four digits of the card
339
389
  card_last_four: nil,
340
- # Card network like VISA, MASTERCARD etc.
390
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
391
+ # payments can carry other casing.
341
392
  card_network: nil,
342
- # 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.
343
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,
344
400
  # If payment is made using a checkout session, this field is set to the id of the
345
401
  # session.
346
402
  checkout_session_id: nil,
@@ -358,7 +414,9 @@ module Dodopayments
358
414
  error_message: nil,
359
415
  # Invoice ID for this payment. Uses India-specific invoice ID if available.
360
416
  invoice_id: nil,
361
- # 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.
362
420
  invoice_url: nil,
363
421
  # Checkout URL
364
422
  payment_link: nil,
@@ -402,6 +460,7 @@ module Dodopayments
402
460
  customer: Dodopayments::CustomerLimitedDetails,
403
461
  digital_products_delivered: T::Boolean,
404
462
  disputes: T::Array[Dodopayments::Dispute],
463
+ includes_usage: T::Boolean,
405
464
  is_multi_subscription: T::Boolean,
406
465
  is_update_payment_method: T::Boolean,
407
466
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
@@ -415,12 +474,15 @@ module Dodopayments
415
474
  settlement_currency: Dodopayments::Currency::TaggedSymbol,
416
475
  subscription_ids: T::Array[String],
417
476
  total_amount: Integer,
477
+ card_exp_month: T.nilable(String),
478
+ card_exp_year: T.nilable(String),
418
479
  card_holder_name: T.nilable(String),
419
480
  card_issuing_country:
420
481
  T.nilable(Dodopayments::CountryCode::TaggedSymbol),
421
482
  card_last_four: T.nilable(String),
422
483
  card_network: T.nilable(String),
423
484
  card_type: T.nilable(String),
485
+ charge_type: T.nilable(Dodopayments::ChargeType::TaggedSymbol),
424
486
  checkout_session_id: T.nilable(String),
425
487
  custom_field_responses:
426
488
  T.nilable(T::Array[Dodopayments::CustomFieldResponse]),