dodopayments 1.49.0__py3-none-any.whl → 1.51.0__py3-none-any.whl
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.
Potentially problematic release.
This version of dodopayments might be problematic. Click here for more details.
- dodopayments/_client.py +15 -11
- dodopayments/_version.py +1 -1
- dodopayments/resources/__init__.py +13 -13
- dodopayments/resources/checkout_sessions.py +272 -0
- dodopayments/resources/subscriptions.py +7 -2
- dodopayments/resources/webhooks/webhooks.py +19 -22
- dodopayments/types/__init__.py +4 -13
- dodopayments/types/checkout_session_create_params.py +174 -0
- dodopayments/types/checkout_session_response.py +13 -0
- dodopayments/types/on_demand_subscription_param.py +44 -0
- dodopayments/types/subscription.py +3 -0
- dodopayments/types/subscription_create_params.py +3 -36
- dodopayments/types/subscription_update_params.py +1 -0
- dodopayments/types/{webhook_list_response.py → webhook_details.py} +2 -2
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/METADATA +17 -90
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/RECORD +18 -27
- dodopayments/resources/your_webhook_url.py +0 -224
- dodopayments/types/addon_cart_response_item_param.py +0 -13
- dodopayments/types/customer_limited_details_param.py +0 -18
- dodopayments/types/dispute_param.py +0 -45
- dodopayments/types/get_dispute_param.py +0 -52
- dodopayments/types/license_key_param.py +0 -53
- dodopayments/types/payment_param.py +0 -131
- dodopayments/types/refund_param.py +0 -42
- dodopayments/types/subscription_param.py +0 -97
- dodopayments/types/webhook_create_response.py +0 -42
- dodopayments/types/webhook_retrieve_response.py +0 -42
- dodopayments/types/webhook_update_response.py +0 -42
- dodopayments/types/your_webhook_url_create_params.py +0 -66
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/WHEEL +0 -0
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/licenses/LICENSE +0 -0
dodopayments/_client.py
CHANGED
|
@@ -33,7 +33,7 @@ from .resources import (
|
|
|
33
33
|
discounts,
|
|
34
34
|
license_keys,
|
|
35
35
|
subscriptions,
|
|
36
|
-
|
|
36
|
+
checkout_sessions,
|
|
37
37
|
license_key_instances,
|
|
38
38
|
)
|
|
39
39
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
@@ -67,6 +67,7 @@ ENVIRONMENTS: Dict[str, str] = {
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
class DodoPayments(SyncAPIClient):
|
|
70
|
+
checkout_sessions: checkout_sessions.CheckoutSessionsResource
|
|
70
71
|
payments: payments.PaymentsResource
|
|
71
72
|
subscriptions: subscriptions.SubscriptionsResource
|
|
72
73
|
invoices: invoices.InvoicesResource
|
|
@@ -83,7 +84,6 @@ class DodoPayments(SyncAPIClient):
|
|
|
83
84
|
addons: addons.AddonsResource
|
|
84
85
|
brands: brands.BrandsResource
|
|
85
86
|
webhooks: webhooks.WebhooksResource
|
|
86
|
-
your_webhook_url: your_webhook_url.YourWebhookURLResource
|
|
87
87
|
with_raw_response: DodoPaymentsWithRawResponse
|
|
88
88
|
with_streaming_response: DodoPaymentsWithStreamedResponse
|
|
89
89
|
|
|
@@ -165,6 +165,7 @@ class DodoPayments(SyncAPIClient):
|
|
|
165
165
|
_strict_response_validation=_strict_response_validation,
|
|
166
166
|
)
|
|
167
167
|
|
|
168
|
+
self.checkout_sessions = checkout_sessions.CheckoutSessionsResource(self)
|
|
168
169
|
self.payments = payments.PaymentsResource(self)
|
|
169
170
|
self.subscriptions = subscriptions.SubscriptionsResource(self)
|
|
170
171
|
self.invoices = invoices.InvoicesResource(self)
|
|
@@ -181,7 +182,6 @@ class DodoPayments(SyncAPIClient):
|
|
|
181
182
|
self.addons = addons.AddonsResource(self)
|
|
182
183
|
self.brands = brands.BrandsResource(self)
|
|
183
184
|
self.webhooks = webhooks.WebhooksResource(self)
|
|
184
|
-
self.your_webhook_url = your_webhook_url.YourWebhookURLResource(self)
|
|
185
185
|
self.with_raw_response = DodoPaymentsWithRawResponse(self)
|
|
186
186
|
self.with_streaming_response = DodoPaymentsWithStreamedResponse(self)
|
|
187
187
|
|
|
@@ -293,6 +293,7 @@ class DodoPayments(SyncAPIClient):
|
|
|
293
293
|
|
|
294
294
|
|
|
295
295
|
class AsyncDodoPayments(AsyncAPIClient):
|
|
296
|
+
checkout_sessions: checkout_sessions.AsyncCheckoutSessionsResource
|
|
296
297
|
payments: payments.AsyncPaymentsResource
|
|
297
298
|
subscriptions: subscriptions.AsyncSubscriptionsResource
|
|
298
299
|
invoices: invoices.AsyncInvoicesResource
|
|
@@ -309,7 +310,6 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
309
310
|
addons: addons.AsyncAddonsResource
|
|
310
311
|
brands: brands.AsyncBrandsResource
|
|
311
312
|
webhooks: webhooks.AsyncWebhooksResource
|
|
312
|
-
your_webhook_url: your_webhook_url.AsyncYourWebhookURLResource
|
|
313
313
|
with_raw_response: AsyncDodoPaymentsWithRawResponse
|
|
314
314
|
with_streaming_response: AsyncDodoPaymentsWithStreamedResponse
|
|
315
315
|
|
|
@@ -391,6 +391,7 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
391
391
|
_strict_response_validation=_strict_response_validation,
|
|
392
392
|
)
|
|
393
393
|
|
|
394
|
+
self.checkout_sessions = checkout_sessions.AsyncCheckoutSessionsResource(self)
|
|
394
395
|
self.payments = payments.AsyncPaymentsResource(self)
|
|
395
396
|
self.subscriptions = subscriptions.AsyncSubscriptionsResource(self)
|
|
396
397
|
self.invoices = invoices.AsyncInvoicesResource(self)
|
|
@@ -407,7 +408,6 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
407
408
|
self.addons = addons.AsyncAddonsResource(self)
|
|
408
409
|
self.brands = brands.AsyncBrandsResource(self)
|
|
409
410
|
self.webhooks = webhooks.AsyncWebhooksResource(self)
|
|
410
|
-
self.your_webhook_url = your_webhook_url.AsyncYourWebhookURLResource(self)
|
|
411
411
|
self.with_raw_response = AsyncDodoPaymentsWithRawResponse(self)
|
|
412
412
|
self.with_streaming_response = AsyncDodoPaymentsWithStreamedResponse(self)
|
|
413
413
|
|
|
@@ -520,6 +520,7 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
520
520
|
|
|
521
521
|
class DodoPaymentsWithRawResponse:
|
|
522
522
|
def __init__(self, client: DodoPayments) -> None:
|
|
523
|
+
self.checkout_sessions = checkout_sessions.CheckoutSessionsResourceWithRawResponse(client.checkout_sessions)
|
|
523
524
|
self.payments = payments.PaymentsResourceWithRawResponse(client.payments)
|
|
524
525
|
self.subscriptions = subscriptions.SubscriptionsResourceWithRawResponse(client.subscriptions)
|
|
525
526
|
self.invoices = invoices.InvoicesResourceWithRawResponse(client.invoices)
|
|
@@ -538,11 +539,13 @@ class DodoPaymentsWithRawResponse:
|
|
|
538
539
|
self.addons = addons.AddonsResourceWithRawResponse(client.addons)
|
|
539
540
|
self.brands = brands.BrandsResourceWithRawResponse(client.brands)
|
|
540
541
|
self.webhooks = webhooks.WebhooksResourceWithRawResponse(client.webhooks)
|
|
541
|
-
self.your_webhook_url = your_webhook_url.YourWebhookURLResourceWithRawResponse(client.your_webhook_url)
|
|
542
542
|
|
|
543
543
|
|
|
544
544
|
class AsyncDodoPaymentsWithRawResponse:
|
|
545
545
|
def __init__(self, client: AsyncDodoPayments) -> None:
|
|
546
|
+
self.checkout_sessions = checkout_sessions.AsyncCheckoutSessionsResourceWithRawResponse(
|
|
547
|
+
client.checkout_sessions
|
|
548
|
+
)
|
|
546
549
|
self.payments = payments.AsyncPaymentsResourceWithRawResponse(client.payments)
|
|
547
550
|
self.subscriptions = subscriptions.AsyncSubscriptionsResourceWithRawResponse(client.subscriptions)
|
|
548
551
|
self.invoices = invoices.AsyncInvoicesResourceWithRawResponse(client.invoices)
|
|
@@ -561,11 +564,13 @@ class AsyncDodoPaymentsWithRawResponse:
|
|
|
561
564
|
self.addons = addons.AsyncAddonsResourceWithRawResponse(client.addons)
|
|
562
565
|
self.brands = brands.AsyncBrandsResourceWithRawResponse(client.brands)
|
|
563
566
|
self.webhooks = webhooks.AsyncWebhooksResourceWithRawResponse(client.webhooks)
|
|
564
|
-
self.your_webhook_url = your_webhook_url.AsyncYourWebhookURLResourceWithRawResponse(client.your_webhook_url)
|
|
565
567
|
|
|
566
568
|
|
|
567
569
|
class DodoPaymentsWithStreamedResponse:
|
|
568
570
|
def __init__(self, client: DodoPayments) -> None:
|
|
571
|
+
self.checkout_sessions = checkout_sessions.CheckoutSessionsResourceWithStreamingResponse(
|
|
572
|
+
client.checkout_sessions
|
|
573
|
+
)
|
|
569
574
|
self.payments = payments.PaymentsResourceWithStreamingResponse(client.payments)
|
|
570
575
|
self.subscriptions = subscriptions.SubscriptionsResourceWithStreamingResponse(client.subscriptions)
|
|
571
576
|
self.invoices = invoices.InvoicesResourceWithStreamingResponse(client.invoices)
|
|
@@ -584,11 +589,13 @@ class DodoPaymentsWithStreamedResponse:
|
|
|
584
589
|
self.addons = addons.AddonsResourceWithStreamingResponse(client.addons)
|
|
585
590
|
self.brands = brands.BrandsResourceWithStreamingResponse(client.brands)
|
|
586
591
|
self.webhooks = webhooks.WebhooksResourceWithStreamingResponse(client.webhooks)
|
|
587
|
-
self.your_webhook_url = your_webhook_url.YourWebhookURLResourceWithStreamingResponse(client.your_webhook_url)
|
|
588
592
|
|
|
589
593
|
|
|
590
594
|
class AsyncDodoPaymentsWithStreamedResponse:
|
|
591
595
|
def __init__(self, client: AsyncDodoPayments) -> None:
|
|
596
|
+
self.checkout_sessions = checkout_sessions.AsyncCheckoutSessionsResourceWithStreamingResponse(
|
|
597
|
+
client.checkout_sessions
|
|
598
|
+
)
|
|
592
599
|
self.payments = payments.AsyncPaymentsResourceWithStreamingResponse(client.payments)
|
|
593
600
|
self.subscriptions = subscriptions.AsyncSubscriptionsResourceWithStreamingResponse(client.subscriptions)
|
|
594
601
|
self.invoices = invoices.AsyncInvoicesResourceWithStreamingResponse(client.invoices)
|
|
@@ -607,9 +614,6 @@ class AsyncDodoPaymentsWithStreamedResponse:
|
|
|
607
614
|
self.addons = addons.AsyncAddonsResourceWithStreamingResponse(client.addons)
|
|
608
615
|
self.brands = brands.AsyncBrandsResourceWithStreamingResponse(client.brands)
|
|
609
616
|
self.webhooks = webhooks.AsyncWebhooksResourceWithStreamingResponse(client.webhooks)
|
|
610
|
-
self.your_webhook_url = your_webhook_url.AsyncYourWebhookURLResourceWithStreamingResponse(
|
|
611
|
-
client.your_webhook_url
|
|
612
|
-
)
|
|
613
617
|
|
|
614
618
|
|
|
615
619
|
Client = DodoPayments
|
dodopayments/_version.py
CHANGED
|
@@ -120,13 +120,13 @@ from .subscriptions import (
|
|
|
120
120
|
SubscriptionsResourceWithStreamingResponse,
|
|
121
121
|
AsyncSubscriptionsResourceWithStreamingResponse,
|
|
122
122
|
)
|
|
123
|
-
from .
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
from .checkout_sessions import (
|
|
124
|
+
CheckoutSessionsResource,
|
|
125
|
+
AsyncCheckoutSessionsResource,
|
|
126
|
+
CheckoutSessionsResourceWithRawResponse,
|
|
127
|
+
AsyncCheckoutSessionsResourceWithRawResponse,
|
|
128
|
+
CheckoutSessionsResourceWithStreamingResponse,
|
|
129
|
+
AsyncCheckoutSessionsResourceWithStreamingResponse,
|
|
130
130
|
)
|
|
131
131
|
from .license_key_instances import (
|
|
132
132
|
LicenseKeyInstancesResource,
|
|
@@ -138,6 +138,12 @@ from .license_key_instances import (
|
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
__all__ = [
|
|
141
|
+
"CheckoutSessionsResource",
|
|
142
|
+
"AsyncCheckoutSessionsResource",
|
|
143
|
+
"CheckoutSessionsResourceWithRawResponse",
|
|
144
|
+
"AsyncCheckoutSessionsResourceWithRawResponse",
|
|
145
|
+
"CheckoutSessionsResourceWithStreamingResponse",
|
|
146
|
+
"AsyncCheckoutSessionsResourceWithStreamingResponse",
|
|
141
147
|
"PaymentsResource",
|
|
142
148
|
"AsyncPaymentsResource",
|
|
143
149
|
"PaymentsResourceWithRawResponse",
|
|
@@ -234,10 +240,4 @@ __all__ = [
|
|
|
234
240
|
"AsyncWebhooksResourceWithRawResponse",
|
|
235
241
|
"WebhooksResourceWithStreamingResponse",
|
|
236
242
|
"AsyncWebhooksResourceWithStreamingResponse",
|
|
237
|
-
"YourWebhookURLResource",
|
|
238
|
-
"AsyncYourWebhookURLResource",
|
|
239
|
-
"YourWebhookURLResourceWithRawResponse",
|
|
240
|
-
"AsyncYourWebhookURLResourceWithRawResponse",
|
|
241
|
-
"YourWebhookURLResourceWithStreamingResponse",
|
|
242
|
-
"AsyncYourWebhookURLResourceWithStreamingResponse",
|
|
243
243
|
]
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, List, Iterable, Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..types import Currency, checkout_session_create_params
|
|
10
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
12
|
+
from .._compat import cached_property
|
|
13
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
14
|
+
from .._response import (
|
|
15
|
+
to_raw_response_wrapper,
|
|
16
|
+
to_streamed_response_wrapper,
|
|
17
|
+
async_to_raw_response_wrapper,
|
|
18
|
+
async_to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
20
|
+
from .._base_client import make_request_options
|
|
21
|
+
from ..types.currency import Currency
|
|
22
|
+
from ..types.payment_method_types import PaymentMethodTypes
|
|
23
|
+
from ..types.customer_request_param import CustomerRequestParam
|
|
24
|
+
from ..types.checkout_session_response import CheckoutSessionResponse
|
|
25
|
+
|
|
26
|
+
__all__ = ["CheckoutSessionsResource", "AsyncCheckoutSessionsResource"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CheckoutSessionsResource(SyncAPIResource):
|
|
30
|
+
@cached_property
|
|
31
|
+
def with_raw_response(self) -> CheckoutSessionsResourceWithRawResponse:
|
|
32
|
+
"""
|
|
33
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
34
|
+
the raw response object instead of the parsed content.
|
|
35
|
+
|
|
36
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
37
|
+
"""
|
|
38
|
+
return CheckoutSessionsResourceWithRawResponse(self)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_streaming_response(self) -> CheckoutSessionsResourceWithStreamingResponse:
|
|
42
|
+
"""
|
|
43
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
44
|
+
|
|
45
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
46
|
+
"""
|
|
47
|
+
return CheckoutSessionsResourceWithStreamingResponse(self)
|
|
48
|
+
|
|
49
|
+
def create(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
product_cart: Iterable[checkout_session_create_params.ProductCart],
|
|
53
|
+
allowed_payment_method_types: Optional[List[PaymentMethodTypes]] | NotGiven = NOT_GIVEN,
|
|
54
|
+
billing_address: Optional[checkout_session_create_params.BillingAddress] | NotGiven = NOT_GIVEN,
|
|
55
|
+
billing_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
56
|
+
confirm: bool | NotGiven = NOT_GIVEN,
|
|
57
|
+
customer: Optional[CustomerRequestParam] | NotGiven = NOT_GIVEN,
|
|
58
|
+
customization: checkout_session_create_params.Customization | NotGiven = NOT_GIVEN,
|
|
59
|
+
discount_code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
60
|
+
feature_flags: checkout_session_create_params.FeatureFlags | NotGiven = NOT_GIVEN,
|
|
61
|
+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
62
|
+
return_url: Optional[str] | NotGiven = NOT_GIVEN,
|
|
63
|
+
show_saved_payment_methods: bool | NotGiven = NOT_GIVEN,
|
|
64
|
+
subscription_data: Optional[checkout_session_create_params.SubscriptionData] | NotGiven = NOT_GIVEN,
|
|
65
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
|
+
extra_headers: Headers | None = None,
|
|
68
|
+
extra_query: Query | None = None,
|
|
69
|
+
extra_body: Body | None = None,
|
|
70
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
71
|
+
) -> CheckoutSessionResponse:
|
|
72
|
+
"""
|
|
73
|
+
Args:
|
|
74
|
+
allowed_payment_method_types: Customers will never see payment methods that are not in this list. However,
|
|
75
|
+
adding a method here does not guarantee customers will see it. Availability
|
|
76
|
+
still depends on other factors (e.g., customer location, merchant settings).
|
|
77
|
+
|
|
78
|
+
Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment
|
|
79
|
+
methods are unavailable, checkout session will fail.
|
|
80
|
+
|
|
81
|
+
billing_address: Billing address information for the session
|
|
82
|
+
|
|
83
|
+
billing_currency: This field is ingored if adaptive pricing is disabled
|
|
84
|
+
|
|
85
|
+
confirm: If confirm is true, all the details will be finalized. If required data is
|
|
86
|
+
missing, an API error is thrown.
|
|
87
|
+
|
|
88
|
+
customer: Customer details for the session
|
|
89
|
+
|
|
90
|
+
customization: Customization for the checkout session page
|
|
91
|
+
|
|
92
|
+
metadata: Additional metadata associated with the payment. Defaults to empty if not
|
|
93
|
+
provided.
|
|
94
|
+
|
|
95
|
+
return_url: The url to redirect after payment failure or success.
|
|
96
|
+
|
|
97
|
+
show_saved_payment_methods: Display saved payment methods of a returning customer False by default
|
|
98
|
+
|
|
99
|
+
extra_headers: Send extra headers
|
|
100
|
+
|
|
101
|
+
extra_query: Add additional query parameters to the request
|
|
102
|
+
|
|
103
|
+
extra_body: Add additional JSON properties to the request
|
|
104
|
+
|
|
105
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
106
|
+
"""
|
|
107
|
+
return self._post(
|
|
108
|
+
"/checkouts",
|
|
109
|
+
body=maybe_transform(
|
|
110
|
+
{
|
|
111
|
+
"product_cart": product_cart,
|
|
112
|
+
"allowed_payment_method_types": allowed_payment_method_types,
|
|
113
|
+
"billing_address": billing_address,
|
|
114
|
+
"billing_currency": billing_currency,
|
|
115
|
+
"confirm": confirm,
|
|
116
|
+
"customer": customer,
|
|
117
|
+
"customization": customization,
|
|
118
|
+
"discount_code": discount_code,
|
|
119
|
+
"feature_flags": feature_flags,
|
|
120
|
+
"metadata": metadata,
|
|
121
|
+
"return_url": return_url,
|
|
122
|
+
"show_saved_payment_methods": show_saved_payment_methods,
|
|
123
|
+
"subscription_data": subscription_data,
|
|
124
|
+
},
|
|
125
|
+
checkout_session_create_params.CheckoutSessionCreateParams,
|
|
126
|
+
),
|
|
127
|
+
options=make_request_options(
|
|
128
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
129
|
+
),
|
|
130
|
+
cast_to=CheckoutSessionResponse,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class AsyncCheckoutSessionsResource(AsyncAPIResource):
|
|
135
|
+
@cached_property
|
|
136
|
+
def with_raw_response(self) -> AsyncCheckoutSessionsResourceWithRawResponse:
|
|
137
|
+
"""
|
|
138
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
139
|
+
the raw response object instead of the parsed content.
|
|
140
|
+
|
|
141
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
142
|
+
"""
|
|
143
|
+
return AsyncCheckoutSessionsResourceWithRawResponse(self)
|
|
144
|
+
|
|
145
|
+
@cached_property
|
|
146
|
+
def with_streaming_response(self) -> AsyncCheckoutSessionsResourceWithStreamingResponse:
|
|
147
|
+
"""
|
|
148
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
149
|
+
|
|
150
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
151
|
+
"""
|
|
152
|
+
return AsyncCheckoutSessionsResourceWithStreamingResponse(self)
|
|
153
|
+
|
|
154
|
+
async def create(
|
|
155
|
+
self,
|
|
156
|
+
*,
|
|
157
|
+
product_cart: Iterable[checkout_session_create_params.ProductCart],
|
|
158
|
+
allowed_payment_method_types: Optional[List[PaymentMethodTypes]] | NotGiven = NOT_GIVEN,
|
|
159
|
+
billing_address: Optional[checkout_session_create_params.BillingAddress] | NotGiven = NOT_GIVEN,
|
|
160
|
+
billing_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
161
|
+
confirm: bool | NotGiven = NOT_GIVEN,
|
|
162
|
+
customer: Optional[CustomerRequestParam] | NotGiven = NOT_GIVEN,
|
|
163
|
+
customization: checkout_session_create_params.Customization | NotGiven = NOT_GIVEN,
|
|
164
|
+
discount_code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
165
|
+
feature_flags: checkout_session_create_params.FeatureFlags | NotGiven = NOT_GIVEN,
|
|
166
|
+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
167
|
+
return_url: Optional[str] | NotGiven = NOT_GIVEN,
|
|
168
|
+
show_saved_payment_methods: bool | NotGiven = NOT_GIVEN,
|
|
169
|
+
subscription_data: Optional[checkout_session_create_params.SubscriptionData] | NotGiven = NOT_GIVEN,
|
|
170
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
171
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
172
|
+
extra_headers: Headers | None = None,
|
|
173
|
+
extra_query: Query | None = None,
|
|
174
|
+
extra_body: Body | None = None,
|
|
175
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
176
|
+
) -> CheckoutSessionResponse:
|
|
177
|
+
"""
|
|
178
|
+
Args:
|
|
179
|
+
allowed_payment_method_types: Customers will never see payment methods that are not in this list. However,
|
|
180
|
+
adding a method here does not guarantee customers will see it. Availability
|
|
181
|
+
still depends on other factors (e.g., customer location, merchant settings).
|
|
182
|
+
|
|
183
|
+
Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment
|
|
184
|
+
methods are unavailable, checkout session will fail.
|
|
185
|
+
|
|
186
|
+
billing_address: Billing address information for the session
|
|
187
|
+
|
|
188
|
+
billing_currency: This field is ingored if adaptive pricing is disabled
|
|
189
|
+
|
|
190
|
+
confirm: If confirm is true, all the details will be finalized. If required data is
|
|
191
|
+
missing, an API error is thrown.
|
|
192
|
+
|
|
193
|
+
customer: Customer details for the session
|
|
194
|
+
|
|
195
|
+
customization: Customization for the checkout session page
|
|
196
|
+
|
|
197
|
+
metadata: Additional metadata associated with the payment. Defaults to empty if not
|
|
198
|
+
provided.
|
|
199
|
+
|
|
200
|
+
return_url: The url to redirect after payment failure or success.
|
|
201
|
+
|
|
202
|
+
show_saved_payment_methods: Display saved payment methods of a returning customer False by default
|
|
203
|
+
|
|
204
|
+
extra_headers: Send extra headers
|
|
205
|
+
|
|
206
|
+
extra_query: Add additional query parameters to the request
|
|
207
|
+
|
|
208
|
+
extra_body: Add additional JSON properties to the request
|
|
209
|
+
|
|
210
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
211
|
+
"""
|
|
212
|
+
return await self._post(
|
|
213
|
+
"/checkouts",
|
|
214
|
+
body=await async_maybe_transform(
|
|
215
|
+
{
|
|
216
|
+
"product_cart": product_cart,
|
|
217
|
+
"allowed_payment_method_types": allowed_payment_method_types,
|
|
218
|
+
"billing_address": billing_address,
|
|
219
|
+
"billing_currency": billing_currency,
|
|
220
|
+
"confirm": confirm,
|
|
221
|
+
"customer": customer,
|
|
222
|
+
"customization": customization,
|
|
223
|
+
"discount_code": discount_code,
|
|
224
|
+
"feature_flags": feature_flags,
|
|
225
|
+
"metadata": metadata,
|
|
226
|
+
"return_url": return_url,
|
|
227
|
+
"show_saved_payment_methods": show_saved_payment_methods,
|
|
228
|
+
"subscription_data": subscription_data,
|
|
229
|
+
},
|
|
230
|
+
checkout_session_create_params.CheckoutSessionCreateParams,
|
|
231
|
+
),
|
|
232
|
+
options=make_request_options(
|
|
233
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
234
|
+
),
|
|
235
|
+
cast_to=CheckoutSessionResponse,
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class CheckoutSessionsResourceWithRawResponse:
|
|
240
|
+
def __init__(self, checkout_sessions: CheckoutSessionsResource) -> None:
|
|
241
|
+
self._checkout_sessions = checkout_sessions
|
|
242
|
+
|
|
243
|
+
self.create = to_raw_response_wrapper(
|
|
244
|
+
checkout_sessions.create,
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class AsyncCheckoutSessionsResourceWithRawResponse:
|
|
249
|
+
def __init__(self, checkout_sessions: AsyncCheckoutSessionsResource) -> None:
|
|
250
|
+
self._checkout_sessions = checkout_sessions
|
|
251
|
+
|
|
252
|
+
self.create = async_to_raw_response_wrapper(
|
|
253
|
+
checkout_sessions.create,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class CheckoutSessionsResourceWithStreamingResponse:
|
|
258
|
+
def __init__(self, checkout_sessions: CheckoutSessionsResource) -> None:
|
|
259
|
+
self._checkout_sessions = checkout_sessions
|
|
260
|
+
|
|
261
|
+
self.create = to_streamed_response_wrapper(
|
|
262
|
+
checkout_sessions.create,
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class AsyncCheckoutSessionsResourceWithStreamingResponse:
|
|
267
|
+
def __init__(self, checkout_sessions: AsyncCheckoutSessionsResource) -> None:
|
|
268
|
+
self._checkout_sessions = checkout_sessions
|
|
269
|
+
|
|
270
|
+
self.create = async_to_streamed_response_wrapper(
|
|
271
|
+
checkout_sessions.create,
|
|
272
|
+
)
|
|
@@ -37,6 +37,7 @@ from ..types.payment_method_types import PaymentMethodTypes
|
|
|
37
37
|
from ..types.billing_address_param import BillingAddressParam
|
|
38
38
|
from ..types.customer_request_param import CustomerRequestParam
|
|
39
39
|
from ..types.subscription_list_response import SubscriptionListResponse
|
|
40
|
+
from ..types.on_demand_subscription_param import OnDemandSubscriptionParam
|
|
40
41
|
from ..types.subscription_charge_response import SubscriptionChargeResponse
|
|
41
42
|
from ..types.subscription_create_response import SubscriptionCreateResponse
|
|
42
43
|
|
|
@@ -75,7 +76,7 @@ class SubscriptionsResource(SyncAPIResource):
|
|
|
75
76
|
billing_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
76
77
|
discount_code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
77
78
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
78
|
-
on_demand: Optional[
|
|
79
|
+
on_demand: Optional[OnDemandSubscriptionParam] | NotGiven = NOT_GIVEN,
|
|
79
80
|
payment_link: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
80
81
|
return_url: Optional[str] | NotGiven = NOT_GIVEN,
|
|
81
82
|
show_saved_payment_methods: bool | NotGiven = NOT_GIVEN,
|
|
@@ -213,6 +214,8 @@ class SubscriptionsResource(SyncAPIResource):
|
|
|
213
214
|
) -> Subscription:
|
|
214
215
|
"""
|
|
215
216
|
Args:
|
|
217
|
+
cancel_at_next_billing_date: When set, the subscription will remain active until the end of billing period
|
|
218
|
+
|
|
216
219
|
extra_headers: Send extra headers
|
|
217
220
|
|
|
218
221
|
extra_query: Add additional query parameters to the request
|
|
@@ -458,7 +461,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
|
|
|
458
461
|
billing_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
459
462
|
discount_code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
460
463
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
461
|
-
on_demand: Optional[
|
|
464
|
+
on_demand: Optional[OnDemandSubscriptionParam] | NotGiven = NOT_GIVEN,
|
|
462
465
|
payment_link: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
463
466
|
return_url: Optional[str] | NotGiven = NOT_GIVEN,
|
|
464
467
|
show_saved_payment_methods: bool | NotGiven = NOT_GIVEN,
|
|
@@ -596,6 +599,8 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
|
|
|
596
599
|
) -> Subscription:
|
|
597
600
|
"""
|
|
598
601
|
Args:
|
|
602
|
+
cancel_at_next_billing_date: When set, the subscription will remain active until the end of billing period
|
|
603
|
+
|
|
599
604
|
extra_headers: Send extra headers
|
|
600
605
|
|
|
601
606
|
extra_query: Add additional query parameters to the request
|
|
@@ -27,11 +27,8 @@ from ..._response import (
|
|
|
27
27
|
)
|
|
28
28
|
from ...pagination import SyncCursorPagePagination, AsyncCursorPagePagination
|
|
29
29
|
from ..._base_client import AsyncPaginator, make_request_options
|
|
30
|
+
from ...types.webhook_details import WebhookDetails
|
|
30
31
|
from ...types.webhook_event_type import WebhookEventType
|
|
31
|
-
from ...types.webhook_list_response import WebhookListResponse
|
|
32
|
-
from ...types.webhook_create_response import WebhookCreateResponse
|
|
33
|
-
from ...types.webhook_update_response import WebhookUpdateResponse
|
|
34
|
-
from ...types.webhook_retrieve_response import WebhookRetrieveResponse
|
|
35
32
|
from ...types.webhook_retrieve_secret_response import WebhookRetrieveSecretResponse
|
|
36
33
|
|
|
37
34
|
__all__ = ["WebhooksResource", "AsyncWebhooksResource"]
|
|
@@ -78,7 +75,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
78
75
|
extra_query: Query | None = None,
|
|
79
76
|
extra_body: Body | None = None,
|
|
80
77
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
81
|
-
) ->
|
|
78
|
+
) -> WebhookDetails:
|
|
82
79
|
"""
|
|
83
80
|
Create a new webhook
|
|
84
81
|
|
|
@@ -125,7 +122,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
125
122
|
options=make_request_options(
|
|
126
123
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
127
124
|
),
|
|
128
|
-
cast_to=
|
|
125
|
+
cast_to=WebhookDetails,
|
|
129
126
|
)
|
|
130
127
|
|
|
131
128
|
def retrieve(
|
|
@@ -138,7 +135,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
138
135
|
extra_query: Query | None = None,
|
|
139
136
|
extra_body: Body | None = None,
|
|
140
137
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
141
|
-
) ->
|
|
138
|
+
) -> WebhookDetails:
|
|
142
139
|
"""
|
|
143
140
|
Get a webhook by id
|
|
144
141
|
|
|
@@ -158,7 +155,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
158
155
|
options=make_request_options(
|
|
159
156
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
160
157
|
),
|
|
161
|
-
cast_to=
|
|
158
|
+
cast_to=WebhookDetails,
|
|
162
159
|
)
|
|
163
160
|
|
|
164
161
|
def update(
|
|
@@ -177,7 +174,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
177
174
|
extra_query: Query | None = None,
|
|
178
175
|
extra_body: Body | None = None,
|
|
179
176
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
180
|
-
) ->
|
|
177
|
+
) -> WebhookDetails:
|
|
181
178
|
"""
|
|
182
179
|
Patch a webhook by id
|
|
183
180
|
|
|
@@ -222,7 +219,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
222
219
|
options=make_request_options(
|
|
223
220
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
224
221
|
),
|
|
225
|
-
cast_to=
|
|
222
|
+
cast_to=WebhookDetails,
|
|
226
223
|
)
|
|
227
224
|
|
|
228
225
|
def list(
|
|
@@ -236,7 +233,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
236
233
|
extra_query: Query | None = None,
|
|
237
234
|
extra_body: Body | None = None,
|
|
238
235
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
239
|
-
) -> SyncCursorPagePagination[
|
|
236
|
+
) -> SyncCursorPagePagination[WebhookDetails]:
|
|
240
237
|
"""
|
|
241
238
|
List all webhooks
|
|
242
239
|
|
|
@@ -255,7 +252,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
255
252
|
"""
|
|
256
253
|
return self._get_api_list(
|
|
257
254
|
"/webhooks",
|
|
258
|
-
page=SyncCursorPagePagination[
|
|
255
|
+
page=SyncCursorPagePagination[WebhookDetails],
|
|
259
256
|
options=make_request_options(
|
|
260
257
|
extra_headers=extra_headers,
|
|
261
258
|
extra_query=extra_query,
|
|
@@ -269,7 +266,7 @@ class WebhooksResource(SyncAPIResource):
|
|
|
269
266
|
webhook_list_params.WebhookListParams,
|
|
270
267
|
),
|
|
271
268
|
),
|
|
272
|
-
model=
|
|
269
|
+
model=WebhookDetails,
|
|
273
270
|
)
|
|
274
271
|
|
|
275
272
|
def delete(
|
|
@@ -381,7 +378,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
381
378
|
extra_query: Query | None = None,
|
|
382
379
|
extra_body: Body | None = None,
|
|
383
380
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
384
|
-
) ->
|
|
381
|
+
) -> WebhookDetails:
|
|
385
382
|
"""
|
|
386
383
|
Create a new webhook
|
|
387
384
|
|
|
@@ -428,7 +425,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
428
425
|
options=make_request_options(
|
|
429
426
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
430
427
|
),
|
|
431
|
-
cast_to=
|
|
428
|
+
cast_to=WebhookDetails,
|
|
432
429
|
)
|
|
433
430
|
|
|
434
431
|
async def retrieve(
|
|
@@ -441,7 +438,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
441
438
|
extra_query: Query | None = None,
|
|
442
439
|
extra_body: Body | None = None,
|
|
443
440
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
444
|
-
) ->
|
|
441
|
+
) -> WebhookDetails:
|
|
445
442
|
"""
|
|
446
443
|
Get a webhook by id
|
|
447
444
|
|
|
@@ -461,7 +458,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
461
458
|
options=make_request_options(
|
|
462
459
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
463
460
|
),
|
|
464
|
-
cast_to=
|
|
461
|
+
cast_to=WebhookDetails,
|
|
465
462
|
)
|
|
466
463
|
|
|
467
464
|
async def update(
|
|
@@ -480,7 +477,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
480
477
|
extra_query: Query | None = None,
|
|
481
478
|
extra_body: Body | None = None,
|
|
482
479
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
483
|
-
) ->
|
|
480
|
+
) -> WebhookDetails:
|
|
484
481
|
"""
|
|
485
482
|
Patch a webhook by id
|
|
486
483
|
|
|
@@ -525,7 +522,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
525
522
|
options=make_request_options(
|
|
526
523
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
527
524
|
),
|
|
528
|
-
cast_to=
|
|
525
|
+
cast_to=WebhookDetails,
|
|
529
526
|
)
|
|
530
527
|
|
|
531
528
|
def list(
|
|
@@ -539,7 +536,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
539
536
|
extra_query: Query | None = None,
|
|
540
537
|
extra_body: Body | None = None,
|
|
541
538
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
542
|
-
) -> AsyncPaginator[
|
|
539
|
+
) -> AsyncPaginator[WebhookDetails, AsyncCursorPagePagination[WebhookDetails]]:
|
|
543
540
|
"""
|
|
544
541
|
List all webhooks
|
|
545
542
|
|
|
@@ -558,7 +555,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
558
555
|
"""
|
|
559
556
|
return self._get_api_list(
|
|
560
557
|
"/webhooks",
|
|
561
|
-
page=AsyncCursorPagePagination[
|
|
558
|
+
page=AsyncCursorPagePagination[WebhookDetails],
|
|
562
559
|
options=make_request_options(
|
|
563
560
|
extra_headers=extra_headers,
|
|
564
561
|
extra_query=extra_query,
|
|
@@ -572,7 +569,7 @@ class AsyncWebhooksResource(AsyncAPIResource):
|
|
|
572
569
|
webhook_list_params.WebhookListParams,
|
|
573
570
|
),
|
|
574
571
|
),
|
|
575
|
-
model=
|
|
572
|
+
model=WebhookDetails,
|
|
576
573
|
)
|
|
577
574
|
|
|
578
575
|
async def delete(
|