dodopayments 1.68.0 → 1.70.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/checkout_session_request.rb +10 -1
  5. data/lib/dodopayments/models/checkout_session_response.rb +8 -8
  6. data/lib/dodopayments/models/payment_create_params.rb +11 -1
  7. data/lib/dodopayments/models/products/short_link_create_params.rb +35 -0
  8. data/lib/dodopayments/models/products/short_link_create_response.rb +27 -0
  9. data/lib/dodopayments/models/products/short_link_list_params.rb +40 -0
  10. data/lib/dodopayments/models/products/short_link_list_response.rb +43 -0
  11. data/lib/dodopayments/models/subscription_create_params.rb +11 -1
  12. data/lib/dodopayments/resources/checkout_sessions.rb +3 -1
  13. data/lib/dodopayments/resources/payments.rb +3 -1
  14. data/lib/dodopayments/resources/products/short_links.rb +73 -0
  15. data/lib/dodopayments/resources/products.rb +4 -0
  16. data/lib/dodopayments/resources/subscriptions.rb +3 -1
  17. data/lib/dodopayments/version.rb +1 -1
  18. data/lib/dodopayments.rb +5 -0
  19. data/rbi/dodopayments/models/checkout_session_request.rbi +10 -0
  20. data/rbi/dodopayments/models/checkout_session_response.rbi +13 -9
  21. data/rbi/dodopayments/models/payment_create_params.rbi +12 -0
  22. data/rbi/dodopayments/models/products/short_link_create_params.rbi +56 -0
  23. data/rbi/dodopayments/models/products/short_link_create_response.rbi +40 -0
  24. data/rbi/dodopayments/models/products/short_link_list_params.rbi +73 -0
  25. data/rbi/dodopayments/models/products/short_link_list_response.rbi +66 -0
  26. data/rbi/dodopayments/models/subscription_create_params.rbi +12 -0
  27. data/rbi/dodopayments/resources/checkout_sessions.rbi +4 -0
  28. data/rbi/dodopayments/resources/payments.rbi +5 -0
  29. data/rbi/dodopayments/resources/products/short_links.rbi +59 -0
  30. data/rbi/dodopayments/resources/products.rbi +3 -0
  31. data/rbi/dodopayments/resources/subscriptions.rbi +5 -0
  32. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  33. data/sig/dodopayments/models/checkout_session_response.rbs +5 -5
  34. data/sig/dodopayments/models/payment_create_params.rbs +5 -0
  35. data/sig/dodopayments/models/products/short_link_create_params.rbs +30 -0
  36. data/sig/dodopayments/models/products/short_link_create_response.rbs +17 -0
  37. data/sig/dodopayments/models/products/short_link_list_params.rbs +40 -0
  38. data/sig/dodopayments/models/products/short_link_list_response.rbs +37 -0
  39. data/sig/dodopayments/models/subscription_create_params.rbs +5 -0
  40. data/sig/dodopayments/resources/checkout_sessions.rbs +1 -0
  41. data/sig/dodopayments/resources/payments.rbs +1 -0
  42. data/sig/dodopayments/resources/products/short_links.rbs +23 -0
  43. data/sig/dodopayments/resources/products.rbs +2 -0
  44. data/sig/dodopayments/resources/subscriptions.rbs +1 -0
  45. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbc5ebc492dd27b97a18b069e5dafdb0f4699ac2a17723fb53ba75ad64349fdb
4
- data.tar.gz: 35f1af6bd6e7b96d17abd850f7f02b70f69743ba499183ad3c4777a3bc87e346
3
+ metadata.gz: 7932166a1d9dd3a1c92b74bba30f1e90185636d1ff275a488d0a6ec947dfe40f
4
+ data.tar.gz: 41746077380ff697dc721bbf0b7eb83c3f17a1c500e47f94847b69f0e4627b20
5
5
  SHA512:
6
- metadata.gz: d69b3e9b87777621c52503650d511596a94851382cd5d8334a008df9062aa7566a8f28a837c0b0a79115c073e99c5251c8a0eecc88043ab22431276fbc2b7f1a
7
- data.tar.gz: 78ad85f5dc0512ac803e47dffa6fa96968138db519cdf8cbc95b1e6843162b7ae27dcb371962ea2d1abf2f63c064d23aa257f1c0d0845d2e446267382170edf4
6
+ metadata.gz: 288ad614c3627a92156c49ba02528256b8ba9e61ece9cfd94c55c8b2aa75ba567d57a443d1d517fa54967f273fc599927486c37114b70c90dde316c785fba26a
7
+ data.tar.gz: 5676e86af86d993869af700970ad3c6fa1b1a63cdec0014820d708ccbb078d0ee09c7bf0fe164aa6d2cb564d87db6bc32cd18303f9f6830dbf1a99889161d8a5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.70.0 (2025-12-23)
4
+
5
+ Full Changelog: [v1.69.0...v1.70.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.69.0...v1.70.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([83dc45a](https://github.com/dodopayments/dodopayments-ruby/commit/83dc45ae1eae356bc67e34c4eedb01390ff621e5))
10
+
11
+ ## 1.69.0 (2025-12-23)
12
+
13
+ Full Changelog: [v1.68.0...v1.69.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.68.0...v1.69.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** manual updates ([702b110](https://github.com/dodopayments/dodopayments-ruby/commit/702b110a222abca719163c70b74ac5be66bee79f))
18
+
3
19
  ## 1.68.0 (2025-12-19)
4
20
 
5
21
  Full Changelog: [v1.67.2...v1.68.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.67.2...v1.68.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "dodopayments", "~> 1.68.0"
20
+ gem "dodopayments", "~> 1.70.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -83,6 +83,13 @@ module Dodopayments
83
83
  # @return [Boolean, nil]
84
84
  optional :minimal_address, Dodopayments::Internal::Type::Boolean
85
85
 
86
+ # @!attribute payment_method_id
87
+ # Optional payment method ID to use for this checkout session. Only allowed when
88
+ # `confirm` is true. If provided, existing customer id must also be provided.
89
+ #
90
+ # @return [String, nil]
91
+ optional :payment_method_id, String, nil?: true
92
+
86
93
  # @!attribute return_url
87
94
  # The url to redirect after payment failure or success.
88
95
  #
@@ -106,7 +113,7 @@ module Dodopayments
106
113
  # @return [Dodopayments::Models::CheckoutSessionRequest::SubscriptionData, nil]
107
114
  optional :subscription_data, -> { Dodopayments::CheckoutSessionRequest::SubscriptionData }, nil?: true
108
115
 
109
- # @!method initialize(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, return_url: nil, short_link: nil, show_saved_payment_methods: nil, subscription_data: nil)
116
+ # @!method initialize(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)
110
117
  # Some parameter documentations has been truncated, see
111
118
  # {Dodopayments::Models::CheckoutSessionRequest} for more details.
112
119
  #
@@ -134,6 +141,8 @@ module Dodopayments
134
141
  #
135
142
  # @param minimal_address [Boolean] If true, only zipcode is required when confirm is true; other address fields rem
136
143
  #
144
+ # @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
145
+ #
137
146
  # @param return_url [String, nil] The url to redirect after payment failure or success.
138
147
  #
139
148
  # @param short_link [Boolean] If true, returns a shortened checkout URL.
@@ -4,22 +4,22 @@ module Dodopayments
4
4
  module Models
5
5
  # @see Dodopayments::Resources::CheckoutSessions#create
6
6
  class CheckoutSessionResponse < Dodopayments::Internal::Type::BaseModel
7
- # @!attribute checkout_url
8
- # Checkout url
9
- #
10
- # @return [String]
11
- required :checkout_url, String
12
-
13
7
  # @!attribute session_id
14
8
  # The ID of the created checkout session
15
9
  #
16
10
  # @return [String]
17
11
  required :session_id, String
18
12
 
19
- # @!method initialize(checkout_url:, session_id:)
20
- # @param checkout_url [String] Checkout url
13
+ # @!attribute checkout_url
14
+ # Checkout url (None when payment_method_id is provided)
21
15
  #
16
+ # @return [String, nil]
17
+ optional :checkout_url, String, nil?: true
18
+
19
+ # @!method initialize(session_id:, checkout_url: nil)
22
20
  # @param session_id [String] The ID of the created checkout session
21
+ #
22
+ # @param checkout_url [String, nil] Checkout url (None when payment_method_id is provided)
23
23
  end
24
24
  end
25
25
  end
@@ -70,6 +70,14 @@ module Dodopayments
70
70
  # @return [Boolean, nil]
71
71
  optional :payment_link, Dodopayments::Internal::Type::Boolean, nil?: true
72
72
 
73
+ # @!attribute payment_method_id
74
+ # Optional payment method ID to use for this payment. If provided, customer_id
75
+ # must also be provided. The payment method will be validated for eligibility with
76
+ # the payment's currency.
77
+ #
78
+ # @return [String, nil]
79
+ optional :payment_method_id, String, nil?: true
80
+
73
81
  # @!attribute redirect_immediately
74
82
  # If true, redirects the customer immediately after payment completion False by
75
83
  # default
@@ -103,7 +111,7 @@ module Dodopayments
103
111
  # @return [String, nil]
104
112
  optional :tax_id, String, nil?: true
105
113
 
106
- # @!method initialize(billing:, customer:, product_cart:, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, payment_link: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
114
+ # @!method initialize(billing:, customer:, product_cart:, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
107
115
  # Some parameter documentations has been truncated, see
108
116
  # {Dodopayments::Models::PaymentCreateParams} for more details.
109
117
  #
@@ -125,6 +133,8 @@ module Dodopayments
125
133
  #
126
134
  # @param payment_link [Boolean, nil] Whether to generate a payment link. Defaults to false if not specified.
127
135
  #
136
+ # @param payment_method_id [String, nil] Optional payment method ID to use for this payment.
137
+ #
128
138
  # @param redirect_immediately [Boolean] If true, redirects the customer immediately after payment completion
129
139
  #
130
140
  # @param return_url [String, nil] Optional URL to redirect the customer after payment.
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Products
6
+ # @see Dodopayments::Resources::Products::ShortLinks#create
7
+ class ShortLinkCreateParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ # @!attribute slug
12
+ # Slug for the short link.
13
+ #
14
+ # @return [String]
15
+ required :slug, String
16
+
17
+ # @!attribute static_checkout_params
18
+ # Static Checkout URL parameters to apply to the resulting short URL.
19
+ #
20
+ # @return [Hash{Symbol=>String}, nil]
21
+ optional :static_checkout_params, Dodopayments::Internal::Type::HashOf[String], nil?: true
22
+
23
+ # @!method initialize(slug:, static_checkout_params: nil, request_options: {})
24
+ # Some parameter documentations has been truncated, see
25
+ # {Dodopayments::Models::Products::ShortLinkCreateParams} for more details.
26
+ #
27
+ # @param slug [String] Slug for the short link.
28
+ #
29
+ # @param static_checkout_params [Hash{Symbol=>String}, nil] Static Checkout URL parameters to apply to the resulting
30
+ #
31
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Products
6
+ # @see Dodopayments::Resources::Products::ShortLinks#create
7
+ class ShortLinkCreateResponse < Dodopayments::Internal::Type::BaseModel
8
+ # @!attribute full_url
9
+ # Full URL.
10
+ #
11
+ # @return [String]
12
+ required :full_url, String
13
+
14
+ # @!attribute short_url
15
+ # Short URL.
16
+ #
17
+ # @return [String]
18
+ required :short_url, String
19
+
20
+ # @!method initialize(full_url:, short_url:)
21
+ # @param full_url [String] Full URL.
22
+ #
23
+ # @param short_url [String] Short URL.
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Products
6
+ # @see Dodopayments::Resources::Products::ShortLinks#list
7
+ class ShortLinkListParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ # @!attribute page_number
12
+ # Page number default is 0
13
+ #
14
+ # @return [Integer, nil]
15
+ optional :page_number, Integer
16
+
17
+ # @!attribute page_size
18
+ # Page size default is 10 max is 100
19
+ #
20
+ # @return [Integer, nil]
21
+ optional :page_size, Integer
22
+
23
+ # @!attribute product_id
24
+ # Filter by product ID
25
+ #
26
+ # @return [String, nil]
27
+ optional :product_id, String
28
+
29
+ # @!method initialize(page_number: nil, page_size: nil, product_id: nil, request_options: {})
30
+ # @param page_number [Integer] Page number default is 0
31
+ #
32
+ # @param page_size [Integer] Page size default is 10 max is 100
33
+ #
34
+ # @param product_id [String] Filter by product ID
35
+ #
36
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Products
6
+ # @see Dodopayments::Resources::Products::ShortLinks#list
7
+ class ShortLinkListResponse < Dodopayments::Internal::Type::BaseModel
8
+ # @!attribute created_at
9
+ # When the short url was created
10
+ #
11
+ # @return [Time]
12
+ required :created_at, Time
13
+
14
+ # @!attribute full_url
15
+ # Full URL the short url redirects to
16
+ #
17
+ # @return [String]
18
+ required :full_url, String
19
+
20
+ # @!attribute product_id
21
+ # Product ID associated with the short link
22
+ #
23
+ # @return [String]
24
+ required :product_id, String
25
+
26
+ # @!attribute short_url
27
+ # Short URL
28
+ #
29
+ # @return [String]
30
+ required :short_url, String
31
+
32
+ # @!method initialize(created_at:, full_url:, product_id:, short_url:)
33
+ # @param created_at [Time] When the short url was created
34
+ #
35
+ # @param full_url [String] Full URL the short url redirects to
36
+ #
37
+ # @param product_id [String] Product ID associated with the short link
38
+ #
39
+ # @param short_url [String] Short URL
40
+ end
41
+ end
42
+ end
43
+ end
@@ -95,6 +95,14 @@ module Dodopayments
95
95
  # @return [Boolean, nil]
96
96
  optional :payment_link, Dodopayments::Internal::Type::Boolean, nil?: true
97
97
 
98
+ # @!attribute payment_method_id
99
+ # Optional payment method ID to use for this subscription. If provided,
100
+ # customer_id must also be provided (via AttachExistingCustomer). The payment
101
+ # method will be validated for eligibility with the subscription's currency.
102
+ #
103
+ # @return [String, nil]
104
+ optional :payment_method_id, String, nil?: true
105
+
98
106
  # @!attribute redirect_immediately
99
107
  # If true, redirects the customer immediately after payment completion False by
100
108
  # default
@@ -134,7 +142,7 @@ module Dodopayments
134
142
  # @return [Integer, nil]
135
143
  optional :trial_period_days, Integer, nil?: true
136
144
 
137
- # @!method initialize(billing:, customer:, product_id:, quantity:, addons: nil, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, on_demand: nil, one_time_product_cart: nil, payment_link: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, trial_period_days: nil, request_options: {})
145
+ # @!method initialize(billing:, customer:, product_id:, quantity:, addons: nil, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, on_demand: nil, one_time_product_cart: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, trial_period_days: nil, request_options: {})
138
146
  # Some parameter documentations has been truncated, see
139
147
  # {Dodopayments::Models::SubscriptionCreateParams} for more details.
140
148
  #
@@ -164,6 +172,8 @@ module Dodopayments
164
172
  #
165
173
  # @param payment_link [Boolean, nil] If true, generates a payment link.
166
174
  #
175
+ # @param payment_method_id [String, nil] Optional payment method ID to use for this subscription.
176
+ #
167
177
  # @param redirect_immediately [Boolean] If true, redirects the customer immediately after payment completion
168
178
  #
169
179
  # @param return_url [String, nil] Optional URL to redirect after successful subscription creation
@@ -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, 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, 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: {})
10
10
  #
11
11
  # @param product_cart [Array<Dodopayments::Models::CheckoutSessionRequest::ProductCart>]
12
12
  #
@@ -32,6 +32,8 @@ module Dodopayments
32
32
  #
33
33
  # @param minimal_address [Boolean] If true, only zipcode is required when confirm is true; other address fields rem
34
34
  #
35
+ # @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
36
+ #
35
37
  # @param return_url [String, nil] The url to redirect after payment failure or success.
36
38
  #
37
39
  # @param short_link [Boolean] If true, returns a shortened checkout URL.
@@ -8,7 +8,7 @@ module Dodopayments
8
8
  # Some parameter documentations has been truncated, see
9
9
  # {Dodopayments::Models::PaymentCreateParams} for more details.
10
10
  #
11
- # @overload create(billing:, customer:, product_cart:, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, payment_link: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
11
+ # @overload create(billing:, customer:, product_cart:, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
12
12
  #
13
13
  # @param billing [Dodopayments::Models::BillingAddress] Billing address details for the payment
14
14
  #
@@ -28,6 +28,8 @@ module Dodopayments
28
28
  #
29
29
  # @param payment_link [Boolean, nil] Whether to generate a payment link. Defaults to false if not specified.
30
30
  #
31
+ # @param payment_method_id [String, nil] Optional payment method ID to use for this payment.
32
+ #
31
33
  # @param redirect_immediately [Boolean] If true, redirects the customer immediately after payment completion
32
34
  #
33
35
  # @param return_url [String, nil] Optional URL to redirect the customer after payment.
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Products
6
+ class ShortLinks
7
+ # Some parameter documentations has been truncated, see
8
+ # {Dodopayments::Models::Products::ShortLinkCreateParams} for more details.
9
+ #
10
+ # Gives a Short Checkout URL with custom slug for a product. Uses a Static
11
+ # Checkout URL under the hood.
12
+ #
13
+ # @overload create(id, slug:, static_checkout_params: nil, request_options: {})
14
+ #
15
+ # @param id [String] Product Id
16
+ #
17
+ # @param slug [String] Slug for the short link.
18
+ #
19
+ # @param static_checkout_params [Hash{Symbol=>String}, nil] Static Checkout URL parameters to apply to the resulting
20
+ #
21
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
22
+ #
23
+ # @return [Dodopayments::Models::Products::ShortLinkCreateResponse]
24
+ #
25
+ # @see Dodopayments::Models::Products::ShortLinkCreateParams
26
+ def create(id, params)
27
+ parsed, options = Dodopayments::Products::ShortLinkCreateParams.dump_request(params)
28
+ @client.request(
29
+ method: :post,
30
+ path: ["products/%1$s/short_links", id],
31
+ body: parsed,
32
+ model: Dodopayments::Models::Products::ShortLinkCreateResponse,
33
+ options: options
34
+ )
35
+ end
36
+
37
+ # Lists all short links created by the business.
38
+ #
39
+ # @overload list(page_number: nil, page_size: nil, product_id: nil, request_options: {})
40
+ #
41
+ # @param page_number [Integer] Page number default is 0
42
+ #
43
+ # @param page_size [Integer] Page size default is 10 max is 100
44
+ #
45
+ # @param product_id [String] Filter by product ID
46
+ #
47
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
48
+ #
49
+ # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Products::ShortLinkListResponse>]
50
+ #
51
+ # @see Dodopayments::Models::Products::ShortLinkListParams
52
+ def list(params = {})
53
+ parsed, options = Dodopayments::Products::ShortLinkListParams.dump_request(params)
54
+ @client.request(
55
+ method: :get,
56
+ path: "products/short_links",
57
+ query: parsed,
58
+ page: Dodopayments::Internal::DefaultPageNumberPagination,
59
+ model: Dodopayments::Models::Products::ShortLinkListResponse,
60
+ options: options
61
+ )
62
+ end
63
+
64
+ # @api private
65
+ #
66
+ # @param client [Dodopayments::Client]
67
+ def initialize(client:)
68
+ @client = client
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -6,6 +6,9 @@ module Dodopayments
6
6
  # @return [Dodopayments::Resources::Products::Images]
7
7
  attr_reader :images
8
8
 
9
+ # @return [Dodopayments::Resources::Products::ShortLinks]
10
+ attr_reader :short_links
11
+
9
12
  # Some parameter documentations has been truncated, see
10
13
  # {Dodopayments::Models::ProductCreateParams} for more details.
11
14
  #
@@ -212,6 +215,7 @@ module Dodopayments
212
215
  def initialize(client:)
213
216
  @client = client
214
217
  @images = Dodopayments::Resources::Products::Images.new(client: client)
218
+ @short_links = Dodopayments::Resources::Products::ShortLinks.new(client: client)
215
219
  end
216
220
  end
217
221
  end
@@ -8,7 +8,7 @@ module Dodopayments
8
8
  # Some parameter documentations has been truncated, see
9
9
  # {Dodopayments::Models::SubscriptionCreateParams} for more details.
10
10
  #
11
- # @overload create(billing:, customer:, product_id:, quantity:, addons: nil, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, on_demand: nil, one_time_product_cart: nil, payment_link: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, trial_period_days: nil, request_options: {})
11
+ # @overload create(billing:, customer:, product_id:, quantity:, addons: nil, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, on_demand: nil, one_time_product_cart: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, trial_period_days: nil, request_options: {})
12
12
  #
13
13
  # @param billing [Dodopayments::Models::BillingAddress] Billing address information for the subscription
14
14
  #
@@ -36,6 +36,8 @@ module Dodopayments
36
36
  #
37
37
  # @param payment_link [Boolean, nil] If true, generates a payment link.
38
38
  #
39
+ # @param payment_method_id [String, nil] Optional payment method ID to use for this subscription.
40
+ #
39
41
  # @param redirect_immediately [Boolean] If true, redirects the customer immediately after payment completion
40
42
  #
41
43
  # @param return_url [String, nil] Optional URL to redirect after successful subscription creation
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "1.68.0"
4
+ VERSION = "1.70.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -192,6 +192,10 @@ require_relative "dodopayments/models/product_list_response"
192
192
  require_relative "dodopayments/models/product_retrieve_params"
193
193
  require_relative "dodopayments/models/products/image_update_params"
194
194
  require_relative "dodopayments/models/products/image_update_response"
195
+ require_relative "dodopayments/models/products/short_link_create_params"
196
+ require_relative "dodopayments/models/products/short_link_create_response"
197
+ require_relative "dodopayments/models/products/short_link_list_params"
198
+ require_relative "dodopayments/models/products/short_link_list_response"
195
199
  require_relative "dodopayments/models/product_unarchive_params"
196
200
  require_relative "dodopayments/models/product_update_files_params"
197
201
  require_relative "dodopayments/models/product_update_files_response"
@@ -281,6 +285,7 @@ require_relative "dodopayments/resources/payments"
281
285
  require_relative "dodopayments/resources/payouts"
282
286
  require_relative "dodopayments/resources/products"
283
287
  require_relative "dodopayments/resources/products/images"
288
+ require_relative "dodopayments/resources/products/short_links"
284
289
  require_relative "dodopayments/resources/refunds"
285
290
  require_relative "dodopayments/resources/subscriptions"
286
291
  require_relative "dodopayments/resources/usage_events"
@@ -115,6 +115,11 @@ module Dodopayments
115
115
  sig { params(minimal_address: T::Boolean).void }
116
116
  attr_writer :minimal_address
117
117
 
118
+ # Optional payment method ID to use for this checkout session. Only allowed when
119
+ # `confirm` is true. If provided, existing customer id must also be provided.
120
+ sig { returns(T.nilable(String)) }
121
+ attr_accessor :payment_method_id
122
+
118
123
  # The url to redirect after payment failure or success.
119
124
  sig { returns(T.nilable(String)) }
120
125
  attr_accessor :return_url
@@ -177,6 +182,7 @@ module Dodopayments
177
182
  force_3ds: T.nilable(T::Boolean),
178
183
  metadata: T.nilable(T::Hash[Symbol, String]),
179
184
  minimal_address: T::Boolean,
185
+ payment_method_id: T.nilable(String),
180
186
  return_url: T.nilable(String),
181
187
  short_link: T::Boolean,
182
188
  show_saved_payment_methods: T::Boolean,
@@ -216,6 +222,9 @@ module Dodopayments
216
222
  # If true, only zipcode is required when confirm is true; other address fields
217
223
  # remain optional
218
224
  minimal_address: nil,
225
+ # Optional payment method ID to use for this checkout session. Only allowed when
226
+ # `confirm` is true. If provided, existing customer id must also be provided.
227
+ payment_method_id: nil,
219
228
  # The url to redirect after payment failure or success.
220
229
  return_url: nil,
221
230
  # If true, returns a shortened checkout URL. Defaults to false if not specified.
@@ -250,6 +259,7 @@ module Dodopayments
250
259
  force_3ds: T.nilable(T::Boolean),
251
260
  metadata: T.nilable(T::Hash[Symbol, String]),
252
261
  minimal_address: T::Boolean,
262
+ payment_method_id: T.nilable(String),
253
263
  return_url: T.nilable(String),
254
264
  short_link: T::Boolean,
255
265
  show_saved_payment_methods: T::Boolean,
@@ -11,28 +11,32 @@ module Dodopayments
11
11
  )
12
12
  end
13
13
 
14
- # Checkout url
15
- sig { returns(String) }
16
- attr_accessor :checkout_url
17
-
18
14
  # The ID of the created checkout session
19
15
  sig { returns(String) }
20
16
  attr_accessor :session_id
21
17
 
18
+ # Checkout url (None when payment_method_id is provided)
19
+ sig { returns(T.nilable(String)) }
20
+ attr_accessor :checkout_url
21
+
22
22
  sig do
23
- params(checkout_url: String, session_id: String).returns(
23
+ params(session_id: String, checkout_url: T.nilable(String)).returns(
24
24
  T.attached_class
25
25
  )
26
26
  end
27
27
  def self.new(
28
- # Checkout url
29
- checkout_url:,
30
28
  # The ID of the created checkout session
31
- session_id:
29
+ session_id:,
30
+ # Checkout url (None when payment_method_id is provided)
31
+ checkout_url: nil
32
32
  )
33
33
  end
34
34
 
35
- sig { override.returns({ checkout_url: String, session_id: String }) }
35
+ sig do
36
+ override.returns(
37
+ { session_id: String, checkout_url: T.nilable(String) }
38
+ )
39
+ end
36
40
  def to_hash
37
41
  end
38
42
  end
@@ -69,6 +69,12 @@ module Dodopayments
69
69
  sig { returns(T.nilable(T::Boolean)) }
70
70
  attr_accessor :payment_link
71
71
 
72
+ # Optional payment method ID to use for this payment. If provided, customer_id
73
+ # must also be provided. The payment method will be validated for eligibility with
74
+ # the payment's currency.
75
+ sig { returns(T.nilable(String)) }
76
+ attr_accessor :payment_method_id
77
+
72
78
  # If true, redirects the customer immediately after payment completion False by
73
79
  # default
74
80
  sig { returns(T.nilable(T::Boolean)) }
@@ -114,6 +120,7 @@ module Dodopayments
114
120
  force_3ds: T.nilable(T::Boolean),
115
121
  metadata: T::Hash[Symbol, String],
116
122
  payment_link: T.nilable(T::Boolean),
123
+ payment_method_id: T.nilable(String),
117
124
  redirect_immediately: T::Boolean,
118
125
  return_url: T.nilable(String),
119
126
  short_link: T.nilable(T::Boolean),
@@ -148,6 +155,10 @@ module Dodopayments
148
155
  metadata: nil,
149
156
  # Whether to generate a payment link. Defaults to false if not specified.
150
157
  payment_link: nil,
158
+ # Optional payment method ID to use for this payment. If provided, customer_id
159
+ # must also be provided. The payment method will be validated for eligibility with
160
+ # the payment's currency.
161
+ payment_method_id: nil,
151
162
  # If true, redirects the customer immediately after payment completion False by
152
163
  # default
153
164
  redirect_immediately: nil,
@@ -182,6 +193,7 @@ module Dodopayments
182
193
  force_3ds: T.nilable(T::Boolean),
183
194
  metadata: T::Hash[Symbol, String],
184
195
  payment_link: T.nilable(T::Boolean),
196
+ payment_method_id: T.nilable(String),
185
197
  redirect_immediately: T::Boolean,
186
198
  return_url: T.nilable(String),
187
199
  short_link: T.nilable(T::Boolean),