dodopayments 1.71.1 → 1.74.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/checkout_session_preview_params.rb +14 -0
  5. data/lib/dodopayments/models/checkout_session_preview_response.rb +426 -0
  6. data/lib/dodopayments/models/checkout_session_request.rb +94 -1
  7. data/lib/dodopayments/models/customer_list_params.rb +25 -1
  8. data/lib/dodopayments/models/discount_list_params.rb +33 -1
  9. data/lib/dodopayments/models/discount_retrieve_by_code_params.rb +14 -0
  10. data/lib/dodopayments/models/license_key_list_params.rb +17 -1
  11. data/lib/dodopayments/models/payment.rb +40 -1
  12. data/lib/dodopayments/models/payment_list_response.rb +28 -1
  13. data/lib/dodopayments/models/payment_method_types.rb +13 -98
  14. data/lib/dodopayments/models/product.rb +9 -1
  15. data/lib/dodopayments/models/subscription.rb +32 -1
  16. data/lib/dodopayments/models/subscription_change_plan_params.rb +10 -1
  17. data/lib/dodopayments/models/subscription_list_response.rb +9 -1
  18. data/lib/dodopayments/models/subscription_preview_change_plan_params.rb +10 -1
  19. data/lib/dodopayments/models.rb +4 -0
  20. data/lib/dodopayments/resources/checkout_sessions.rb +64 -1
  21. data/lib/dodopayments/resources/customers.rb +7 -1
  22. data/lib/dodopayments/resources/discounts.rb +31 -1
  23. data/lib/dodopayments/resources/license_keys.rb +5 -1
  24. data/lib/dodopayments/resources/subscriptions.rb +6 -2
  25. data/lib/dodopayments/version.rb +1 -1
  26. data/lib/dodopayments.rb +3 -0
  27. data/rbi/dodopayments/models/checkout_session_preview_params.rbi +32 -0
  28. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +616 -0
  29. data/rbi/dodopayments/models/checkout_session_request.rbi +183 -0
  30. data/rbi/dodopayments/models/customer_list_params.rbi +33 -0
  31. data/rbi/dodopayments/models/discount_list_params.rbi +44 -0
  32. data/rbi/dodopayments/models/discount_retrieve_by_code_params.rbi +32 -0
  33. data/rbi/dodopayments/models/license_key_list_params.rbi +22 -0
  34. data/rbi/dodopayments/models/payment.rbi +54 -0
  35. data/rbi/dodopayments/models/payment_list_response.rbi +16 -0
  36. data/rbi/dodopayments/models/payment_method_types.rbi +18 -186
  37. data/rbi/dodopayments/models/product.rbi +11 -3
  38. data/rbi/dodopayments/models/subscription.rbi +50 -0
  39. data/rbi/dodopayments/models/subscription_change_plan_params.rbi +10 -0
  40. data/rbi/dodopayments/models/subscription_list_response.rbi +8 -0
  41. data/rbi/dodopayments/models/subscription_preview_change_plan_params.rbi +10 -0
  42. data/rbi/dodopayments/models.rbi +6 -0
  43. data/rbi/dodopayments/resources/checkout_sessions.rbi +104 -0
  44. data/rbi/dodopayments/resources/customers.rbi +9 -0
  45. data/rbi/dodopayments/resources/discounts.rbi +28 -0
  46. data/rbi/dodopayments/resources/license_keys.rbi +6 -0
  47. data/rbi/dodopayments/resources/subscriptions.rbi +8 -0
  48. data/sig/dodopayments/models/checkout_session_preview_params.rbs +15 -0
  49. data/sig/dodopayments/models/checkout_session_preview_response.rbs +330 -0
  50. data/sig/dodopayments/models/checkout_session_request.rbs +81 -0
  51. data/sig/dodopayments/models/customer_list_params.rbs +26 -1
  52. data/sig/dodopayments/models/discount_list_params.rbs +34 -1
  53. data/sig/dodopayments/models/discount_retrieve_by_code_params.rbs +15 -0
  54. data/sig/dodopayments/models/license_key_list_params.rbs +14 -0
  55. data/sig/dodopayments/models/payment.rbs +22 -0
  56. data/sig/dodopayments/models/payment_list_response.rbs +10 -0
  57. data/sig/dodopayments/models/payment_method_types.rbs +26 -196
  58. data/sig/dodopayments/models/product.rbs +8 -3
  59. data/sig/dodopayments/models/subscription.rbs +17 -0
  60. data/sig/dodopayments/models/subscription_change_plan_params.rbs +6 -1
  61. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  62. data/sig/dodopayments/models/subscription_preview_change_plan_params.rbs +6 -1
  63. data/sig/dodopayments/models.rbs +4 -0
  64. data/sig/dodopayments/resources/checkout_sessions.rbs +25 -0
  65. data/sig/dodopayments/resources/customers.rbs +3 -0
  66. data/sig/dodopayments/resources/discounts.rbs +9 -0
  67. data/sig/dodopayments/resources/license_keys.rbs +2 -0
  68. data/sig/dodopayments/resources/subscriptions.rbs +2 -0
  69. metadata +11 -2
@@ -7,6 +7,24 @@ module Dodopayments
7
7
  extend Dodopayments::Internal::Type::RequestParameters::Converter
8
8
  include Dodopayments::Internal::Type::RequestParameters
9
9
 
10
+ # @!attribute active
11
+ # Filter by active status (true = not expired, false = expired)
12
+ #
13
+ # @return [Boolean, nil]
14
+ optional :active, Dodopayments::Internal::Type::Boolean
15
+
16
+ # @!attribute code
17
+ # Filter by discount code (partial match, case-insensitive)
18
+ #
19
+ # @return [String, nil]
20
+ optional :code, String
21
+
22
+ # @!attribute discount_type
23
+ # Filter by discount type (percentage)
24
+ #
25
+ # @return [Symbol, Dodopayments::Models::DiscountType, nil]
26
+ optional :discount_type, enum: -> { Dodopayments::DiscountType }
27
+
10
28
  # @!attribute page_number
11
29
  # Page number (default = 0).
12
30
  #
@@ -19,11 +37,25 @@ module Dodopayments
19
37
  # @return [Integer, nil]
20
38
  optional :page_size, Integer
21
39
 
22
- # @!method initialize(page_number: nil, page_size: nil, request_options: {})
40
+ # @!attribute product_id
41
+ # Filter by product restriction (only discounts that apply to this product)
42
+ #
43
+ # @return [String, nil]
44
+ optional :product_id, String
45
+
46
+ # @!method initialize(active: nil, code: nil, discount_type: nil, page_number: nil, page_size: nil, product_id: nil, request_options: {})
47
+ # @param active [Boolean] Filter by active status (true = not expired, false = expired)
48
+ #
49
+ # @param code [String] Filter by discount code (partial match, case-insensitive)
50
+ #
51
+ # @param discount_type [Symbol, Dodopayments::Models::DiscountType] Filter by discount type (percentage)
52
+ #
23
53
  # @param page_number [Integer] Page number (default = 0).
24
54
  #
25
55
  # @param page_size [Integer] Page size (default = 10, max = 100).
26
56
  #
57
+ # @param product_id [String] Filter by product restriction (only discounts that apply to this product)
58
+ #
27
59
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
28
60
  end
29
61
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Discounts#retrieve_by_code
6
+ class DiscountRetrieveByCodeParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -7,6 +7,18 @@ module Dodopayments
7
7
  extend Dodopayments::Internal::Type::RequestParameters::Converter
8
8
  include Dodopayments::Internal::Type::RequestParameters
9
9
 
10
+ # @!attribute created_at_gte
11
+ # Filter license keys created on or after this timestamp
12
+ #
13
+ # @return [Time, nil]
14
+ optional :created_at_gte, Time
15
+
16
+ # @!attribute created_at_lte
17
+ # Filter license keys created on or before this timestamp
18
+ #
19
+ # @return [Time, nil]
20
+ optional :created_at_lte, Time
21
+
10
22
  # @!attribute customer_id
11
23
  # Filter by customer ID
12
24
  #
@@ -37,7 +49,11 @@ module Dodopayments
37
49
  # @return [Symbol, Dodopayments::Models::LicenseKeyListParams::Status, nil]
38
50
  optional :status, enum: -> { Dodopayments::LicenseKeyListParams::Status }
39
51
 
40
- # @!method initialize(customer_id: nil, page_number: nil, page_size: nil, product_id: nil, status: nil, request_options: {})
52
+ # @!method initialize(created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, product_id: nil, status: nil, request_options: {})
53
+ # @param created_at_gte [Time] Filter license keys created on or after this timestamp
54
+ #
55
+ # @param created_at_lte [Time] Filter license keys created on or before this timestamp
56
+ #
41
57
  # @param customer_id [String] Filter by customer ID
42
58
  #
43
59
  # @param page_number [Integer] Page number default is 0
@@ -130,6 +130,14 @@ module Dodopayments
130
130
  # @return [String, nil]
131
131
  optional :checkout_session_id, String, nil?: true
132
132
 
133
+ # @!attribute custom_field_responses
134
+ # Customer's responses to custom fields collected during checkout
135
+ #
136
+ # @return [Array<Dodopayments::Models::Payment::CustomFieldResponse>, nil]
137
+ optional :custom_field_responses,
138
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Payment::CustomFieldResponse] },
139
+ nil?: true
140
+
133
141
  # @!attribute discount_id
134
142
  # The discount id if discount is applied
135
143
  #
@@ -154,6 +162,12 @@ module Dodopayments
154
162
  # @return [String, nil]
155
163
  optional :invoice_id, String, nil?: true
156
164
 
165
+ # @!attribute invoice_url
166
+ # URL to download the invoice PDF for this payment.
167
+ #
168
+ # @return [String, nil]
169
+ optional :invoice_url, String, nil?: true
170
+
157
171
  # @!attribute payment_link
158
172
  # Checkout URL
159
173
  #
@@ -212,7 +226,7 @@ module Dodopayments
212
226
  # @return [Time, nil]
213
227
  optional :updated_at, Time, nil?: true
214
228
 
215
- # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, metadata:, payment_id:, refunds:, settlement_amount:, settlement_currency:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, discount_id: nil, error_code: nil, error_message: nil, invoice_id: nil, payment_link: nil, payment_method: nil, payment_method_type: nil, product_cart: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
229
+ # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, metadata:, payment_id:, refunds:, settlement_amount:, settlement_currency:, 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, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_type: nil, product_cart: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
216
230
  # Some parameter documentations has been truncated, see
217
231
  # {Dodopayments::Models::Payment} for more details.
218
232
  #
@@ -256,6 +270,8 @@ module Dodopayments
256
270
  #
257
271
  # @param checkout_session_id [String, nil] If payment is made using a checkout session,
258
272
  #
273
+ # @param custom_field_responses [Array<Dodopayments::Models::Payment::CustomFieldResponse>, nil] Customer's responses to custom fields collected during checkout
274
+ #
259
275
  # @param discount_id [String, nil] The discount id if discount is applied
260
276
  #
261
277
  # @param error_code [String, nil] An error code if the payment failed
@@ -264,6 +280,8 @@ module Dodopayments
264
280
  #
265
281
  # @param invoice_id [String, nil] Invoice ID for this payment. Uses India-specific invoice ID if available.
266
282
  #
283
+ # @param invoice_url [String, nil] URL to download the invoice PDF for this payment.
284
+ #
267
285
  # @param payment_link [String, nil] Checkout URL
268
286
  #
269
287
  # @param payment_method [String, nil] Payment method used by customer (e.g. "card", "bank_transfer")
@@ -357,6 +375,27 @@ module Dodopayments
357
375
  # @param reason [String, nil] The reason provided for the refund, if any. Optional.
358
376
  end
359
377
 
378
+ class CustomFieldResponse < Dodopayments::Internal::Type::BaseModel
379
+ # @!attribute key
380
+ # Key matching the custom field definition
381
+ #
382
+ # @return [String]
383
+ required :key, String
384
+
385
+ # @!attribute value
386
+ # Value provided by customer
387
+ #
388
+ # @return [String]
389
+ required :value, String
390
+
391
+ # @!method initialize(key:, value:)
392
+ # Customer's response to a custom field
393
+ #
394
+ # @param key [String] Key matching the custom field definition
395
+ #
396
+ # @param value [String] Value provided by customer
397
+ end
398
+
360
399
  class ProductCart < Dodopayments::Internal::Type::BaseModel
361
400
  # @!attribute product_id
362
401
  #
@@ -44,6 +44,18 @@ module Dodopayments
44
44
  # @return [Integer]
45
45
  required :total_amount, Integer
46
46
 
47
+ # @!attribute invoice_id
48
+ # Invoice ID for this payment. Uses India-specific invoice ID if available.
49
+ #
50
+ # @return [String, nil]
51
+ optional :invoice_id, String, nil?: true
52
+
53
+ # @!attribute invoice_url
54
+ # URL to download the invoice PDF for this payment.
55
+ #
56
+ # @return [String, nil]
57
+ optional :invoice_url, String, nil?: true
58
+
47
59
  # @!attribute payment_method
48
60
  #
49
61
  # @return [String, nil]
@@ -64,18 +76,33 @@ module Dodopayments
64
76
  # @return [String, nil]
65
77
  optional :subscription_id, String, nil?: true
66
78
 
67
- # @!method initialize(brand_id:, created_at:, currency:, customer:, digital_products_delivered:, metadata:, payment_id:, total_amount:, payment_method: nil, payment_method_type: nil, status: nil, subscription_id: nil)
79
+ # @!method initialize(brand_id:, created_at:, currency:, customer:, digital_products_delivered:, metadata:, payment_id:, total_amount:, invoice_id: nil, invoice_url: nil, payment_method: nil, payment_method_type: nil, status: nil, subscription_id: nil)
68
80
  # @param brand_id [String]
81
+ #
69
82
  # @param created_at [Time]
83
+ #
70
84
  # @param currency [Symbol, Dodopayments::Models::Currency]
85
+ #
71
86
  # @param customer [Dodopayments::Models::CustomerLimitedDetails]
87
+ #
72
88
  # @param digital_products_delivered [Boolean]
89
+ #
73
90
  # @param metadata [Hash{Symbol=>String}]
91
+ #
74
92
  # @param payment_id [String]
93
+ #
75
94
  # @param total_amount [Integer]
95
+ #
96
+ # @param invoice_id [String, nil] Invoice ID for this payment. Uses India-specific invoice ID if available.
97
+ #
98
+ # @param invoice_url [String, nil] URL to download the invoice PDF for this payment.
99
+ #
76
100
  # @param payment_method [String, nil]
101
+ #
77
102
  # @param payment_method_type [String, nil]
103
+ #
78
104
  # @param status [Symbol, Dodopayments::Models::IntentStatus, nil]
105
+ #
79
106
  # @param subscription_id [String, nil]
80
107
  end
81
108
  end
@@ -5,110 +5,25 @@ module Dodopayments
5
5
  module PaymentMethodTypes
6
6
  extend Dodopayments::Internal::Type::Enum
7
7
 
8
- ACH = :ach
9
- AFFIRM = :affirm
10
- AFTERPAY_CLEARPAY = :afterpay_clearpay
11
- ALFAMART = :alfamart
12
- ALI_PAY = :ali_pay
13
- ALI_PAY_HK = :ali_pay_hk
14
- ALMA = :alma
15
- AMAZON_PAY = :amazon_pay
16
- APPLE_PAY = :apple_pay
17
- ATOME = :atome
18
- BACS = :bacs
19
- BANCONTACT_CARD = :bancontact_card
20
- BECS = :becs
21
- BENEFIT = :benefit
22
- BIZUM = :bizum
23
- BLIK = :blik
24
- BOLETO = :boleto
25
- BCA_BANK_TRANSFER = :bca_bank_transfer
26
- BNI_VA = :bni_va
27
- BRI_VA = :bri_va
28
- CARD_REDIRECT = :card_redirect
29
- CIMB_VA = :cimb_va
30
- CLASSIC = :classic
31
8
  CREDIT = :credit
32
- CRYPTO_CURRENCY = :crypto_currency
33
- CASHAPP = :cashapp
34
- DANA = :dana
35
- DANAMON_VA = :danamon_va
36
9
  DEBIT = :debit
37
- DUIT_NOW = :duit_now
38
- EFECTY = :efecty
39
- EFT = :eft
40
- EPS = :eps
41
- FPS = :fps
42
- EVOUCHER = :evoucher
43
- GIROPAY = :giropay
44
- GIVEX = :givex
10
+ UPI_COLLECT = :upi_collect
11
+ UPI_INTENT = :upi_intent
12
+ APPLE_PAY = :apple_pay
13
+ CASHAPP = :cashapp
45
14
  GOOGLE_PAY = :google_pay
46
- GO_PAY = :go_pay
47
- GCASH = :gcash
48
- IDEAL = :ideal
49
- INTERAC = :interac
50
- INDOMARET = :indomaret
51
- KLARNA = :klarna
52
- KAKAO_PAY = :kakao_pay
53
- LOCAL_BANK_REDIRECT = :local_bank_redirect
54
- MANDIRI_VA = :mandiri_va
55
- KNET = :knet
56
- MB_WAY = :mb_way
57
- MOBILE_PAY = :mobile_pay
58
- MOMO = :momo
59
- MOMO_ATM = :momo_atm
60
15
  MULTIBANCO = :multibanco
61
- ONLINE_BANKING_THAILAND = :online_banking_thailand
62
- ONLINE_BANKING_CZECH_REPUBLIC = :online_banking_czech_republic
63
- ONLINE_BANKING_FINLAND = :online_banking_finland
64
- ONLINE_BANKING_FPX = :online_banking_fpx
65
- ONLINE_BANKING_POLAND = :online_banking_poland
66
- ONLINE_BANKING_SLOVAKIA = :online_banking_slovakia
67
- OXXO = :oxxo
68
- PAGO_EFECTIVO = :pago_efectivo
69
- PERMATA_BANK_TRANSFER = :permata_bank_transfer
70
- OPEN_BANKING_UK = :open_banking_uk
71
- PAY_BRIGHT = :pay_bright
72
- PAYPAL = :paypal
73
- PAZE = :paze
74
- PIX = :pix
75
- PAY_SAFE_CARD = :pay_safe_card
16
+ BANCONTACT_CARD = :bancontact_card
17
+ EPS = :eps
18
+ IDEAL = :ideal
76
19
  PRZELEWY24 = :przelewy24
77
- PROMPT_PAY = :prompt_pay
78
- PSE = :pse
79
- RED_COMPRA = :red_compra
80
- RED_PAGOS = :red_pagos
81
- SAMSUNG_PAY = :samsung_pay
20
+ PAYPAL = :paypal
21
+ AFFIRM = :affirm
22
+ KLARNA = :klarna
82
23
  SEPA = :sepa
83
- SEPA_BANK_TRANSFER = :sepa_bank_transfer
84
- SOFORT = :sofort
85
- SWISH = :swish
86
- TOUCH_N_GO = :touch_n_go
87
- TRUSTLY = :trustly
88
- TWINT = :twint
89
- UPI_COLLECT = :upi_collect
90
- UPI_INTENT = :upi_intent
91
- VIPPS = :vipps
92
- VIET_QR = :viet_qr
93
- VENMO = :venmo
94
- WALLEY = :walley
95
- WE_CHAT_PAY = :we_chat_pay
96
- SEVEN_ELEVEN = :seven_eleven
97
- LAWSON = :lawson
98
- MINI_STOP = :mini_stop
99
- FAMILY_MART = :family_mart
100
- SEICOMART = :seicomart
101
- PAY_EASY = :pay_easy
102
- LOCAL_BANK_TRANSFER = :local_bank_transfer
103
- MIFINITY = :mifinity
104
- OPEN_BANKING_PIS = :open_banking_pis
105
- DIRECT_CARRIER_BILLING = :direct_carrier_billing
106
- INSTANT_BANK_TRANSFER = :instant_bank_transfer
107
- BILLIE = :billie
108
- ZIP = :zip
109
- REVOLUT_PAY = :revolut_pay
110
- NAVER_PAY = :naver_pay
111
- PAYCO = :payco
24
+ ACH = :ach
25
+ AMAZON_PAY = :amazon_pay
26
+ AFTERPAY_CLEARPAY = :afterpay_clearpay
112
27
 
113
28
  # @!method self.values
114
29
  # @return [Array<Symbol>]
@@ -110,7 +110,13 @@ module Dodopayments
110
110
  # @return [String, nil]
111
111
  optional :name, String, nil?: true
112
112
 
113
- # @!method initialize(brand_id:, business_id:, created_at:, is_recurring:, license_key_enabled:, metadata:, price:, product_id:, tax_category:, updated_at:, addons: nil, description: nil, digital_product_delivery: nil, image: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, name: nil)
113
+ # @!attribute product_collection_id
114
+ # The product collection ID this product belongs to, if any
115
+ #
116
+ # @return [String, nil]
117
+ optional :product_collection_id, String, nil?: true
118
+
119
+ # @!method initialize(brand_id:, business_id:, created_at:, is_recurring:, license_key_enabled:, metadata:, price:, product_id:, tax_category:, updated_at:, addons: nil, description: nil, digital_product_delivery: nil, image: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, name: nil, product_collection_id: nil)
114
120
  # @param brand_id [String]
115
121
  #
116
122
  # @param business_id [String] Unique identifier for the business to which the product belongs.
@@ -146,6 +152,8 @@ module Dodopayments
146
152
  # @param license_key_duration [Dodopayments::Models::LicenseKeyDuration, nil] Duration of the license key validity, if enabled.
147
153
  #
148
154
  # @param name [String, nil] Name of the product, optional.
155
+ #
156
+ # @param product_collection_id [String, nil] The product collection ID this product belongs to, if any
149
157
 
150
158
  # @see Dodopayments::Models::Product#digital_product_delivery
151
159
  class DigitalProductDelivery < Dodopayments::Internal::Type::BaseModel
@@ -144,6 +144,14 @@ module Dodopayments
144
144
  # @return [Time, nil]
145
145
  optional :cancelled_at, Time, nil?: true
146
146
 
147
+ # @!attribute custom_field_responses
148
+ # Customer's responses to custom fields collected during checkout
149
+ #
150
+ # @return [Array<Dodopayments::Models::Subscription::CustomFieldResponse>, nil]
151
+ optional :custom_field_responses,
152
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Subscription::CustomFieldResponse] },
153
+ nil?: true
154
+
147
155
  # @!attribute discount_cycles_remaining
148
156
  # Number of remaining discount cycles if discount is applied
149
157
  #
@@ -174,7 +182,7 @@ module Dodopayments
174
182
  # @return [String, nil]
175
183
  optional :tax_id, String, nil?: true
176
184
 
177
- # @!method initialize(addons:, billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, metadata:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, discount_cycles_remaining: nil, discount_id: nil, expires_at: nil, payment_method_id: nil, tax_id: nil)
185
+ # @!method initialize(addons:, billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, metadata:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, custom_field_responses: nil, discount_cycles_remaining: nil, discount_id: nil, expires_at: nil, payment_method_id: nil, tax_id: nil)
178
186
  # Some parameter documentations has been truncated, see
179
187
  # {Dodopayments::Models::Subscription} for more details.
180
188
  #
@@ -226,6 +234,8 @@ module Dodopayments
226
234
  #
227
235
  # @param cancelled_at [Time, nil] Cancelled timestamp if the subscription is cancelled
228
236
  #
237
+ # @param custom_field_responses [Array<Dodopayments::Models::Subscription::CustomFieldResponse>, nil] Customer's responses to custom fields collected during checkout
238
+ #
229
239
  # @param discount_cycles_remaining [Integer, nil] Number of remaining discount cycles if discount is applied
230
240
  #
231
241
  # @param discount_id [String, nil] The discount id if discount is applied
@@ -283,6 +293,27 @@ module Dodopayments
283
293
  # @param price_per_unit [String]
284
294
  # @param description [String, nil]
285
295
  end
296
+
297
+ class CustomFieldResponse < Dodopayments::Internal::Type::BaseModel
298
+ # @!attribute key
299
+ # Key matching the custom field definition
300
+ #
301
+ # @return [String]
302
+ required :key, String
303
+
304
+ # @!attribute value
305
+ # Value provided by customer
306
+ #
307
+ # @return [String]
308
+ required :value, String
309
+
310
+ # @!method initialize(key:, value:)
311
+ # Customer's response to a custom field
312
+ #
313
+ # @param key [String] Key matching the custom field definition
314
+ #
315
+ # @param value [String] Value provided by customer
316
+ end
286
317
  end
287
318
  end
288
319
  end
@@ -33,7 +33,14 @@ module Dodopayments
33
33
  # @return [Array<Dodopayments::Models::AttachAddon>, nil]
34
34
  optional :addons, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::AttachAddon] }, nil?: true
35
35
 
36
- # @!method initialize(product_id:, proration_billing_mode:, quantity:, addons: nil, request_options: {})
36
+ # @!attribute metadata
37
+ # Metadata for the payment. If not passed, the metadata of the subscription will
38
+ # be taken
39
+ #
40
+ # @return [Hash{Symbol=>String}, nil]
41
+ optional :metadata, Dodopayments::Internal::Type::HashOf[String], nil?: true
42
+
43
+ # @!method initialize(product_id:, proration_billing_mode:, quantity:, addons: nil, metadata: nil, request_options: {})
37
44
  # Some parameter documentations has been truncated, see
38
45
  # {Dodopayments::Models::SubscriptionChangePlanParams} for more details.
39
46
  #
@@ -45,6 +52,8 @@ module Dodopayments
45
52
  #
46
53
  # @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
47
54
  #
55
+ # @param metadata [Hash{Symbol=>String}, nil] Metadata for the payment. If not passed, the metadata of the subscription will b
56
+ #
48
57
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
49
58
 
50
59
  # Proration Billing Mode
@@ -150,13 +150,19 @@ module Dodopayments
150
150
  # @return [String, nil]
151
151
  optional :payment_method_id, String, nil?: true
152
152
 
153
+ # @!attribute product_name
154
+ # Name of the product associated with this subscription
155
+ #
156
+ # @return [String, nil]
157
+ optional :product_name, String, nil?: true
158
+
153
159
  # @!attribute tax_id
154
160
  # Tax identifier provided for this subscription (if applicable)
155
161
  #
156
162
  # @return [String, nil]
157
163
  optional :tax_id, String, nil?: true
158
164
 
159
- # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, metadata:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, discount_cycles_remaining: nil, discount_id: nil, payment_method_id: nil, tax_id: nil)
165
+ # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, metadata:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, discount_cycles_remaining: nil, discount_id: nil, payment_method_id: nil, product_name: nil, tax_id: nil)
160
166
  # Some parameter documentations has been truncated, see
161
167
  # {Dodopayments::Models::SubscriptionListResponse} for more details.
162
168
  #
@@ -210,6 +216,8 @@ module Dodopayments
210
216
  #
211
217
  # @param payment_method_id [String, nil] Saved payment method id used for recurring charges
212
218
  #
219
+ # @param product_name [String, nil] Name of the product associated with this subscription
220
+ #
213
221
  # @param tax_id [String, nil] Tax identifier provided for this subscription (if applicable)
214
222
  end
215
223
  end
@@ -33,7 +33,14 @@ module Dodopayments
33
33
  # @return [Array<Dodopayments::Models::AttachAddon>, nil]
34
34
  optional :addons, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::AttachAddon] }, nil?: true
35
35
 
36
- # @!method initialize(product_id:, proration_billing_mode:, quantity:, addons: nil, request_options: {})
36
+ # @!attribute metadata
37
+ # Metadata for the payment. If not passed, the metadata of the subscription will
38
+ # be taken
39
+ #
40
+ # @return [Hash{Symbol=>String}, nil]
41
+ optional :metadata, Dodopayments::Internal::Type::HashOf[String], nil?: true
42
+
43
+ # @!method initialize(product_id:, proration_billing_mode:, quantity:, addons: nil, metadata: nil, request_options: {})
37
44
  # Some parameter documentations has been truncated, see
38
45
  # {Dodopayments::Models::SubscriptionPreviewChangePlanParams} for more details.
39
46
  #
@@ -45,6 +52,8 @@ module Dodopayments
45
52
  #
46
53
  # @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
47
54
  #
55
+ # @param metadata [Hash{Symbol=>String}, nil] Metadata for the payment. If not passed, the metadata of the subscription will b
56
+ #
48
57
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
49
58
 
50
59
  # Proration Billing Mode
@@ -75,6 +75,8 @@ module Dodopayments
75
75
 
76
76
  CheckoutSessionCreateParams = Dodopayments::Models::CheckoutSessionCreateParams
77
77
 
78
+ CheckoutSessionPreviewParams = Dodopayments::Models::CheckoutSessionPreviewParams
79
+
78
80
  CheckoutSessionRequest = Dodopayments::Models::CheckoutSessionRequest
79
81
 
80
82
  CheckoutSessionResponse = Dodopayments::Models::CheckoutSessionResponse
@@ -117,6 +119,8 @@ module Dodopayments
117
119
 
118
120
  DiscountListParams = Dodopayments::Models::DiscountListParams
119
121
 
122
+ DiscountRetrieveByCodeParams = Dodopayments::Models::DiscountRetrieveByCodeParams
123
+
120
124
  DiscountRetrieveParams = Dodopayments::Models::DiscountRetrieveParams
121
125
 
122
126
  DiscountType = Dodopayments::Models::DiscountType
@@ -6,7 +6,7 @@ module Dodopayments
6
6
  # Some parameter documentations has been truncated, see
7
7
  # {Dodopayments::Models::CheckoutSessionCreateParams} for more details.
8
8
  #
9
- # @overload create(product_cart:, allowed_payment_method_types: nil, billing_address: nil, billing_currency: nil, confirm: nil, customer: nil, customization: nil, discount_code: nil, feature_flags: nil, force_3ds: nil, metadata: nil, minimal_address: nil, payment_method_id: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, subscription_data: nil, request_options: {})
9
+ # @overload create(product_cart:, allowed_payment_method_types: nil, billing_address: nil, billing_currency: nil, confirm: nil, custom_fields: nil, customer: nil, customization: nil, discount_code: nil, feature_flags: nil, force_3ds: nil, metadata: nil, minimal_address: nil, payment_method_id: nil, product_collection_id: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, subscription_data: nil, request_options: {})
10
10
  #
11
11
  # @param product_cart [Array<Dodopayments::Models::CheckoutSessionRequest::ProductCart>]
12
12
  #
@@ -18,6 +18,8 @@ module Dodopayments
18
18
  #
19
19
  # @param confirm [Boolean] If confirm is true, all the details will be finalized. If required data is missi
20
20
  #
21
+ # @param custom_fields [Array<Dodopayments::Models::CheckoutSessionRequest::CustomField>, nil] Custom fields to collect from customer during checkout (max 5 fields)
22
+ #
21
23
  # @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::NewCustomer, nil] Customer details for the session
22
24
  #
23
25
  # @param customization [Dodopayments::Models::CheckoutSessionRequest::Customization] Customization for the checkout session page
@@ -34,6 +36,8 @@ module Dodopayments
34
36
  #
35
37
  # @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
36
38
  #
39
+ # @param product_collection_id [String, nil] Product collection ID for collection-based checkout flow
40
+ #
37
41
  # @param return_url [String, nil] The url to redirect after payment failure or success.
38
42
  #
39
43
  # @param short_link [Boolean] If true, returns a shortened checkout URL.
@@ -75,6 +79,65 @@ module Dodopayments
75
79
  )
76
80
  end
77
81
 
82
+ # Some parameter documentations has been truncated, see
83
+ # {Dodopayments::Models::CheckoutSessionPreviewParams} for more details.
84
+ #
85
+ # @overload preview(product_cart:, allowed_payment_method_types: nil, billing_address: nil, billing_currency: nil, confirm: nil, custom_fields: nil, customer: nil, customization: nil, discount_code: nil, feature_flags: nil, force_3ds: nil, metadata: nil, minimal_address: nil, payment_method_id: nil, product_collection_id: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, subscription_data: nil, request_options: {})
86
+ #
87
+ # @param product_cart [Array<Dodopayments::Models::CheckoutSessionRequest::ProductCart>]
88
+ #
89
+ # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil] Customers will never see payment methods that are not in this list.
90
+ #
91
+ # @param billing_address [Dodopayments::Models::CheckoutSessionRequest::BillingAddress, nil] Billing address information for the session
92
+ #
93
+ # @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] This field is ingored if adaptive pricing is disabled
94
+ #
95
+ # @param confirm [Boolean] If confirm is true, all the details will be finalized. If required data is missi
96
+ #
97
+ # @param custom_fields [Array<Dodopayments::Models::CheckoutSessionRequest::CustomField>, nil] Custom fields to collect from customer during checkout (max 5 fields)
98
+ #
99
+ # @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::NewCustomer, nil] Customer details for the session
100
+ #
101
+ # @param customization [Dodopayments::Models::CheckoutSessionRequest::Customization] Customization for the checkout session page
102
+ #
103
+ # @param discount_code [String, nil]
104
+ #
105
+ # @param feature_flags [Dodopayments::Models::CheckoutSessionRequest::FeatureFlags]
106
+ #
107
+ # @param force_3ds [Boolean, nil] Override merchant default 3DS behaviour for this session
108
+ #
109
+ # @param metadata [Hash{Symbol=>String}, nil] Additional metadata associated with the payment. Defaults to empty if not provid
110
+ #
111
+ # @param minimal_address [Boolean] If true, only zipcode is required when confirm is true; other address fields rem
112
+ #
113
+ # @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
114
+ #
115
+ # @param product_collection_id [String, nil] Product collection ID for collection-based checkout flow
116
+ #
117
+ # @param return_url [String, nil] The url to redirect after payment failure or success.
118
+ #
119
+ # @param short_link [Boolean] If true, returns a shortened checkout URL.
120
+ #
121
+ # @param show_saved_payment_methods [Boolean] Display saved payment methods of a returning customer False by default
122
+ #
123
+ # @param subscription_data [Dodopayments::Models::CheckoutSessionRequest::SubscriptionData, nil]
124
+ #
125
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
126
+ #
127
+ # @return [Dodopayments::Models::CheckoutSessionPreviewResponse]
128
+ #
129
+ # @see Dodopayments::Models::CheckoutSessionPreviewParams
130
+ def preview(params)
131
+ parsed, options = Dodopayments::CheckoutSessionPreviewParams.dump_request(params)
132
+ @client.request(
133
+ method: :post,
134
+ path: "checkouts/preview",
135
+ body: parsed,
136
+ model: Dodopayments::Models::CheckoutSessionPreviewResponse,
137
+ options: options
138
+ )
139
+ end
140
+
78
141
  # @api private
79
142
  #
80
143
  # @param client [Dodopayments::Client]
@@ -79,10 +79,16 @@ module Dodopayments
79
79
  )
80
80
  end
81
81
 
82
- # @overload list(email: nil, page_number: nil, page_size: nil, request_options: {})
82
+ # @overload list(created_at_gte: nil, created_at_lte: nil, email: nil, name: nil, page_number: nil, page_size: nil, request_options: {})
83
+ #
84
+ # @param created_at_gte [Time] Filter customers created on or after this timestamp
85
+ #
86
+ # @param created_at_lte [Time] Filter customers created on or before this timestamp
83
87
  #
84
88
  # @param email [String] Filter by customer email
85
89
  #
90
+ # @param name [String] Filter by customer name (partial match, case-insensitive)
91
+ #
86
92
  # @param page_number [Integer] Page number default is 0
87
93
  #
88
94
  # @param page_size [Integer] Page size default is 10 max is 100