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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27eda33527f7fc36507b133919bcf76f5bfe1d537e875e0ed762c3b3fd5aad53
4
- data.tar.gz: 904efd6de1bbdc9e54a65483709a8d9d3c7f0b4496011d46e9f69bb753e26083
3
+ metadata.gz: c11a0d8230c984a0f1edb90a4ec17367c959b1184fb237167022cce1ffabef79
4
+ data.tar.gz: 65a53d9ea3bef5ff6f6ac1246ad5f58bf661299376465bd244cf89dc46518d6b
5
5
  SHA512:
6
- metadata.gz: b4eb25c02f04ca12ea6b41f3b3d254d7afbdce14137dd5213b52994d172b227ec5a87db193a6ed4c0330fcda867f79e522a1b0f74ebc6e6a8e23d81dc2615bab
7
- data.tar.gz: f72f531842560027f90d5fc5ec789025487305ec95993829a79b704210803d81cb8a33c357cb09a79be7abef9e030673b325663a2d27b6427d78737ade894f0e
6
+ metadata.gz: 143d2ca167230b620f7fbce7e95bcb0ab604194841690113dd8c58609643d2faf141935105139492e60aa297ccfa70ac896f6b11b1334dcb934f67f6aaa280fd
7
+ data.tar.gz: b57185159507e699991b8bc47b7a8559260179cc013dadbd48e60bdb17d3d8108a31c689ec8c96bc308a631bac669ad5d09e9f3fab8aecb43718ce42adb95273
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.34.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.33.0...v2.34.0) (2026-10-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** payment charge type, usage flag and card details, signed invoice link tokens ([3b6eb1d](https://github.com/dodopayments/dodopayments-ruby/commit/3b6eb1d46ca7c02d279ab66c62a746e8df1f14d3))
9
+ * **api:** payment charge type, usage flag and card details, signed invoice link tokens ([f3d6720](https://github.com/dodopayments/dodopayments-ruby/commit/f3d67205537089c45bd7643f399bece43a7d56f5))
10
+
3
11
  ## [2.33.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.32.2...v2.33.0) (2026-10-14)
4
12
 
5
13
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ To use this gem, install via Bundler by adding the following to your application
23
23
  <!-- x-release-please-start-version -->
24
24
 
25
25
  ```ruby
26
- gem "dodopayments", "~> 2.33.0"
26
+ gem "dodopayments", "~> 2.34.0"
27
27
  ```
28
28
 
29
29
  <!-- x-release-please-end -->
@@ -17,28 +17,28 @@ module Dodopayments
17
17
  # values safely.
18
18
  #
19
19
  # @example
20
- # # `intent_status` is a `Dodopayments::IntentStatus`
21
- # case intent_status
22
- # when Dodopayments::IntentStatus::SUCCEEDED
20
+ # # `charge_type` is a `Dodopayments::ChargeType`
21
+ # case charge_type
22
+ # when Dodopayments::ChargeType::NEW
23
23
  # # ...
24
- # when Dodopayments::IntentStatus::FAILED
24
+ # when Dodopayments::ChargeType::RENEWAL
25
25
  # # ...
26
- # when Dodopayments::IntentStatus::CANCELLED
26
+ # when Dodopayments::ChargeType::PLAN_CHANGE
27
27
  # # ...
28
28
  # else
29
- # puts(intent_status)
29
+ # puts(charge_type)
30
30
  # end
31
31
  #
32
32
  # @example
33
- # case intent_status
34
- # in :succeeded
33
+ # case charge_type
34
+ # in :new
35
35
  # # ...
36
- # in :failed
36
+ # in :renewal
37
37
  # # ...
38
- # in :cancelled
38
+ # in :plan_change
39
39
  # # ...
40
40
  # else
41
- # puts(intent_status)
41
+ # puts(charge_type)
42
42
  # end
43
43
  module Enum
44
44
  include Dodopayments::Internal::Type::Converter
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
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
+ NEW = :new
25
+ RENEWAL = :renewal
26
+ PLAN_CHANGE = :plan_change
27
+ ON_DEMAND = :on_demand
28
+
29
+ # @!method self.values
30
+ # @return [Array<Symbol>]
31
+ end
32
+ end
33
+ end
@@ -301,6 +301,15 @@ module Dodopayments
301
301
  # @return [Integer, nil]
302
302
  optional :discount_cycle, Integer, nil?: true
303
303
 
304
+ # @!attribute monthly_equivalent
305
+ # The monthly equivalent of the yearly unit price after discounts, in minor units
306
+ # of `currency`. Only the hosted checkout sets it, when the business shows yearly
307
+ # plans as monthly. The value is only for display. The order summary shows the
308
+ # amounts that we charge.
309
+ #
310
+ # @return [Integer, nil]
311
+ optional :monthly_equivalent, Integer, nil?: true
312
+
304
313
  # @!attribute name
305
314
  # name of the product
306
315
  #
@@ -313,7 +322,7 @@ module Dodopayments
313
322
  # @return [Integer, nil]
314
323
  optional :tax, Integer, nil?: true
315
324
 
316
- # @!method initialize(credit_entitlements:, currency:, discounted_price:, is_subscription:, is_usage_based:, meters:, og_currency:, og_price:, product_id:, quantity:, tax_category:, tax_inclusive:, tax_rate:, addons: nil, description: nil, discount_amount: nil, discount_cycle: nil, name: nil, tax: nil)
325
+ # @!method initialize(credit_entitlements:, currency:, discounted_price:, is_subscription:, is_usage_based:, meters:, og_currency:, og_price:, product_id:, quantity:, tax_category:, tax_inclusive:, tax_rate:, addons: nil, description: nil, discount_amount: nil, discount_cycle: nil, monthly_equivalent: nil, name: nil, tax: nil)
317
326
  # Some parameter documentations has been truncated, see
318
327
  # {Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart} for more
319
328
  # details.
@@ -352,6 +361,8 @@ module Dodopayments
352
361
  #
353
362
  # @param discount_cycle [Integer, nil] number of cycles the discount will apply
354
363
  #
364
+ # @param monthly_equivalent [Integer, nil] The monthly equivalent of the yearly unit price after discounts, in minor units
365
+ #
355
366
  # @param name [String, nil] name of the product
356
367
  #
357
368
  # @param tax [Integer, nil] total tax
@@ -13,8 +13,21 @@ module Dodopayments
13
13
  # @return [String]
14
14
  required :payment_id, String
15
15
 
16
- # @!method initialize(payment_id:, request_options: {})
16
+ # @!attribute token
17
+ # The signed link token. If the business asks for a credential on its invoice
18
+ # links, a valid token for this record replaces the credential.
19
+ #
20
+ # @return [String, nil]
21
+ optional :token, String
22
+
23
+ # @!method initialize(payment_id:, token: nil, request_options: {})
24
+ # Some parameter documentations has been truncated, see
25
+ # {Dodopayments::Models::Invoices::PaymentRetrieveParams} for more details.
26
+ #
17
27
  # @param payment_id [String]
28
+ #
29
+ # @param token [String] The signed link token. If the business asks for a credential on its invoice link
30
+ #
18
31
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
19
32
  end
20
33
  end
@@ -13,8 +13,21 @@ module Dodopayments
13
13
  # @return [String]
14
14
  required :payout_id, String
15
15
 
16
- # @!method initialize(payout_id:, request_options: {})
16
+ # @!attribute token
17
+ # The signed link token. If the business asks for a credential on its invoice
18
+ # links, a valid token for this record replaces the credential.
19
+ #
20
+ # @return [String, nil]
21
+ optional :token, String
22
+
23
+ # @!method initialize(payout_id:, token: nil, request_options: {})
24
+ # Some parameter documentations has been truncated, see
25
+ # {Dodopayments::Models::Invoices::PaymentRetrievePayoutParams} for more details.
26
+ #
17
27
  # @param payout_id [String]
28
+ #
29
+ # @param token [String] The signed link token. If the business asks for a credential on its invoice link
30
+ #
18
31
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
19
32
  end
20
33
  end
@@ -13,8 +13,21 @@ module Dodopayments
13
13
  # @return [String]
14
14
  required :refund_id, String
15
15
 
16
- # @!method initialize(refund_id:, request_options: {})
16
+ # @!attribute token
17
+ # The signed link token. If the business asks for a credential on its invoice
18
+ # links, a valid token for this record replaces the credential.
19
+ #
20
+ # @return [String, nil]
21
+ optional :token, String
22
+
23
+ # @!method initialize(refund_id:, token: nil, request_options: {})
24
+ # Some parameter documentations has been truncated, see
25
+ # {Dodopayments::Models::Invoices::PaymentRetrieveRefundParams} for more details.
26
+ #
17
27
  # @param refund_id [String]
28
+ #
29
+ # @param token [String] The signed link token. If the business asks for a credential on its invoice link
30
+ #
18
31
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
19
32
  end
20
33
  end
@@ -52,6 +52,14 @@ module Dodopayments
52
52
  # @return [Array<Dodopayments::Models::Dispute>]
53
53
  required :disputes, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Dispute] }
54
54
 
55
+ # @!attribute includes_usage
56
+ # True when this payment also bills metered usage or credit overage. The usage is
57
+ # for the billing cycle before the service period, not for the service period. The
58
+ # value is set for each payment status. It is false when `charge_type` is null.
59
+ #
60
+ # @return [Boolean]
61
+ required :includes_usage, Dodopayments::Internal::Type::Boolean
62
+
55
63
  # @!attribute is_multi_subscription
56
64
  # True when one payment starts more than one subscription. Read this field to find
57
65
  # the payment type. Do not read the length of `subscription_ids`. Do not read
@@ -105,7 +113,10 @@ module Dodopayments
105
113
  # the same as `subscription_ids`. For a plan change charge, the period starts at
106
114
  # the plan change and ends at the next billing date. The list is empty unless the
107
115
  # payment status is `succeeded`. The list is also empty for a one-time payment, an
108
- # on-demand charge, or a payment method update.
116
+ # on-demand charge, or a payment method update. The list is set for `new`,
117
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
118
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
119
+ # only. That payment does not extend the service period.
109
120
  #
110
121
  # @return [Array<Dodopayments::Models::SubscriptionServicePeriod>]
111
122
  required :service_periods,
@@ -143,6 +154,22 @@ module Dodopayments
143
154
  # @return [Integer]
144
155
  required :total_amount, Integer
145
156
 
157
+ # @!attribute card_exp_month
158
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
159
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
160
+ # expiry of the physical card.
161
+ #
162
+ # @return [String, nil]
163
+ optional :card_exp_month, String, nil?: true
164
+
165
+ # @!attribute card_exp_year
166
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
167
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
168
+ # expiry of the physical card.
169
+ #
170
+ # @return [String, nil]
171
+ optional :card_exp_year, String, nil?: true
172
+
146
173
  # @!attribute card_holder_name
147
174
  # Cardholder name
148
175
  #
@@ -162,17 +189,27 @@ module Dodopayments
162
189
  optional :card_last_four, String, nil?: true
163
190
 
164
191
  # @!attribute card_network
165
- # Card network like VISA, MASTERCARD etc.
192
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
193
+ # payments can carry other casing.
166
194
  #
167
195
  # @return [String, nil]
168
196
  optional :card_network, String, nil?: true
169
197
 
170
198
  # @!attribute card_type
171
- # The type of card DEBIT or CREDIT
199
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
200
+ # can carry other casing.
172
201
  #
173
202
  # @return [String, nil]
174
203
  optional :card_type, String, nil?: true
175
204
 
205
+ # @!attribute charge_type
206
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
207
+ # The value is set for each payment status, not only for `succeeded`. The value is
208
+ # null when this payment charges no subscription.
209
+ #
210
+ # @return [Symbol, Dodopayments::Models::ChargeType, nil]
211
+ optional :charge_type, enum: -> { Dodopayments::ChargeType }, nil?: true
212
+
176
213
  # @!attribute checkout_session_id
177
214
  # If payment is made using a checkout session, this field is set to the id of the
178
215
  # session.
@@ -225,7 +262,11 @@ module Dodopayments
225
262
  optional :invoice_id, String, nil?: true
226
263
 
227
264
  # @!attribute invoice_url
228
- # URL to download the invoice PDF for this payment.
265
+ # @deprecated Use `GET /invoices/payments/{payment_id}` with an API key.
266
+ #
267
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
268
+ # download the invoice PDF for this payment. The URL has no signed token. If the
269
+ # business asks for a credential on its invoice links, the URL needs an API key.
229
270
  #
230
271
  # @return [String, nil]
231
272
  optional :invoice_url, String, nil?: true
@@ -304,7 +345,7 @@ module Dodopayments
304
345
  # @return [Time, nil]
305
346
  optional :updated_at, Time, nil?: true
306
347
 
307
- # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, is_multi_subscription:, is_update_payment_method:, metadata:, payment_id:, payment_provider:, refunds:, retry_attempt:, service_periods:, settlement_amount:, settlement_currency:, subscription_ids:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, discounts: nil, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_id: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
348
+ # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, includes_usage:, is_multi_subscription:, is_update_payment_method:, metadata:, payment_id:, payment_provider:, refunds:, retry_attempt:, service_periods:, settlement_amount:, settlement_currency:, subscription_ids:, total_amount:, card_exp_month: nil, card_exp_year: nil, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, charge_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, discounts: nil, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_id: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
308
349
  # Some parameter documentations has been truncated, see
309
350
  # {Dodopayments::Models::Payment} for more details.
310
351
  #
@@ -324,6 +365,8 @@ module Dodopayments
324
365
  #
325
366
  # @param disputes [Array<Dodopayments::Models::Dispute>] List of disputes associated with this payment
326
367
  #
368
+ # @param includes_usage [Boolean] True when this payment also bills metered usage or credit overage. The usage is
369
+ #
327
370
  # @param is_multi_subscription [Boolean] True when one payment starts more than one subscription. Read this field
328
371
  #
329
372
  # @param is_update_payment_method [Boolean] Whether this payment was created solely to update a subscription's
@@ -348,15 +391,21 @@ module Dodopayments
348
391
  #
349
392
  # @param total_amount [Integer] Total amount charged to the customer including tax, in the currency's smallest u
350
393
  #
394
+ # @param card_exp_month [String, nil] Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
395
+ #
396
+ # @param card_exp_year [String, nil] Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
397
+ #
351
398
  # @param card_holder_name [String, nil] Cardholder name
352
399
  #
353
400
  # @param card_issuing_country [Symbol, Dodopayments::Models::CountryCode, nil] ISO2 country code of the card
354
401
  #
355
402
  # @param card_last_four [String, nil] The last four digits of the card
356
403
  #
357
- # @param card_network [String, nil] Card network like VISA, MASTERCARD etc.
404
+ # @param card_network [String, nil] Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older pa
405
+ #
406
+ # @param card_type [String, nil] The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments c
358
407
  #
359
- # @param card_type [String, nil] The type of card DEBIT or CREDIT
408
+ # @param charge_type [Symbol, Dodopayments::Models::ChargeType, nil] The type of subscription charge that this payment is for. Refer to `ChargeType`.
360
409
  #
361
410
  # @param checkout_session_id [String, nil] If payment is made using a checkout session,
362
411
  #
@@ -372,7 +421,7 @@ module Dodopayments
372
421
  #
373
422
  # @param invoice_id [String, nil] Invoice ID for this payment. Uses India-specific invoice ID if available.
374
423
  #
375
- # @param invoice_url [String, nil] URL to download the invoice PDF for this payment.
424
+ # @param invoice_url [String, nil] DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key.
376
425
  #
377
426
  # @param payment_link [String, nil] Checkout URL
378
427
  #
@@ -34,6 +34,14 @@ module Dodopayments
34
34
  # @return [Boolean]
35
35
  required :has_license_key, Dodopayments::Internal::Type::Boolean
36
36
 
37
+ # @!attribute includes_usage
38
+ # True when this payment also bills metered usage or credit overage. The usage is
39
+ # for the billing cycle before the service period, not for the service period. The
40
+ # value is set for each payment status. It is false when `charge_type` is null.
41
+ #
42
+ # @return [Boolean]
43
+ required :includes_usage, Dodopayments::Internal::Type::Boolean
44
+
37
45
  # @!attribute is_multi_subscription
38
46
  # True when one payment starts more than one subscription. Read this field to find
39
47
  # the payment type. Do not read the length of `subscription_ids`. Do not read
@@ -73,7 +81,10 @@ module Dodopayments
73
81
  # the same as `subscription_ids`. For a plan change charge, the period starts at
74
82
  # the plan change and ends at the next billing date. The list is empty unless the
75
83
  # payment status is `succeeded`. The list is also empty for a one-time payment, an
76
- # on-demand charge, or a payment method update.
84
+ # on-demand charge, or a payment method update. The list is set for `new`,
85
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
86
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
87
+ # only. That payment does not extend the service period.
77
88
  #
78
89
  # @return [Array<Dodopayments::Models::SubscriptionServicePeriod>]
79
90
  required :service_periods,
@@ -92,6 +103,22 @@ module Dodopayments
92
103
  # @return [Integer]
93
104
  required :total_amount, Integer
94
105
 
106
+ # @!attribute card_exp_month
107
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
108
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
109
+ # expiry of the physical card.
110
+ #
111
+ # @return [String, nil]
112
+ optional :card_exp_month, String, nil?: true
113
+
114
+ # @!attribute card_exp_year
115
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
116
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
117
+ # expiry of the physical card.
118
+ #
119
+ # @return [String, nil]
120
+ optional :card_exp_year, String, nil?: true
121
+
95
122
  # @!attribute card_last_four
96
123
  # The last four digits of the card
97
124
  #
@@ -99,11 +126,27 @@ module Dodopayments
99
126
  optional :card_last_four, String, nil?: true
100
127
 
101
128
  # @!attribute card_network
102
- # Card network like VISA, MASTERCARD etc.
129
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
130
+ # payments can carry other casing.
103
131
  #
104
132
  # @return [String, nil]
105
133
  optional :card_network, String, nil?: true
106
134
 
135
+ # @!attribute card_type
136
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
137
+ # can carry other casing.
138
+ #
139
+ # @return [String, nil]
140
+ optional :card_type, String, nil?: true
141
+
142
+ # @!attribute charge_type
143
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
144
+ # The value is set for each payment status, not only for `succeeded`. The value is
145
+ # null when this payment charges no subscription.
146
+ #
147
+ # @return [Symbol, Dodopayments::Models::ChargeType, nil]
148
+ optional :charge_type, enum: -> { Dodopayments::ChargeType }, nil?: true
149
+
107
150
  # @!attribute checkout_session_id
108
151
  # The ID of the checkout session for this payment. The value is null when the
109
152
  # payment does not use a checkout session.
@@ -124,7 +167,11 @@ module Dodopayments
124
167
  optional :invoice_id, String, nil?: true
125
168
 
126
169
  # @!attribute invoice_url
127
- # URL to download the invoice PDF for this payment.
170
+ # @deprecated Use `GET /invoices/payments/{payment_id}` with an API key.
171
+ #
172
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
173
+ # download the invoice PDF for this payment. The URL has no signed token. If the
174
+ # business asks for a credential on its invoice links, the URL needs an API key.
128
175
  #
129
176
  # @return [String, nil]
130
177
  optional :invoice_url, String, nil?: true
@@ -156,7 +203,7 @@ module Dodopayments
156
203
  # @return [String, nil]
157
204
  optional :subscription_id, String, nil?: true
158
205
 
159
- # @!method initialize(brand_id:, created_at:, currency:, customer:, digital_products_delivered:, has_license_key:, is_multi_subscription:, metadata:, payment_id:, payment_provider:, retry_attempt:, service_periods:, subscription_ids:, total_amount:, card_last_four: nil, card_network: nil, checkout_session_id: nil, dispute_status: nil, invoice_id: nil, invoice_url: nil, payment_method: nil, payment_method_type: nil, refund_status: nil, status: nil, subscription_id: nil)
206
+ # @!method initialize(brand_id:, created_at:, currency:, customer:, digital_products_delivered:, has_license_key:, includes_usage:, is_multi_subscription:, metadata:, payment_id:, payment_provider:, retry_attempt:, service_periods:, subscription_ids:, total_amount:, card_exp_month: nil, card_exp_year: nil, card_last_four: nil, card_network: nil, card_type: nil, charge_type: nil, checkout_session_id: nil, dispute_status: nil, invoice_id: nil, invoice_url: nil, payment_method: nil, payment_method_type: nil, refund_status: nil, status: nil, subscription_id: nil)
160
207
  # Some parameter documentations has been truncated, see
161
208
  # {Dodopayments::Models::PaymentListResponse} for more details.
162
209
  #
@@ -172,6 +219,8 @@ module Dodopayments
172
219
  #
173
220
  # @param has_license_key [Boolean]
174
221
  #
222
+ # @param includes_usage [Boolean] True when this payment also bills metered usage or credit overage. The usage is
223
+ #
175
224
  # @param is_multi_subscription [Boolean] True when one payment starts more than one subscription. Read this field
176
225
  #
177
226
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
@@ -188,9 +237,17 @@ module Dodopayments
188
237
  #
189
238
  # @param total_amount [Integer]
190
239
  #
240
+ # @param card_exp_month [String, nil] Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
241
+ #
242
+ # @param card_exp_year [String, nil] Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
243
+ #
191
244
  # @param card_last_four [String, nil] The last four digits of the card
192
245
  #
193
- # @param card_network [String, nil] Card network like VISA, MASTERCARD etc.
246
+ # @param card_network [String, nil] Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older pa
247
+ #
248
+ # @param card_type [String, nil] The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments c
249
+ #
250
+ # @param charge_type [Symbol, Dodopayments::Models::ChargeType, nil] The type of subscription charge that this payment is for. Refer to `ChargeType`.
194
251
  #
195
252
  # @param checkout_session_id [String, nil] The ID of the checkout session for this payment. The value is null when
196
253
  #
@@ -198,7 +255,7 @@ module Dodopayments
198
255
  #
199
256
  # @param invoice_id [String, nil] Invoice ID for this payment. Uses India-specific invoice ID if available.
200
257
  #
201
- # @param invoice_url [String, nil] URL to download the invoice PDF for this payment.
258
+ # @param invoice_url [String, nil] DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key.
202
259
  #
203
260
  # @param payment_method [String, nil]
204
261
  #
@@ -122,14 +122,16 @@ module Dodopayments
122
122
  required :currency, enum: -> { Dodopayments::Currency }
123
123
 
124
124
  # @!attribute payment_frequency_count
125
- # Number of units for the payment frequency. For example, a value of `1` with a
126
- # `payment_frequency_interval` of `month` represents monthly payments.
125
+ # Number of `payment_frequency_interval` units between two charges. This field
126
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
127
+ # `month` charges the customer every month.
127
128
  #
128
129
  # @return [Integer]
129
130
  required :payment_frequency_count, Integer
130
131
 
131
132
  # @!attribute payment_frequency_interval
132
- # The time interval for the payment frequency (e.g., day, month, year).
133
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
134
+ # `payment_frequency_count`.
133
135
  #
134
136
  # @return [Symbol, Dodopayments::Models::TimeInterval]
135
137
  required :payment_frequency_interval, enum: -> { Dodopayments::TimeInterval }
@@ -142,14 +144,30 @@ module Dodopayments
142
144
  required :price, Integer
143
145
 
144
146
  # @!attribute subscription_period_count
145
- # Number of units for the subscription period. For example, a value of `12` with a
146
- # `subscription_period_interval` of `month` represents a one-year subscription.
147
+ # Number of `subscription_period_interval` units for the total duration of the
148
+ # subscription. This field does not set the billing cycle. Use
149
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
150
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
151
+ # subscription expires. Dodo Payments can still retry a failed payment for an
152
+ # earlier billing cycle.
153
+ #
154
+ # For a subscription that renews until the customer cancels it, set this to `20`
155
+ # with a `subscription_period_interval` of `year`. This is the recommended value
156
+ # and also the maximum. The subscription expires after 20 years if the customer
157
+ # does not cancel it before then.
158
+ #
159
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
160
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
161
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
162
+ # the subscription then expires after one month.
147
163
  #
148
164
  # @return [Integer]
149
165
  required :subscription_period_count, Integer
150
166
 
151
167
  # @!attribute subscription_period_interval
152
- # The time interval for the subscription period (e.g., day, month, year).
168
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
169
+ # it with `subscription_period_count`. The recommended value is `year`, with a
170
+ # `subscription_period_count` of `20`.
153
171
  #
154
172
  # @return [Symbol, Dodopayments::Models::TimeInterval]
155
173
  required :subscription_period_interval, enum: -> { Dodopayments::TimeInterval }
@@ -235,15 +253,15 @@ module Dodopayments
235
253
  #
236
254
  # @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
237
255
  #
238
- # @param payment_frequency_count [Integer] Number of units for the payment frequency.
256
+ # @param payment_frequency_count [Integer] Number of `payment_frequency_interval` units between two charges.
239
257
  #
240
- # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
258
+ # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the billing cycle (e.g., day, month, year).
241
259
  #
242
260
  # @param price [Integer] The payment amount. Represented in the lowest denomination of the currency (e.g.
243
261
  #
244
- # @param subscription_period_count [Integer] Number of units for the subscription period.
262
+ # @param subscription_period_count [Integer] Number of `subscription_period_interval` units for the total duration of the sub
245
263
  #
246
- # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
264
+ # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the total subscription duration (e.g., day, month, year).
247
265
  #
248
266
  # @param discount [Integer] Deprecated: use `discount_bps` instead.
249
267
  #
@@ -281,27 +299,45 @@ module Dodopayments
281
299
  required :fixed_price, Integer
282
300
 
283
301
  # @!attribute payment_frequency_count
284
- # Number of units for the payment frequency. For example, a value of `1` with a
285
- # `payment_frequency_interval` of `month` represents monthly payments.
302
+ # Number of `payment_frequency_interval` units between two charges. This field
303
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
304
+ # `month` charges the customer every month.
286
305
  #
287
306
  # @return [Integer]
288
307
  required :payment_frequency_count, Integer
289
308
 
290
309
  # @!attribute payment_frequency_interval
291
- # The time interval for the payment frequency (e.g., day, month, year).
310
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
311
+ # `payment_frequency_count`.
292
312
  #
293
313
  # @return [Symbol, Dodopayments::Models::TimeInterval]
294
314
  required :payment_frequency_interval, enum: -> { Dodopayments::TimeInterval }
295
315
 
296
316
  # @!attribute subscription_period_count
297
- # Number of units for the subscription period. For example, a value of `12` with a
298
- # `subscription_period_interval` of `month` represents a one-year subscription.
317
+ # Number of `subscription_period_interval` units for the total duration of the
318
+ # subscription. This field does not set the billing cycle. Use
319
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
320
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
321
+ # subscription expires. Dodo Payments can still retry a failed payment for an
322
+ # earlier billing cycle.
323
+ #
324
+ # For a subscription that renews until the customer cancels it, set this to `20`
325
+ # with a `subscription_period_interval` of `year`. This is the recommended value
326
+ # and also the maximum. The subscription expires after 20 years if the customer
327
+ # does not cancel it before then.
328
+ #
329
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
330
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
331
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
332
+ # the subscription then expires after one month.
299
333
  #
300
334
  # @return [Integer]
301
335
  required :subscription_period_count, Integer
302
336
 
303
337
  # @!attribute subscription_period_interval
304
- # The time interval for the subscription period (e.g., day, month, year).
338
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
339
+ # it with `subscription_period_count`. The recommended value is `year`, with a
340
+ # `subscription_period_count` of `20`.
305
341
  #
306
342
  # @return [Symbol, Dodopayments::Models::TimeInterval]
307
343
  required :subscription_period_interval, enum: -> { Dodopayments::TimeInterval }
@@ -366,13 +402,13 @@ module Dodopayments
366
402
  #
367
403
  # @param fixed_price [Integer] The fixed payment amount. Represented in the lowest denomination of the currency
368
404
  #
369
- # @param payment_frequency_count [Integer] Number of units for the payment frequency.
405
+ # @param payment_frequency_count [Integer] Number of `payment_frequency_interval` units between two charges.
370
406
  #
371
- # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
407
+ # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the billing cycle (e.g., day, month, year).
372
408
  #
373
- # @param subscription_period_count [Integer] Number of units for the subscription period.
409
+ # @param subscription_period_count [Integer] Number of `subscription_period_interval` units for the total duration of the sub
374
410
  #
375
- # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
411
+ # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the total subscription duration (e.g., day, month, year).
376
412
  #
377
413
  # @param discount [Integer] Deprecated: use `discount_bps` instead.
378
414
  #