dodopayments 1.55.7__py3-none-any.whl → 1.56.2__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.

Files changed (58) hide show
  1. dodopayments/__init__.py +2 -0
  2. dodopayments/_client.py +22 -2
  3. dodopayments/_exceptions.py +4 -0
  4. dodopayments/_version.py +1 -1
  5. dodopayments/resources/checkout_sessions.py +75 -0
  6. dodopayments/resources/subscriptions.py +4 -0
  7. dodopayments/resources/webhooks/webhooks.py +76 -1
  8. dodopayments/types/__init__.py +26 -0
  9. dodopayments/types/checkout_session_status.py +35 -0
  10. dodopayments/types/dispute_accepted_webhook_event.py +29 -0
  11. dodopayments/types/dispute_accepted_webhook_event1.py +29 -0
  12. dodopayments/types/dispute_cancelled_webhook_event.py +29 -0
  13. dodopayments/types/dispute_cancelled_webhook_event1.py +29 -0
  14. dodopayments/types/dispute_challenged_webhook_event.py +29 -0
  15. dodopayments/types/dispute_challenged_webhook_event1.py +29 -0
  16. dodopayments/types/dispute_expired_webhook_event.py +29 -0
  17. dodopayments/types/dispute_expired_webhook_event1.py +29 -0
  18. dodopayments/types/dispute_lost_webhook_event.py +29 -0
  19. dodopayments/types/dispute_lost_webhook_event1.py +29 -0
  20. dodopayments/types/dispute_opened_webhook_event.py +29 -0
  21. dodopayments/types/dispute_opened_webhook_event1.py +29 -0
  22. dodopayments/types/dispute_won_webhook_event.py +29 -0
  23. dodopayments/types/dispute_won_webhook_event1.py +29 -0
  24. dodopayments/types/license_key_created_webhook_event.py +29 -0
  25. dodopayments/types/license_key_created_webhook_event1.py +29 -0
  26. dodopayments/types/payment_cancelled_webhook_event.py +29 -0
  27. dodopayments/types/payment_cancelled_webhook_event1.py +29 -0
  28. dodopayments/types/payment_failed_webhook_event.py +29 -0
  29. dodopayments/types/payment_failed_webhook_event1.py +29 -0
  30. dodopayments/types/payment_processing_webhook_event.py +29 -0
  31. dodopayments/types/payment_processing_webhook_event1.py +29 -0
  32. dodopayments/types/payment_succeeded_webhook_event.py +29 -0
  33. dodopayments/types/payment_succeeded_webhook_event1.py +29 -0
  34. dodopayments/types/refund_failed_webhook_event.py +29 -0
  35. dodopayments/types/refund_failed_webhook_event1.py +29 -0
  36. dodopayments/types/refund_succeeded_webhook_event.py +29 -0
  37. dodopayments/types/refund_succeeded_webhook_event1.py +29 -0
  38. dodopayments/types/subscription_active_webhook_event.py +29 -0
  39. dodopayments/types/subscription_active_webhook_event1.py +29 -0
  40. dodopayments/types/subscription_cancelled_webhook_event.py +29 -0
  41. dodopayments/types/subscription_cancelled_webhook_event1.py +29 -0
  42. dodopayments/types/subscription_expired_webhook_event.py +29 -0
  43. dodopayments/types/subscription_expired_webhook_event1.py +29 -0
  44. dodopayments/types/subscription_failed_webhook_event.py +29 -0
  45. dodopayments/types/subscription_failed_webhook_event1.py +29 -0
  46. dodopayments/types/subscription_on_hold_webhook_event.py +29 -0
  47. dodopayments/types/subscription_on_hold_webhook_event1.py +29 -0
  48. dodopayments/types/subscription_plan_changed_webhook_event.py +29 -0
  49. dodopayments/types/subscription_plan_changed_webhook_event1.py +29 -0
  50. dodopayments/types/subscription_renewed_webhook_event.py +29 -0
  51. dodopayments/types/subscription_renewed_webhook_event1.py +29 -0
  52. dodopayments/types/subscription_update_params.py +2 -0
  53. dodopayments/types/unsafe_unwrap_webhook_event.py +52 -0
  54. dodopayments/types/unwrap_webhook_event.py +52 -0
  55. {dodopayments-1.55.7.dist-info → dodopayments-1.56.2.dist-info}/METADATA +4 -2
  56. {dodopayments-1.55.7.dist-info → dodopayments-1.56.2.dist-info}/RECORD +58 -13
  57. {dodopayments-1.55.7.dist-info → dodopayments-1.56.2.dist-info}/WHEEL +0 -0
  58. {dodopayments-1.55.7.dist-info → dodopayments-1.56.2.dist-info}/licenses/LICENSE +0 -0
dodopayments/__init__.py CHANGED
@@ -35,6 +35,7 @@ from ._exceptions import (
35
35
  InternalServerError,
36
36
  PermissionDeniedError,
37
37
  UnprocessableEntityError,
38
+ APIWebhookValidationError,
38
39
  APIResponseValidationError,
39
40
  )
40
41
  from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
@@ -58,6 +59,7 @@ __all__ = [
58
59
  "APITimeoutError",
59
60
  "APIConnectionError",
60
61
  "APIResponseValidationError",
62
+ "APIWebhookValidationError",
61
63
  "BadRequestError",
62
64
  "AuthenticationError",
63
65
  "PermissionDeniedError",
dodopayments/_client.py CHANGED
@@ -93,6 +93,7 @@ class DodoPayments(SyncAPIClient):
93
93
 
94
94
  # client options
95
95
  bearer_token: str
96
+ webhook_key: str | None
96
97
 
97
98
  _environment: Literal["live_mode", "test_mode"] | NotGiven
98
99
 
@@ -100,6 +101,7 @@ class DodoPayments(SyncAPIClient):
100
101
  self,
101
102
  *,
102
103
  bearer_token: str | None = None,
104
+ webhook_key: str | None = None,
103
105
  environment: Literal["live_mode", "test_mode"] | NotGiven = not_given,
104
106
  base_url: str | httpx.URL | None | NotGiven = not_given,
105
107
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -122,7 +124,9 @@ class DodoPayments(SyncAPIClient):
122
124
  ) -> None:
123
125
  """Construct a new synchronous DodoPayments client instance.
124
126
 
125
- This automatically infers the `bearer_token` argument from the `DODO_PAYMENTS_API_KEY` environment variable if it is not provided.
127
+ This automatically infers the following arguments from their corresponding environment variables if they are not provided:
128
+ - `bearer_token` from `DODO_PAYMENTS_API_KEY`
129
+ - `webhook_key` from `DODO_PAYMENTS_WEBHOOK_KEY`
126
130
  """
127
131
  if bearer_token is None:
128
132
  bearer_token = os.environ.get("DODO_PAYMENTS_API_KEY")
@@ -132,6 +136,10 @@ class DodoPayments(SyncAPIClient):
132
136
  )
133
137
  self.bearer_token = bearer_token
134
138
 
139
+ if webhook_key is None:
140
+ webhook_key = os.environ.get("DODO_PAYMENTS_WEBHOOK_KEY")
141
+ self.webhook_key = webhook_key
142
+
135
143
  self._environment = environment
136
144
 
137
145
  base_url_env = os.environ.get("DODO_PAYMENTS_BASE_URL")
@@ -215,6 +223,7 @@ class DodoPayments(SyncAPIClient):
215
223
  self,
216
224
  *,
217
225
  bearer_token: str | None = None,
226
+ webhook_key: str | None = None,
218
227
  environment: Literal["live_mode", "test_mode"] | None = None,
219
228
  base_url: str | httpx.URL | None = None,
220
229
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -250,6 +259,7 @@ class DodoPayments(SyncAPIClient):
250
259
  http_client = http_client or self._client
251
260
  return self.__class__(
252
261
  bearer_token=bearer_token or self.bearer_token,
262
+ webhook_key=webhook_key or self.webhook_key,
253
263
  base_url=base_url or self.base_url,
254
264
  environment=environment or self._environment,
255
265
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -323,6 +333,7 @@ class AsyncDodoPayments(AsyncAPIClient):
323
333
 
324
334
  # client options
325
335
  bearer_token: str
336
+ webhook_key: str | None
326
337
 
327
338
  _environment: Literal["live_mode", "test_mode"] | NotGiven
328
339
 
@@ -330,6 +341,7 @@ class AsyncDodoPayments(AsyncAPIClient):
330
341
  self,
331
342
  *,
332
343
  bearer_token: str | None = None,
344
+ webhook_key: str | None = None,
333
345
  environment: Literal["live_mode", "test_mode"] | NotGiven = not_given,
334
346
  base_url: str | httpx.URL | None | NotGiven = not_given,
335
347
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -352,7 +364,9 @@ class AsyncDodoPayments(AsyncAPIClient):
352
364
  ) -> None:
353
365
  """Construct a new async AsyncDodoPayments client instance.
354
366
 
355
- This automatically infers the `bearer_token` argument from the `DODO_PAYMENTS_API_KEY` environment variable if it is not provided.
367
+ This automatically infers the following arguments from their corresponding environment variables if they are not provided:
368
+ - `bearer_token` from `DODO_PAYMENTS_API_KEY`
369
+ - `webhook_key` from `DODO_PAYMENTS_WEBHOOK_KEY`
356
370
  """
357
371
  if bearer_token is None:
358
372
  bearer_token = os.environ.get("DODO_PAYMENTS_API_KEY")
@@ -362,6 +376,10 @@ class AsyncDodoPayments(AsyncAPIClient):
362
376
  )
363
377
  self.bearer_token = bearer_token
364
378
 
379
+ if webhook_key is None:
380
+ webhook_key = os.environ.get("DODO_PAYMENTS_WEBHOOK_KEY")
381
+ self.webhook_key = webhook_key
382
+
365
383
  self._environment = environment
366
384
 
367
385
  base_url_env = os.environ.get("DODO_PAYMENTS_BASE_URL")
@@ -445,6 +463,7 @@ class AsyncDodoPayments(AsyncAPIClient):
445
463
  self,
446
464
  *,
447
465
  bearer_token: str | None = None,
466
+ webhook_key: str | None = None,
448
467
  environment: Literal["live_mode", "test_mode"] | None = None,
449
468
  base_url: str | httpx.URL | None = None,
450
469
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -480,6 +499,7 @@ class AsyncDodoPayments(AsyncAPIClient):
480
499
  http_client = http_client or self._client
481
500
  return self.__class__(
482
501
  bearer_token=bearer_token or self.bearer_token,
502
+ webhook_key=webhook_key or self.webhook_key,
483
503
  base_url=base_url or self.base_url,
484
504
  environment=environment or self._environment,
485
505
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -54,6 +54,10 @@ class APIResponseValidationError(APIError):
54
54
  self.status_code = response.status_code
55
55
 
56
56
 
57
+ class APIWebhookValidationError(APIError):
58
+ pass
59
+
60
+
57
61
  class APIStatusError(APIError):
58
62
  """Raised when an API response has a status code of 4xx or 5xx."""
59
63
 
dodopayments/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "dodopayments"
4
- __version__ = "1.55.7" # x-release-please-version
4
+ __version__ = "1.56.2" # x-release-please-version
@@ -21,6 +21,7 @@ from .._base_client import make_request_options
21
21
  from ..types.currency import Currency
22
22
  from ..types.payment_method_types import PaymentMethodTypes
23
23
  from ..types.customer_request_param import CustomerRequestParam
24
+ from ..types.checkout_session_status import CheckoutSessionStatus
24
25
  from ..types.checkout_session_response import CheckoutSessionResponse
25
26
 
26
27
  __all__ = ["CheckoutSessionsResource", "AsyncCheckoutSessionsResource"]
@@ -134,6 +135,37 @@ class CheckoutSessionsResource(SyncAPIResource):
134
135
  cast_to=CheckoutSessionResponse,
135
136
  )
136
137
 
138
+ def retrieve(
139
+ self,
140
+ id: str,
141
+ *,
142
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
143
+ # The extra values given here take precedence over values defined on the client or passed to this method.
144
+ extra_headers: Headers | None = None,
145
+ extra_query: Query | None = None,
146
+ extra_body: Body | None = None,
147
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
148
+ ) -> CheckoutSessionStatus:
149
+ """
150
+ Args:
151
+ extra_headers: Send extra headers
152
+
153
+ extra_query: Add additional query parameters to the request
154
+
155
+ extra_body: Add additional JSON properties to the request
156
+
157
+ timeout: Override the client-level default timeout for this request, in seconds
158
+ """
159
+ if not id:
160
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
161
+ return self._get(
162
+ f"/checkouts/{id}",
163
+ options=make_request_options(
164
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
165
+ ),
166
+ cast_to=CheckoutSessionStatus,
167
+ )
168
+
137
169
 
138
170
  class AsyncCheckoutSessionsResource(AsyncAPIResource):
139
171
  @cached_property
@@ -243,6 +275,37 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
243
275
  cast_to=CheckoutSessionResponse,
244
276
  )
245
277
 
278
+ async def retrieve(
279
+ self,
280
+ id: str,
281
+ *,
282
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
283
+ # The extra values given here take precedence over values defined on the client or passed to this method.
284
+ extra_headers: Headers | None = None,
285
+ extra_query: Query | None = None,
286
+ extra_body: Body | None = None,
287
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
288
+ ) -> CheckoutSessionStatus:
289
+ """
290
+ Args:
291
+ extra_headers: Send extra headers
292
+
293
+ extra_query: Add additional query parameters to the request
294
+
295
+ extra_body: Add additional JSON properties to the request
296
+
297
+ timeout: Override the client-level default timeout for this request, in seconds
298
+ """
299
+ if not id:
300
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
301
+ return await self._get(
302
+ f"/checkouts/{id}",
303
+ options=make_request_options(
304
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
305
+ ),
306
+ cast_to=CheckoutSessionStatus,
307
+ )
308
+
246
309
 
247
310
  class CheckoutSessionsResourceWithRawResponse:
248
311
  def __init__(self, checkout_sessions: CheckoutSessionsResource) -> None:
@@ -251,6 +314,9 @@ class CheckoutSessionsResourceWithRawResponse:
251
314
  self.create = to_raw_response_wrapper(
252
315
  checkout_sessions.create,
253
316
  )
317
+ self.retrieve = to_raw_response_wrapper(
318
+ checkout_sessions.retrieve,
319
+ )
254
320
 
255
321
 
256
322
  class AsyncCheckoutSessionsResourceWithRawResponse:
@@ -260,6 +326,9 @@ class AsyncCheckoutSessionsResourceWithRawResponse:
260
326
  self.create = async_to_raw_response_wrapper(
261
327
  checkout_sessions.create,
262
328
  )
329
+ self.retrieve = async_to_raw_response_wrapper(
330
+ checkout_sessions.retrieve,
331
+ )
263
332
 
264
333
 
265
334
  class CheckoutSessionsResourceWithStreamingResponse:
@@ -269,6 +338,9 @@ class CheckoutSessionsResourceWithStreamingResponse:
269
338
  self.create = to_streamed_response_wrapper(
270
339
  checkout_sessions.create,
271
340
  )
341
+ self.retrieve = to_streamed_response_wrapper(
342
+ checkout_sessions.retrieve,
343
+ )
272
344
 
273
345
 
274
346
  class AsyncCheckoutSessionsResourceWithStreamingResponse:
@@ -278,3 +350,6 @@ class AsyncCheckoutSessionsResourceWithStreamingResponse:
278
350
  self.create = async_to_streamed_response_wrapper(
279
351
  checkout_sessions.create,
280
352
  )
353
+ self.retrieve = async_to_streamed_response_wrapper(
354
+ checkout_sessions.retrieve,
355
+ )
@@ -206,6 +206,7 @@ class SubscriptionsResource(SyncAPIResource):
206
206
  *,
207
207
  billing: Optional[BillingAddressParam] | Omit = omit,
208
208
  cancel_at_next_billing_date: Optional[bool] | Omit = omit,
209
+ customer_name: Optional[str] | Omit = omit,
209
210
  disable_on_demand: Optional[subscription_update_params.DisableOnDemand] | Omit = omit,
210
211
  metadata: Optional[Dict[str, str]] | Omit = omit,
211
212
  next_billing_date: Union[str, datetime, None] | Omit = omit,
@@ -238,6 +239,7 @@ class SubscriptionsResource(SyncAPIResource):
238
239
  {
239
240
  "billing": billing,
240
241
  "cancel_at_next_billing_date": cancel_at_next_billing_date,
242
+ "customer_name": customer_name,
241
243
  "disable_on_demand": disable_on_demand,
242
244
  "metadata": metadata,
243
245
  "next_billing_date": next_billing_date,
@@ -702,6 +704,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
702
704
  *,
703
705
  billing: Optional[BillingAddressParam] | Omit = omit,
704
706
  cancel_at_next_billing_date: Optional[bool] | Omit = omit,
707
+ customer_name: Optional[str] | Omit = omit,
705
708
  disable_on_demand: Optional[subscription_update_params.DisableOnDemand] | Omit = omit,
706
709
  metadata: Optional[Dict[str, str]] | Omit = omit,
707
710
  next_billing_date: Union[str, datetime, None] | Omit = omit,
@@ -734,6 +737,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
734
737
  {
735
738
  "billing": billing,
736
739
  "cancel_at_next_billing_date": cancel_at_next_billing_date,
740
+ "customer_name": customer_name,
737
741
  "disable_on_demand": disable_on_demand,
738
742
  "metadata": metadata,
739
743
  "next_billing_date": next_billing_date,
@@ -2,7 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Optional
5
+ import json
6
+ from typing import Dict, List, Mapping, Optional, cast
6
7
 
7
8
  import httpx
8
9
 
@@ -18,6 +19,7 @@ from .headers import (
18
19
  from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
19
20
  from ..._utils import maybe_transform, async_maybe_transform
20
21
  from ..._compat import cached_property
22
+ from ..._models import construct_type
21
23
  from ..._resource import SyncAPIResource, AsyncAPIResource
22
24
  from ..._response import (
23
25
  to_raw_response_wrapper,
@@ -26,9 +28,12 @@ from ..._response import (
26
28
  async_to_streamed_response_wrapper,
27
29
  )
28
30
  from ...pagination import SyncCursorPagePagination, AsyncCursorPagePagination
31
+ from ..._exceptions import DodoPaymentsError
29
32
  from ..._base_client import AsyncPaginator, make_request_options
30
33
  from ...types.webhook_details import WebhookDetails
31
34
  from ...types.webhook_event_type import WebhookEventType
35
+ from ...types.unwrap_webhook_event import UnwrapWebhookEvent
36
+ from ...types.unsafe_unwrap_webhook_event import UnsafeUnwrapWebhookEvent
32
37
  from ...types.webhook_retrieve_secret_response import WebhookRetrieveSecretResponse
33
38
 
34
39
  __all__ = ["WebhooksResource", "AsyncWebhooksResource"]
@@ -336,6 +341,41 @@ class WebhooksResource(SyncAPIResource):
336
341
  cast_to=WebhookRetrieveSecretResponse,
337
342
  )
338
343
 
344
+ def unsafe_unwrap(self, payload: str) -> UnsafeUnwrapWebhookEvent:
345
+ return cast(
346
+ UnsafeUnwrapWebhookEvent,
347
+ construct_type(
348
+ type_=UnsafeUnwrapWebhookEvent,
349
+ value=json.loads(payload),
350
+ ),
351
+ )
352
+
353
+ def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None) -> UnwrapWebhookEvent:
354
+ try:
355
+ from standardwebhooks import Webhook
356
+ except ImportError as exc:
357
+ raise DodoPaymentsError("You need to install `dodopayments[webhooks]` to use this method") from exc
358
+
359
+ if key is None:
360
+ key = self._client.webhook_key
361
+ if key is None:
362
+ raise ValueError(
363
+ "Cannot verify a webhook without a key on either the client's webhook_key or passed in as an argument"
364
+ )
365
+
366
+ if not isinstance(headers, dict):
367
+ headers = dict(headers)
368
+
369
+ Webhook(key).verify(payload, headers)
370
+
371
+ return cast(
372
+ UnwrapWebhookEvent,
373
+ construct_type(
374
+ type_=UnwrapWebhookEvent,
375
+ value=json.loads(payload),
376
+ ),
377
+ )
378
+
339
379
 
340
380
  class AsyncWebhooksResource(AsyncAPIResource):
341
381
  @cached_property
@@ -639,6 +679,41 @@ class AsyncWebhooksResource(AsyncAPIResource):
639
679
  cast_to=WebhookRetrieveSecretResponse,
640
680
  )
641
681
 
682
+ def unsafe_unwrap(self, payload: str) -> UnsafeUnwrapWebhookEvent:
683
+ return cast(
684
+ UnsafeUnwrapWebhookEvent,
685
+ construct_type(
686
+ type_=UnsafeUnwrapWebhookEvent,
687
+ value=json.loads(payload),
688
+ ),
689
+ )
690
+
691
+ def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None) -> UnwrapWebhookEvent:
692
+ try:
693
+ from standardwebhooks import Webhook
694
+ except ImportError as exc:
695
+ raise DodoPaymentsError("You need to install `dodopayments[webhooks]` to use this method") from exc
696
+
697
+ if key is None:
698
+ key = self._client.webhook_key
699
+ if key is None:
700
+ raise ValueError(
701
+ "Cannot verify a webhook without a key on either the client's webhook_key or passed in as an argument"
702
+ )
703
+
704
+ if not isinstance(headers, dict):
705
+ headers = dict(headers)
706
+
707
+ Webhook(key).verify(payload, headers)
708
+
709
+ return cast(
710
+ UnwrapWebhookEvent,
711
+ construct_type(
712
+ type_=UnwrapWebhookEvent,
713
+ value=json.loads(payload),
714
+ ),
715
+ )
716
+
642
717
 
643
718
  class WebhooksResourceWithRawResponse:
644
719
  def __init__(self, webhooks: WebhooksResource) -> None:
@@ -60,6 +60,7 @@ from .payment_method_types import PaymentMethodTypes as PaymentMethodTypes
60
60
  from .payout_list_response import PayoutListResponse as PayoutListResponse
61
61
  from .refund_create_params import RefundCreateParams as RefundCreateParams
62
62
  from .refund_list_response import RefundListResponse as RefundListResponse
63
+ from .unwrap_webhook_event import UnwrapWebhookEvent as UnwrapWebhookEvent
63
64
  from .billing_address_param import BillingAddressParam as BillingAddressParam
64
65
  from .dispute_list_response import DisputeListResponse as DisputeListResponse
65
66
  from .payment_create_params import PaymentCreateParams as PaymentCreateParams
@@ -74,6 +75,7 @@ from .customer_request_param import CustomerRequestParam as CustomerRequestParam
74
75
  from .customer_update_params import CustomerUpdateParams as CustomerUpdateParams
75
76
  from .discount_create_params import DiscountCreateParams as DiscountCreateParams
76
77
  from .discount_update_params import DiscountUpdateParams as DiscountUpdateParams
78
+ from .checkout_session_status import CheckoutSessionStatus as CheckoutSessionStatus
77
79
  from .customer_portal_session import CustomerPortalSession as CustomerPortalSession
78
80
  from .license_activate_params import LicenseActivateParams as LicenseActivateParams
79
81
  from .license_key_list_params import LicenseKeyListParams as LicenseKeyListParams
@@ -86,11 +88,13 @@ from .addon_cart_response_item import AddonCartResponseItem as AddonCartResponse
86
88
  from .customer_limited_details import CustomerLimitedDetails as CustomerLimitedDetails
87
89
  from .subscription_list_params import SubscriptionListParams as SubscriptionListParams
88
90
  from .checkout_session_response import CheckoutSessionResponse as CheckoutSessionResponse
91
+ from .dispute_won_webhook_event import DisputeWonWebhookEvent as DisputeWonWebhookEvent
89
92
  from .license_activate_response import LicenseActivateResponse as LicenseActivateResponse
90
93
  from .license_deactivate_params import LicenseDeactivateParams as LicenseDeactivateParams
91
94
  from .license_key_update_params import LicenseKeyUpdateParams as LicenseKeyUpdateParams
92
95
  from .license_validate_response import LicenseValidateResponse as LicenseValidateResponse
93
96
  from .usage_event_ingest_params import UsageEventIngestParams as UsageEventIngestParams
97
+ from .dispute_lost_webhook_event import DisputeLostWebhookEvent as DisputeLostWebhookEvent
94
98
  from .license_key_duration_param import LicenseKeyDurationParam as LicenseKeyDurationParam
95
99
  from .one_time_product_cart_item import OneTimeProductCartItem as OneTimeProductCartItem
96
100
  from .subscription_charge_params import SubscriptionChargeParams as SubscriptionChargeParams
@@ -98,24 +102,46 @@ from .subscription_create_params import SubscriptionCreateParams as Subscription
98
102
  from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse
99
103
  from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams
100
104
  from .product_update_files_params import ProductUpdateFilesParams as ProductUpdateFilesParams
105
+ from .refund_failed_webhook_event import RefundFailedWebhookEvent as RefundFailedWebhookEvent
106
+ from .unsafe_unwrap_webhook_event import UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent
101
107
  from .usage_event_ingest_response import UsageEventIngestResponse as UsageEventIngestResponse
102
108
  from .addon_update_images_response import AddonUpdateImagesResponse as AddonUpdateImagesResponse
103
109
  from .brand_update_images_response import BrandUpdateImagesResponse as BrandUpdateImagesResponse
110
+ from .dispute_opened_webhook_event import DisputeOpenedWebhookEvent as DisputeOpenedWebhookEvent
104
111
  from .on_demand_subscription_param import OnDemandSubscriptionParam as OnDemandSubscriptionParam
112
+ from .payment_failed_webhook_event import PaymentFailedWebhookEvent as PaymentFailedWebhookEvent
105
113
  from .subscription_charge_response import SubscriptionChargeResponse as SubscriptionChargeResponse
106
114
  from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse
115
+ from .dispute_expired_webhook_event import DisputeExpiredWebhookEvent as DisputeExpiredWebhookEvent
107
116
  from .product_update_files_response import ProductUpdateFilesResponse as ProductUpdateFilesResponse
108
117
  from .attach_existing_customer_param import AttachExistingCustomerParam as AttachExistingCustomerParam
109
118
  from .checkout_session_create_params import CheckoutSessionCreateParams as CheckoutSessionCreateParams
119
+ from .dispute_accepted_webhook_event import DisputeAcceptedWebhookEvent as DisputeAcceptedWebhookEvent
120
+ from .refund_succeeded_webhook_event import RefundSucceededWebhookEvent as RefundSucceededWebhookEvent
121
+ from .dispute_cancelled_webhook_event import DisputeCancelledWebhookEvent as DisputeCancelledWebhookEvent
122
+ from .payment_cancelled_webhook_event import PaymentCancelledWebhookEvent as PaymentCancelledWebhookEvent
123
+ from .payment_succeeded_webhook_event import PaymentSucceededWebhookEvent as PaymentSucceededWebhookEvent
110
124
  from .subscription_change_plan_params import SubscriptionChangePlanParams as SubscriptionChangePlanParams
125
+ from .dispute_challenged_webhook_event import DisputeChallengedWebhookEvent as DisputeChallengedWebhookEvent
111
126
  from .license_key_instance_list_params import LicenseKeyInstanceListParams as LicenseKeyInstanceListParams
112
127
  from .one_time_product_cart_item_param import OneTimeProductCartItemParam as OneTimeProductCartItemParam
128
+ from .payment_processing_webhook_event import PaymentProcessingWebhookEvent as PaymentProcessingWebhookEvent
113
129
  from .webhook_retrieve_secret_response import WebhookRetrieveSecretResponse as WebhookRetrieveSecretResponse
130
+ from .license_key_created_webhook_event import LicenseKeyCreatedWebhookEvent as LicenseKeyCreatedWebhookEvent
131
+ from .subscription_active_webhook_event import SubscriptionActiveWebhookEvent as SubscriptionActiveWebhookEvent
132
+ from .subscription_failed_webhook_event import SubscriptionFailedWebhookEvent as SubscriptionFailedWebhookEvent
114
133
  from .license_key_instance_update_params import LicenseKeyInstanceUpdateParams as LicenseKeyInstanceUpdateParams
134
+ from .subscription_expired_webhook_event import SubscriptionExpiredWebhookEvent as SubscriptionExpiredWebhookEvent
135
+ from .subscription_on_hold_webhook_event import SubscriptionOnHoldWebhookEvent as SubscriptionOnHoldWebhookEvent
136
+ from .subscription_renewed_webhook_event import SubscriptionRenewedWebhookEvent as SubscriptionRenewedWebhookEvent
115
137
  from .payment_retrieve_line_items_response import PaymentRetrieveLineItemsResponse as PaymentRetrieveLineItemsResponse
138
+ from .subscription_cancelled_webhook_event import SubscriptionCancelledWebhookEvent as SubscriptionCancelledWebhookEvent
116
139
  from .misc_list_supported_countries_response import (
117
140
  MiscListSupportedCountriesResponse as MiscListSupportedCountriesResponse,
118
141
  )
142
+ from .subscription_plan_changed_webhook_event import (
143
+ SubscriptionPlanChangedWebhookEvent as SubscriptionPlanChangedWebhookEvent,
144
+ )
119
145
  from .subscription_retrieve_usage_history_params import (
120
146
  SubscriptionRetrieveUsageHistoryParams as SubscriptionRetrieveUsageHistoryParams,
121
147
  )
@@ -0,0 +1,35 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+
6
+ from .._models import BaseModel
7
+ from .intent_status import IntentStatus
8
+
9
+ __all__ = ["CheckoutSessionStatus"]
10
+
11
+
12
+ class CheckoutSessionStatus(BaseModel):
13
+ id: str
14
+ """Id of the checkout session"""
15
+
16
+ created_at: datetime
17
+ """Created at timestamp"""
18
+
19
+ customer_email: Optional[str] = None
20
+ """Customer email: prefers payment's customer, falls back to session"""
21
+
22
+ customer_name: Optional[str] = None
23
+ """Customer name: prefers payment's customer, falls back to session"""
24
+
25
+ payment_id: Optional[str] = None
26
+ """Id of the payment created by the checkout sessions.
27
+
28
+ Null if checkout sessions is still at the details collection stage.
29
+ """
30
+
31
+ payment_status: Optional[IntentStatus] = None
32
+ """status of the payment.
33
+
34
+ Null if checkout sessions is still at the details collection stage.
35
+ """
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .dispute import Dispute
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["DisputeAcceptedWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Dispute):
14
+ payload_type: Optional[Literal["Dispute"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class DisputeAcceptedWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["dispute.accepted"]
29
+ """The event type"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .dispute import Dispute
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["DisputeAcceptedWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Dispute):
14
+ payload_type: Optional[Literal["Dispute"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class DisputeAcceptedWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["dispute.accepted"]
29
+ """The event type"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .dispute import Dispute
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["DisputeCancelledWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Dispute):
14
+ payload_type: Optional[Literal["Dispute"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class DisputeCancelledWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["dispute.cancelled"]
29
+ """The event type"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .dispute import Dispute
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["DisputeCancelledWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Dispute):
14
+ payload_type: Optional[Literal["Dispute"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class DisputeCancelledWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["dispute.cancelled"]
29
+ """The event type"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .dispute import Dispute
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["DisputeChallengedWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Dispute):
14
+ payload_type: Optional[Literal["Dispute"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class DisputeChallengedWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["dispute.challenged"]
29
+ """The event type"""