dodopayments 2.38.0 → 2.39.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/app_installation_retrieve_settings_params.rb +14 -0
  6. data/lib/dodopayments/models/app_installation_retrieve_settings_response.rb +87 -0
  7. data/lib/dodopayments/models/customer_retrieve_payment_methods_params.rb +17 -1
  8. data/lib/dodopayments/models/invoice.rb +20 -1
  9. data/lib/dodopayments/models/invoice_create_params.rb +9 -1
  10. data/lib/dodopayments/models/invoice_preview_params.rb +9 -1
  11. data/lib/dodopayments/models/invoice_update_params.rb +9 -1
  12. data/lib/dodopayments/models/subscription_start_trial_params.rb +191 -0
  13. data/lib/dodopayments/models/subscription_start_trial_response.rb +32 -0
  14. data/lib/dodopayments/models.rb +4 -0
  15. data/lib/dodopayments/resources/app_installation.rb +33 -0
  16. data/lib/dodopayments/resources/customers.rb +9 -2
  17. data/lib/dodopayments/resources/invoices.rb +11 -5
  18. data/lib/dodopayments/resources/subscriptions.rb +50 -0
  19. data/lib/dodopayments/version.rb +1 -1
  20. data/lib/dodopayments.rb +5 -0
  21. data/rbi/dodopayments/client.rbi +3 -0
  22. data/rbi/dodopayments/models/app_installation_retrieve_settings_params.rbi +32 -0
  23. data/rbi/dodopayments/models/app_installation_retrieve_settings_response.rbi +105 -0
  24. data/rbi/dodopayments/models/customer_retrieve_payment_methods_params.rbi +28 -2
  25. data/rbi/dodopayments/models/invoice.rbi +25 -0
  26. data/rbi/dodopayments/models/invoice_create_params.rbi +8 -0
  27. data/rbi/dodopayments/models/invoice_preview_params.rbi +8 -0
  28. data/rbi/dodopayments/models/invoice_update_params.rbi +8 -0
  29. data/rbi/dodopayments/models/subscription_start_trial_params.rbi +302 -0
  30. data/rbi/dodopayments/models/subscription_start_trial_response.rbi +50 -0
  31. data/rbi/dodopayments/models.rbi +6 -0
  32. data/rbi/dodopayments/resources/app_installation.rbi +22 -0
  33. data/rbi/dodopayments/resources/customers.rbi +5 -0
  34. data/rbi/dodopayments/resources/invoices.rbi +14 -2
  35. data/rbi/dodopayments/resources/subscriptions.rbi +59 -0
  36. data/sig/dodopayments/client.rbs +2 -0
  37. data/sig/dodopayments/models/app_installation_retrieve_settings_params.rbs +15 -0
  38. data/sig/dodopayments/models/app_installation_retrieve_settings_response.rbs +60 -0
  39. data/sig/dodopayments/models/customer_retrieve_payment_methods_params.rbs +22 -1
  40. data/sig/dodopayments/models/invoice.rbs +12 -0
  41. data/sig/dodopayments/models/invoice_create_params.rbs +5 -0
  42. data/sig/dodopayments/models/invoice_preview_params.rbs +5 -0
  43. data/sig/dodopayments/models/invoice_update_params.rbs +5 -0
  44. data/sig/dodopayments/models/subscription_start_trial_params.rbs +156 -0
  45. data/sig/dodopayments/models/subscription_start_trial_response.rbs +26 -0
  46. data/sig/dodopayments/models.rbs +4 -0
  47. data/sig/dodopayments/resources/app_installation.rbs +11 -0
  48. data/sig/dodopayments/resources/customers.rbs +2 -0
  49. data/sig/dodopayments/resources/invoices.rbs +3 -0
  50. data/sig/dodopayments/resources/subscriptions.rbs +16 -0
  51. metadata +17 -2
@@ -12,7 +12,7 @@ module Dodopayments
12
12
  # Creates a draft. A repeat with the same `Idempotency-Key` returns the first
13
13
  # draft.
14
14
  #
15
- # @overload create(collection_method:, currency:, customer_id:, items:, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_terms: nil, review_required: nil, tax_id: nil, idempotency_key: nil, request_options: {})
15
+ # @overload create(collection_method:, currency:, customer_id:, items:, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_method_id: nil, payment_terms: nil, review_required: nil, tax_id: nil, idempotency_key: nil, request_options: {})
16
16
  #
17
17
  # @param collection_method [Symbol, Dodopayments::Models::CollectionMethod] Body param
18
18
  #
@@ -38,6 +38,8 @@ module Dodopayments
38
38
  #
39
39
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Body param: Arbitrary key-value metadata. Values can be string, integer, number,
40
40
  #
41
+ # @param payment_method_id [String, nil] Body param: A saved card of the customer. The new subscriptions of the invoice c
42
+ #
41
43
  # @param payment_terms [Dodopayments::Models::InvoiceCreateParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::InvoiceCreateParams::PaymentTerms::Net, nil] Body param: Do not send it with `due_at`.
42
44
  #
43
45
  # @param review_required [Boolean] Body param: `true` keeps a renewal draft for review before it finalises.
@@ -89,7 +91,7 @@ module Dodopayments
89
91
  #
90
92
  # Changes only the sent fields. `null` clears a field that can be empty.
91
93
  #
92
- # @overload update(invoice_id, if_match:, billing_address: nil, cc_emails: nil, collection_method: nil, currency: nil, customer_email: nil, customer_id: nil, discount_ids: nil, due_at: nil, dunning: nil, items: nil, memo: nil, metadata: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
94
+ # @overload update(invoice_id, if_match:, billing_address: nil, cc_emails: nil, collection_method: nil, currency: nil, customer_email: nil, customer_id: nil, discount_ids: nil, due_at: nil, dunning: nil, items: nil, memo: nil, metadata: nil, payment_method_id: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
93
95
  #
94
96
  # @param invoice_id [String] Path param: Invoice ID
95
97
  #
@@ -119,6 +121,8 @@ module Dodopayments
119
121
  #
120
122
  # @param metadata [Hash{Symbol=>String, Float, Boolean}, nil] Body param: Arbitrary key-value metadata. Values can be string, integer, number,
121
123
  #
124
+ # @param payment_method_id [String, nil] Body param: A saved card of the customer. `null` removes the card from the draft
125
+ #
122
126
  # @param payment_terms [Dodopayments::Models::InvoiceUpdateParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::InvoiceUpdateParams::PaymentTerms::Net, nil] Body param
123
127
  #
124
128
  # @param review_required [Boolean, nil] Body param
@@ -243,8 +247,8 @@ module Dodopayments
243
247
  )
244
248
  end
245
249
 
246
- # Returns the page where the customer pays. A copied link counts as a send, so the
247
- # first call sets `sent_at`.
250
+ # Returns the page where the customer pays. The first call sets `sent_at` and
251
+ # records a `link_shared` event. It sends no email and no `invoice.sent` webhook.
248
252
  #
249
253
  # @overload create_hosted_link(invoice_id, request_options: {})
250
254
  #
@@ -367,7 +371,7 @@ module Dodopayments
367
371
  #
368
372
  # Prices the body as a draft and returns it. No row is saved.
369
373
  #
370
- # @overload preview(collection_method:, currency:, customer_id:, items:, format_: nil, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
374
+ # @overload preview(collection_method:, currency:, customer_id:, items:, format_: nil, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_method_id: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
371
375
  #
372
376
  # @param collection_method [Symbol, Dodopayments::Models::CollectionMethod] Body param
373
377
  #
@@ -395,6 +399,8 @@ module Dodopayments
395
399
  #
396
400
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Body param: Arbitrary key-value metadata. Values can be string, integer, number,
397
401
  #
402
+ # @param payment_method_id [String, nil] Body param: A saved card of the customer. The new subscriptions of the invoice c
403
+ #
398
404
  # @param payment_terms [Dodopayments::Models::InvoicePreviewParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::InvoicePreviewParams::PaymentTerms::Net, nil] Body param: Do not send it with `due_at`.
399
405
  #
400
406
  # @param review_required [Boolean] Body param: `true` keeps a renewal draft for review before it finalises.
@@ -466,6 +466,56 @@ module Dodopayments
466
466
  )
467
467
  end
468
468
 
469
+ # Some parameter documentations has been truncated, see
470
+ # {Dodopayments::Models::SubscriptionStartTrialParams} for more details.
471
+ #
472
+ # Creates an invoice-led subscription and a paid $0 invoice for the trial. The
473
+ # first invoice after the trial bills at `trial_ends_at`.
474
+ #
475
+ # @overload start_trial(collection_method:, currency:, customer_id:, product_id:, billing_address: nil, payment_method_id: nil, payment_terms: nil, quantity: nil, review_required: nil, tax_id: nil, trial_period_days: nil, idempotency_key: nil, request_options: {})
476
+ #
477
+ # @param collection_method [Symbol, Dodopayments::Models::CollectionMethod] Body param
478
+ #
479
+ # @param currency [Symbol, Dodopayments::Models::Currency] Body param
480
+ #
481
+ # @param customer_id [String] Body param
482
+ #
483
+ # @param product_id [String] Body param: A recurring product.
484
+ #
485
+ # @param billing_address [Dodopayments::Models::SubscriptionStartTrialParams::BillingAddress, nil] Body param: The billing address of an invoice request.
486
+ #
487
+ # @param payment_method_id [String, nil] Body param: A saved card of the customer. Automatic charge needs it.
488
+ #
489
+ # @param payment_terms [Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::Net, nil] Body param: The terms of the invoices after the trial.
490
+ #
491
+ # @param quantity [Integer] Body param
492
+ #
493
+ # @param review_required [Boolean] Body param: `true` keeps each renewal draft for review before it finalises.
494
+ #
495
+ # @param tax_id [String, nil] Body param
496
+ #
497
+ # @param trial_period_days [Integer, nil] Body param: 1 to 730 days. When this is not set, the product trial applies and t
498
+ #
499
+ # @param idempotency_key [String] Header param: A key of 1 to 255 characters. A repeat with the same key returns t
500
+ #
501
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
502
+ #
503
+ # @return [Dodopayments::Models::SubscriptionStartTrialResponse]
504
+ #
505
+ # @see Dodopayments::Models::SubscriptionStartTrialParams
506
+ def start_trial(params)
507
+ parsed, options = Dodopayments::SubscriptionStartTrialParams.dump_request(params)
508
+ header_params = {idempotency_key: "idempotency-key"}
509
+ @client.request(
510
+ method: :post,
511
+ path: "billing/subscriptions",
512
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
513
+ body: parsed.except(*header_params.keys),
514
+ model: Dodopayments::Models::SubscriptionStartTrialResponse,
515
+ options: options
516
+ )
517
+ end
518
+
469
519
  # For an invoice-led subscription, billing charges the open invoices after the
470
520
  # change, so the response has no payment.
471
521
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.38.0"
4
+ VERSION = "2.39.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -84,6 +84,8 @@ require_relative "dodopayments/models/addon_unarchive_params"
84
84
  require_relative "dodopayments/models/addon_update_images_params"
85
85
  require_relative "dodopayments/models/addon_update_images_response"
86
86
  require_relative "dodopayments/models/addon_update_params"
87
+ require_relative "dodopayments/models/app_installation_retrieve_settings_params"
88
+ require_relative "dodopayments/models/app_installation_retrieve_settings_response"
87
89
  require_relative "dodopayments/models/attach_addon"
88
90
  require_relative "dodopayments/models/attach_credit_entitlement"
89
91
  require_relative "dodopayments/models/attach_existing_customer"
@@ -433,6 +435,8 @@ require_relative "dodopayments/models/subscription_retrieve_upcoming_invoice_par
433
435
  require_relative "dodopayments/models/subscription_retrieve_usage_history_params"
434
436
  require_relative "dodopayments/models/subscription_retrieve_usage_history_response"
435
437
  require_relative "dodopayments/models/subscription_service_period"
438
+ require_relative "dodopayments/models/subscription_start_trial_params"
439
+ require_relative "dodopayments/models/subscription_start_trial_response"
436
440
  require_relative "dodopayments/models/subscription_status"
437
441
  require_relative "dodopayments/models/subscription_unpaused_webhook_event"
438
442
  require_relative "dodopayments/models/subscription_updated_webhook_event"
@@ -469,6 +473,7 @@ require_relative "dodopayments/models/webhook_unwrap_params"
469
473
  require_relative "dodopayments/models/webhook_update_params"
470
474
  require_relative "dodopayments/models"
471
475
  require_relative "dodopayments/resources/addons"
476
+ require_relative "dodopayments/resources/app_installation"
472
477
  require_relative "dodopayments/resources/balances"
473
478
  require_relative "dodopayments/resources/blocklist"
474
479
  require_relative "dodopayments/resources/blocklist/customers"
@@ -107,6 +107,9 @@ module Dodopayments
107
107
  sig { returns(Dodopayments::Resources::Moderation) }
108
108
  attr_reader :moderation
109
109
 
110
+ sig { returns(Dodopayments::Resources::AppInstallation) }
111
+ attr_reader :app_installation
112
+
110
113
  # @api private
111
114
  sig { override.returns(T::Hash[String, String]) }
112
115
  private def auth_headers
@@ -0,0 +1,32 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class AppInstallationRetrieveSettingsParams < Dodopayments::Internal::Type::BaseModel
6
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
7
+ include Dodopayments::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Dodopayments::AppInstallationRetrieveSettingsParams,
13
+ Dodopayments::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ params(request_options: Dodopayments::RequestOptions::OrHash).returns(
19
+ T.attached_class
20
+ )
21
+ end
22
+ def self.new(request_options: {})
23
+ end
24
+
25
+ sig do
26
+ override.returns({ request_options: Dodopayments::RequestOptions })
27
+ end
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,105 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class AppInstallationRetrieveSettingsResponse < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::Models::AppInstallationRetrieveSettingsResponse,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # `true` when a required field has no value, or a stored value fails a live rule.
15
+ sig { returns(T::Boolean) }
16
+ attr_accessor :action_needed
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :app_id
20
+
21
+ sig { returns(String) }
22
+ attr_accessor :installation_id
23
+
24
+ # The keys that need an action.
25
+ sig { returns(T::Array[String]) }
26
+ attr_accessor :invalid_keys
27
+
28
+ # The values of the secret fields of the live manifest, by key.
29
+ sig { returns(T.anything) }
30
+ attr_accessor :secrets
31
+
32
+ # The values of the fields of the live manifest that are not secrets.
33
+ sig { returns(T.anything) }
34
+ attr_accessor :values
35
+
36
+ # The version of the live settings manifest. It is `null` when the app has no live
37
+ # manifest. Then `values` and `secrets` are empty.
38
+ sig { returns(T.nilable(Integer)) }
39
+ attr_accessor :live_manifest_version
40
+
41
+ # The manifest version of the last save. It is `null` when the installation has no
42
+ # settings.
43
+ sig { returns(T.nilable(Integer)) }
44
+ attr_accessor :manifest_version
45
+
46
+ # The time of the last save.
47
+ sig { returns(T.nilable(Time)) }
48
+ attr_accessor :updated_at
49
+
50
+ # The settings of the App Installation of the app token, with the secret values.
51
+ sig do
52
+ params(
53
+ action_needed: T::Boolean,
54
+ app_id: String,
55
+ installation_id: String,
56
+ invalid_keys: T::Array[String],
57
+ secrets: T.anything,
58
+ values: T.anything,
59
+ live_manifest_version: T.nilable(Integer),
60
+ manifest_version: T.nilable(Integer),
61
+ updated_at: T.nilable(Time)
62
+ ).returns(T.attached_class)
63
+ end
64
+ def self.new(
65
+ # `true` when a required field has no value, or a stored value fails a live rule.
66
+ action_needed:,
67
+ app_id:,
68
+ installation_id:,
69
+ # The keys that need an action.
70
+ invalid_keys:,
71
+ # The values of the secret fields of the live manifest, by key.
72
+ secrets:,
73
+ # The values of the fields of the live manifest that are not secrets.
74
+ values:,
75
+ # The version of the live settings manifest. It is `null` when the app has no live
76
+ # manifest. Then `values` and `secrets` are empty.
77
+ live_manifest_version: nil,
78
+ # The manifest version of the last save. It is `null` when the installation has no
79
+ # settings.
80
+ manifest_version: nil,
81
+ # The time of the last save.
82
+ updated_at: nil
83
+ )
84
+ end
85
+
86
+ sig do
87
+ override.returns(
88
+ {
89
+ action_needed: T::Boolean,
90
+ app_id: String,
91
+ installation_id: String,
92
+ invalid_keys: T::Array[String],
93
+ secrets: T.anything,
94
+ values: T.anything,
95
+ live_manifest_version: T.nilable(Integer),
96
+ manifest_version: T.nilable(Integer),
97
+ updated_at: T.nilable(Time)
98
+ }
99
+ )
100
+ end
101
+ def to_hash
102
+ end
103
+ end
104
+ end
105
+ end
@@ -17,18 +17,44 @@ module Dodopayments
17
17
  sig { returns(String) }
18
18
  attr_accessor :customer_id
19
19
 
20
+ # ISO country code alpha2 variant
21
+ sig { returns(T.nilable(Dodopayments::CountryCode::OrSymbol)) }
22
+ attr_reader :billing_country
23
+
24
+ sig { params(billing_country: Dodopayments::CountryCode::OrSymbol).void }
25
+ attr_writer :billing_country
26
+
27
+ sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
28
+ attr_reader :currency
29
+
30
+ sig { params(currency: Dodopayments::Currency::OrSymbol).void }
31
+ attr_writer :currency
32
+
20
33
  sig do
21
34
  params(
22
35
  customer_id: String,
36
+ billing_country: Dodopayments::CountryCode::OrSymbol,
37
+ currency: Dodopayments::Currency::OrSymbol,
23
38
  request_options: Dodopayments::RequestOptions::OrHash
24
39
  ).returns(T.attached_class)
25
40
  end
26
- def self.new(customer_id:, request_options: {})
41
+ def self.new(
42
+ customer_id:,
43
+ # ISO country code alpha2 variant
44
+ billing_country: nil,
45
+ currency: nil,
46
+ request_options: {}
47
+ )
27
48
  end
28
49
 
29
50
  sig do
30
51
  override.returns(
31
- { customer_id: String, request_options: Dodopayments::RequestOptions }
52
+ {
53
+ customer_id: String,
54
+ billing_country: Dodopayments::CountryCode::OrSymbol,
55
+ currency: Dodopayments::Currency::OrSymbol,
56
+ request_options: Dodopayments::RequestOptions
57
+ }
32
58
  )
33
59
  end
34
60
  def to_hash
@@ -80,6 +80,12 @@ module Dodopayments
80
80
  sig { returns(Integer) }
81
81
  attr_accessor :retry_count
82
82
 
83
+ # `true` when a subscription of the invoice has renewal review on now. The value
84
+ # follows the subscription, so it can change after finalise. `review_deadline`
85
+ # shows that this draft waits.
86
+ sig { returns(T::Boolean) }
87
+ attr_accessor :review_required
88
+
83
89
  # Goes up by one on each change. Use it to ignore an older webhook delivery.
84
90
  sig { returns(Integer) }
85
91
  attr_accessor :row_version
@@ -135,6 +141,10 @@ module Dodopayments
135
141
  sig { returns(T.nilable(Time)) }
136
142
  attr_accessor :next_retry_at
137
143
 
144
+ # The saved card that an automatic charge of the invoice uses.
145
+ sig { returns(T.nilable(String)) }
146
+ attr_accessor :payment_method_id
147
+
138
148
  # Days from finalise to the due date. `null` when the invoice has a custom due
139
149
  # date.
140
150
  sig { returns(T.nilable(Integer)) }
@@ -188,6 +198,7 @@ module Dodopayments
188
198
  metadata: T.anything,
189
199
  refund_ids: T::Array[String],
190
200
  retry_count: Integer,
201
+ review_required: T::Boolean,
191
202
  row_version: Integer,
192
203
  status: Dodopayments::InvoiceStatus::OrSymbol,
193
204
  subscription_ids: T::Array[String],
@@ -204,6 +215,7 @@ module Dodopayments
204
215
  memo: T.nilable(String),
205
216
  next_reminder_at: T.nilable(Time),
206
217
  next_retry_at: T.nilable(Time),
218
+ payment_method_id: T.nilable(String),
207
219
  payment_terms_days: T.nilable(Integer),
208
220
  payments: T.nilable(T::Array[Dodopayments::Invoice::Payment::OrHash]),
209
221
  pdf_url: T.nilable(String),
@@ -250,6 +262,10 @@ module Dodopayments
250
262
  refund_ids:,
251
263
  # The number of failed automatic charges.
252
264
  retry_count:,
265
+ # `true` when a subscription of the invoice has renewal review on now. The value
266
+ # follows the subscription, so it can change after finalise. `review_deadline`
267
+ # shows that this draft waits.
268
+ review_required:,
253
269
  # Goes up by one on each change. Use it to ignore an older webhook delivery.
254
270
  row_version:,
255
271
  # The `message` of each variant is the label of the invoice document.
@@ -275,6 +291,8 @@ module Dodopayments
275
291
  # date. `null` when no reminder email will go out.
276
292
  next_reminder_at: nil,
277
293
  next_retry_at: nil,
294
+ # The saved card that an automatic charge of the invoice uses.
295
+ payment_method_id: nil,
278
296
  # Days from finalise to the due date. `null` when the invoice has a custom due
279
297
  # date.
280
298
  payment_terms_days: nil,
@@ -311,6 +329,7 @@ module Dodopayments
311
329
  metadata: T.anything,
312
330
  refund_ids: T::Array[String],
313
331
  retry_count: Integer,
332
+ review_required: T::Boolean,
314
333
  row_version: Integer,
315
334
  status: Dodopayments::InvoiceStatus::TaggedSymbol,
316
335
  subscription_ids: T::Array[String],
@@ -327,6 +346,7 @@ module Dodopayments
327
346
  memo: T.nilable(String),
328
347
  next_reminder_at: T.nilable(Time),
329
348
  next_retry_at: T.nilable(Time),
349
+ payment_method_id: T.nilable(String),
330
350
  payment_terms_days: T.nilable(Integer),
331
351
  payments: T.nilable(T::Array[Dodopayments::Invoice::Payment]),
332
352
  pdf_url: T.nilable(String),
@@ -557,6 +577,11 @@ module Dodopayments
557
577
  :review_required,
558
578
  Dodopayments::Invoice::EditableField::TaggedSymbol
559
579
  )
580
+ PAYMENT_METHOD =
581
+ T.let(
582
+ :payment_method,
583
+ Dodopayments::Invoice::EditableField::TaggedSymbol
584
+ )
560
585
  DUE_AT =
561
586
  T.let(:due_at, Dodopayments::Invoice::EditableField::TaggedSymbol)
562
587
  COLLECTION_METHOD =
@@ -96,6 +96,10 @@ module Dodopayments
96
96
  end
97
97
  attr_writer :metadata
98
98
 
99
+ # A saved card of the customer. The new subscriptions of the invoice charge it.
100
+ sig { returns(T.nilable(String)) }
101
+ attr_accessor :payment_method_id
102
+
99
103
  # Do not send it with `due_at`.
100
104
  sig do
101
105
  returns(
@@ -149,6 +153,7 @@ module Dodopayments
149
153
  T.nilable(Dodopayments::InvoiceCreateParams::Dunning::OrHash),
150
154
  memo: T.nilable(String),
151
155
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
156
+ payment_method_id: T.nilable(String),
152
157
  payment_terms:
153
158
  T.nilable(
154
159
  T.any(
@@ -184,6 +189,8 @@ module Dodopayments
184
189
  memo: nil,
185
190
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
186
191
  metadata: nil,
192
+ # A saved card of the customer. The new subscriptions of the invoice charge it.
193
+ payment_method_id: nil,
187
194
  # Do not send it with `due_at`.
188
195
  payment_terms: nil,
189
196
  # `true` keeps a renewal draft for review before it finalises.
@@ -216,6 +223,7 @@ module Dodopayments
216
223
  dunning: T.nilable(Dodopayments::InvoiceCreateParams::Dunning),
217
224
  memo: T.nilable(String),
218
225
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
226
+ payment_method_id: T.nilable(String),
219
227
  payment_terms:
220
228
  T.nilable(
221
229
  T.any(
@@ -114,6 +114,10 @@ module Dodopayments
114
114
  end
115
115
  attr_writer :metadata
116
116
 
117
+ # A saved card of the customer. The new subscriptions of the invoice charge it.
118
+ sig { returns(T.nilable(String)) }
119
+ attr_accessor :payment_method_id
120
+
117
121
  # Do not send it with `due_at`.
118
122
  sig do
119
123
  returns(
@@ -162,6 +166,7 @@ module Dodopayments
162
166
  T.nilable(Dodopayments::InvoicePreviewParams::Dunning::OrHash),
163
167
  memo: T.nilable(String),
164
168
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
169
+ payment_method_id: T.nilable(String),
165
170
  payment_terms:
166
171
  T.nilable(
167
172
  T.any(
@@ -200,6 +205,8 @@ module Dodopayments
200
205
  memo: nil,
201
206
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
202
207
  metadata: nil,
208
+ # A saved card of the customer. The new subscriptions of the invoice charge it.
209
+ payment_method_id: nil,
203
210
  # Do not send it with `due_at`.
204
211
  payment_terms: nil,
205
212
  # `true` keeps a renewal draft for review before it finalises.
@@ -232,6 +239,7 @@ module Dodopayments
232
239
  dunning: T.nilable(Dodopayments::InvoicePreviewParams::Dunning),
233
240
  memo: T.nilable(String),
234
241
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
242
+ payment_method_id: T.nilable(String),
235
243
  payment_terms:
236
244
  T.nilable(
237
245
  T.any(
@@ -95,6 +95,10 @@ module Dodopayments
95
95
  end
96
96
  attr_accessor :metadata
97
97
 
98
+ # A saved card of the customer. `null` removes the card from the draft.
99
+ sig { returns(T.nilable(String)) }
100
+ attr_accessor :payment_method_id
101
+
98
102
  sig do
99
103
  returns(
100
104
  T.nilable(
@@ -143,6 +147,7 @@ module Dodopayments
143
147
  memo: T.nilable(String),
144
148
  metadata:
145
149
  T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
150
+ payment_method_id: T.nilable(String),
146
151
  payment_terms:
147
152
  T.nilable(
148
153
  T.any(
@@ -177,6 +182,8 @@ module Dodopayments
177
182
  memo: nil,
178
183
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
179
184
  metadata: nil,
185
+ # A saved card of the customer. `null` removes the card from the draft.
186
+ payment_method_id: nil,
180
187
  payment_terms: nil,
181
188
  review_required: nil,
182
189
  tax_id: nil,
@@ -212,6 +219,7 @@ module Dodopayments
212
219
  memo: T.nilable(String),
213
220
  metadata:
214
221
  T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
222
+ payment_method_id: T.nilable(String),
215
223
  payment_terms:
216
224
  T.nilable(
217
225
  T.any(