dodopayments 1.71.1 → 1.73.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/dodopayments/models/checkout_session_preview_params.rb +14 -0
- data/lib/dodopayments/models/checkout_session_preview_response.rb +426 -0
- data/lib/dodopayments/models/checkout_session_request.rb +9 -1
- data/lib/dodopayments/models/discount_retrieve_by_code_params.rb +14 -0
- data/lib/dodopayments/models/payment.rb +9 -1
- data/lib/dodopayments/models/payment_method_types.rb +13 -98
- data/lib/dodopayments/models/product.rb +9 -1
- data/lib/dodopayments/models/subscription_change_plan_params.rb +10 -1
- data/lib/dodopayments/models/subscription_preview_change_plan_params.rb +10 -1
- data/lib/dodopayments/models.rb +4 -0
- data/lib/dodopayments/resources/checkout_sessions.rb +60 -1
- data/lib/dodopayments/resources/discounts.rb +22 -0
- data/lib/dodopayments/resources/subscriptions.rb +6 -2
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +3 -0
- data/rbi/dodopayments/models/checkout_session_preview_params.rbi +32 -0
- data/rbi/dodopayments/models/checkout_session_preview_response.rbi +616 -0
- data/rbi/dodopayments/models/checkout_session_request.rbi +8 -0
- data/rbi/dodopayments/models/discount_retrieve_by_code_params.rbi +32 -0
- data/rbi/dodopayments/models/payment.rbi +8 -0
- data/rbi/dodopayments/models/payment_method_types.rbi +18 -186
- data/rbi/dodopayments/models/product.rbi +11 -3
- data/rbi/dodopayments/models/subscription_change_plan_params.rbi +10 -0
- data/rbi/dodopayments/models/subscription_preview_change_plan_params.rbi +10 -0
- data/rbi/dodopayments/models.rbi +6 -0
- data/rbi/dodopayments/resources/checkout_sessions.rbi +88 -0
- data/rbi/dodopayments/resources/discounts.rbi +16 -0
- data/rbi/dodopayments/resources/subscriptions.rbi +8 -0
- data/sig/dodopayments/models/checkout_session_preview_params.rbs +15 -0
- data/sig/dodopayments/models/checkout_session_preview_response.rbs +330 -0
- data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
- data/sig/dodopayments/models/discount_retrieve_by_code_params.rbs +15 -0
- data/sig/dodopayments/models/payment.rbs +5 -0
- data/sig/dodopayments/models/payment_method_types.rbs +26 -196
- data/sig/dodopayments/models/product.rbs +8 -3
- data/sig/dodopayments/models/subscription_change_plan_params.rbs +6 -1
- data/sig/dodopayments/models/subscription_preview_change_plan_params.rbs +6 -1
- data/sig/dodopayments/models.rbs +4 -0
- data/sig/dodopayments/resources/checkout_sessions.rbs +23 -0
- data/sig/dodopayments/resources/discounts.rbs +5 -0
- data/sig/dodopayments/resources/subscriptions.rbs +2 -0
- metadata +11 -2
|
@@ -110,7 +110,13 @@ module Dodopayments
|
|
|
110
110
|
# @return [String, nil]
|
|
111
111
|
optional :name, String, nil?: true
|
|
112
112
|
|
|
113
|
-
# @!
|
|
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
|
|
@@ -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
|
-
# @!
|
|
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
|
|
@@ -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
|
-
# @!
|
|
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
|
data/lib/dodopayments/models.rb
CHANGED
|
@@ -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, 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
|
#
|
|
@@ -34,6 +34,8 @@ module Dodopayments
|
|
|
34
34
|
#
|
|
35
35
|
# @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
|
|
36
36
|
#
|
|
37
|
+
# @param product_collection_id [String, nil] Product collection ID for collection-based checkout flow
|
|
38
|
+
#
|
|
37
39
|
# @param return_url [String, nil] The url to redirect after payment failure or success.
|
|
38
40
|
#
|
|
39
41
|
# @param short_link [Boolean] If true, returns a shortened checkout URL.
|
|
@@ -75,6 +77,63 @@ module Dodopayments
|
|
|
75
77
|
)
|
|
76
78
|
end
|
|
77
79
|
|
|
80
|
+
# Some parameter documentations has been truncated, see
|
|
81
|
+
# {Dodopayments::Models::CheckoutSessionPreviewParams} for more details.
|
|
82
|
+
#
|
|
83
|
+
# @overload preview(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, product_collection_id: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, subscription_data: nil, request_options: {})
|
|
84
|
+
#
|
|
85
|
+
# @param product_cart [Array<Dodopayments::Models::CheckoutSessionRequest::ProductCart>]
|
|
86
|
+
#
|
|
87
|
+
# @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil] Customers will never see payment methods that are not in this list.
|
|
88
|
+
#
|
|
89
|
+
# @param billing_address [Dodopayments::Models::CheckoutSessionRequest::BillingAddress, nil] Billing address information for the session
|
|
90
|
+
#
|
|
91
|
+
# @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] This field is ingored if adaptive pricing is disabled
|
|
92
|
+
#
|
|
93
|
+
# @param confirm [Boolean] If confirm is true, all the details will be finalized. If required data is missi
|
|
94
|
+
#
|
|
95
|
+
# @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::NewCustomer, nil] Customer details for the session
|
|
96
|
+
#
|
|
97
|
+
# @param customization [Dodopayments::Models::CheckoutSessionRequest::Customization] Customization for the checkout session page
|
|
98
|
+
#
|
|
99
|
+
# @param discount_code [String, nil]
|
|
100
|
+
#
|
|
101
|
+
# @param feature_flags [Dodopayments::Models::CheckoutSessionRequest::FeatureFlags]
|
|
102
|
+
#
|
|
103
|
+
# @param force_3ds [Boolean, nil] Override merchant default 3DS behaviour for this session
|
|
104
|
+
#
|
|
105
|
+
# @param metadata [Hash{Symbol=>String}, nil] Additional metadata associated with the payment. Defaults to empty if not provid
|
|
106
|
+
#
|
|
107
|
+
# @param minimal_address [Boolean] If true, only zipcode is required when confirm is true; other address fields rem
|
|
108
|
+
#
|
|
109
|
+
# @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
|
|
110
|
+
#
|
|
111
|
+
# @param product_collection_id [String, nil] Product collection ID for collection-based checkout flow
|
|
112
|
+
#
|
|
113
|
+
# @param return_url [String, nil] The url to redirect after payment failure or success.
|
|
114
|
+
#
|
|
115
|
+
# @param short_link [Boolean] If true, returns a shortened checkout URL.
|
|
116
|
+
#
|
|
117
|
+
# @param show_saved_payment_methods [Boolean] Display saved payment methods of a returning customer False by default
|
|
118
|
+
#
|
|
119
|
+
# @param subscription_data [Dodopayments::Models::CheckoutSessionRequest::SubscriptionData, nil]
|
|
120
|
+
#
|
|
121
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
122
|
+
#
|
|
123
|
+
# @return [Dodopayments::Models::CheckoutSessionPreviewResponse]
|
|
124
|
+
#
|
|
125
|
+
# @see Dodopayments::Models::CheckoutSessionPreviewParams
|
|
126
|
+
def preview(params)
|
|
127
|
+
parsed, options = Dodopayments::CheckoutSessionPreviewParams.dump_request(params)
|
|
128
|
+
@client.request(
|
|
129
|
+
method: :post,
|
|
130
|
+
path: "checkouts/preview",
|
|
131
|
+
body: parsed,
|
|
132
|
+
model: Dodopayments::Models::CheckoutSessionPreviewResponse,
|
|
133
|
+
options: options
|
|
134
|
+
)
|
|
135
|
+
end
|
|
136
|
+
|
|
78
137
|
# @api private
|
|
79
138
|
#
|
|
80
139
|
# @param client [Dodopayments::Client]
|
|
@@ -149,6 +149,28 @@ module Dodopayments
|
|
|
149
149
|
)
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
+
# Validate and fetch a discount by its code name (e.g., "SAVE20"). This allows
|
|
153
|
+
# real-time validation directly against the API using the human-readable discount
|
|
154
|
+
# code instead of requiring the internal discount_id.
|
|
155
|
+
#
|
|
156
|
+
# @overload retrieve_by_code(code, request_options: {})
|
|
157
|
+
#
|
|
158
|
+
# @param code [String] The discount code (e.g., 'SAVE20')
|
|
159
|
+
#
|
|
160
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
161
|
+
#
|
|
162
|
+
# @return [Dodopayments::Models::Discount]
|
|
163
|
+
#
|
|
164
|
+
# @see Dodopayments::Models::DiscountRetrieveByCodeParams
|
|
165
|
+
def retrieve_by_code(code, params = {})
|
|
166
|
+
@client.request(
|
|
167
|
+
method: :get,
|
|
168
|
+
path: ["discounts/code/%1$s", code],
|
|
169
|
+
model: Dodopayments::Discount,
|
|
170
|
+
options: params[:request_options]
|
|
171
|
+
)
|
|
172
|
+
end
|
|
173
|
+
|
|
152
174
|
# @api private
|
|
153
175
|
#
|
|
154
176
|
# @param client [Dodopayments::Client]
|
|
@@ -156,7 +156,7 @@ module Dodopayments
|
|
|
156
156
|
# Some parameter documentations has been truncated, see
|
|
157
157
|
# {Dodopayments::Models::SubscriptionChangePlanParams} for more details.
|
|
158
158
|
#
|
|
159
|
-
# @overload change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, request_options: {})
|
|
159
|
+
# @overload change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, metadata: nil, request_options: {})
|
|
160
160
|
#
|
|
161
161
|
# @param subscription_id [String] Subscription Id
|
|
162
162
|
#
|
|
@@ -168,6 +168,8 @@ module Dodopayments
|
|
|
168
168
|
#
|
|
169
169
|
# @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
|
|
170
170
|
#
|
|
171
|
+
# @param metadata [Hash{Symbol=>String}, nil] Metadata for the payment. If not passed, the metadata of the subscription will b
|
|
172
|
+
#
|
|
171
173
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
172
174
|
#
|
|
173
175
|
# @return [nil]
|
|
@@ -222,7 +224,7 @@ module Dodopayments
|
|
|
222
224
|
# Some parameter documentations has been truncated, see
|
|
223
225
|
# {Dodopayments::Models::SubscriptionPreviewChangePlanParams} for more details.
|
|
224
226
|
#
|
|
225
|
-
# @overload preview_change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, request_options: {})
|
|
227
|
+
# @overload preview_change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, metadata: nil, request_options: {})
|
|
226
228
|
#
|
|
227
229
|
# @param subscription_id [String] Subscription Id
|
|
228
230
|
#
|
|
@@ -234,6 +236,8 @@ module Dodopayments
|
|
|
234
236
|
#
|
|
235
237
|
# @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
|
|
236
238
|
#
|
|
239
|
+
# @param metadata [Hash{Symbol=>String}, nil] Metadata for the payment. If not passed, the metadata of the subscription will b
|
|
240
|
+
#
|
|
237
241
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
238
242
|
#
|
|
239
243
|
# @return [Dodopayments::Models::SubscriptionPreviewChangePlanResponse]
|
data/lib/dodopayments/version.rb
CHANGED
data/lib/dodopayments.rb
CHANGED
|
@@ -81,6 +81,8 @@ require_relative "dodopayments/models/brand_update_images_params"
|
|
|
81
81
|
require_relative "dodopayments/models/brand_update_images_response"
|
|
82
82
|
require_relative "dodopayments/models/brand_update_params"
|
|
83
83
|
require_relative "dodopayments/models/checkout_session_create_params"
|
|
84
|
+
require_relative "dodopayments/models/checkout_session_preview_params"
|
|
85
|
+
require_relative "dodopayments/models/checkout_session_preview_response"
|
|
84
86
|
require_relative "dodopayments/models/checkout_session_response"
|
|
85
87
|
require_relative "dodopayments/models/checkout_session_retrieve_params"
|
|
86
88
|
require_relative "dodopayments/models/checkout_session_status"
|
|
@@ -108,6 +110,7 @@ require_relative "dodopayments/models/discount"
|
|
|
108
110
|
require_relative "dodopayments/models/discount_create_params"
|
|
109
111
|
require_relative "dodopayments/models/discount_delete_params"
|
|
110
112
|
require_relative "dodopayments/models/discount_list_params"
|
|
113
|
+
require_relative "dodopayments/models/discount_retrieve_by_code_params"
|
|
111
114
|
require_relative "dodopayments/models/discount_retrieve_params"
|
|
112
115
|
require_relative "dodopayments/models/discount_type"
|
|
113
116
|
require_relative "dodopayments/models/discount_update_params"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Dodopayments
|
|
4
|
+
module Models
|
|
5
|
+
class CheckoutSessionPreviewParams < Dodopayments::Models::CheckoutSessionRequest
|
|
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::CheckoutSessionPreviewParams,
|
|
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
|