dodopayments 1.51.1__py3-none-any.whl → 1.56.5__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.
Files changed (139) hide show
  1. dodopayments/__init__.py +5 -1
  2. dodopayments/_base_client.py +12 -12
  3. dodopayments/_client.py +52 -14
  4. dodopayments/_compat.py +48 -48
  5. dodopayments/_exceptions.py +4 -0
  6. dodopayments/_models.py +50 -44
  7. dodopayments/_qs.py +7 -7
  8. dodopayments/_streaming.py +4 -6
  9. dodopayments/_types.py +18 -11
  10. dodopayments/_utils/__init__.py +8 -2
  11. dodopayments/_utils/_compat.py +45 -0
  12. dodopayments/_utils/_datetime_parse.py +136 -0
  13. dodopayments/_utils/_transform.py +13 -3
  14. dodopayments/_utils/_typing.py +1 -1
  15. dodopayments/_utils/_utils.py +5 -6
  16. dodopayments/_version.py +1 -1
  17. dodopayments/resources/__init__.py +28 -0
  18. dodopayments/resources/addons.py +29 -29
  19. dodopayments/resources/brands.py +29 -29
  20. dodopayments/resources/checkout_sessions.py +110 -27
  21. dodopayments/resources/customers/__init__.py +14 -0
  22. dodopayments/resources/customers/customer_portal.py +5 -5
  23. dodopayments/resources/customers/customers.py +53 -21
  24. dodopayments/resources/customers/wallets/__init__.py +33 -0
  25. dodopayments/resources/customers/wallets/ledger_entries.py +318 -0
  26. dodopayments/resources/customers/wallets/wallets.py +191 -0
  27. dodopayments/resources/discounts.py +44 -44
  28. dodopayments/resources/disputes.py +19 -19
  29. dodopayments/resources/invoices/payments.py +83 -3
  30. dodopayments/resources/license_key_instances.py +13 -13
  31. dodopayments/resources/license_keys.py +23 -23
  32. dodopayments/resources/licenses.py +14 -14
  33. dodopayments/resources/meters.py +554 -0
  34. dodopayments/resources/misc.py +3 -3
  35. dodopayments/resources/payments.py +49 -41
  36. dodopayments/resources/payouts.py +26 -7
  37. dodopayments/resources/products/images.py +5 -5
  38. dodopayments/resources/products/products.py +82 -82
  39. dodopayments/resources/refunds.py +39 -30
  40. dodopayments/resources/subscriptions.py +316 -73
  41. dodopayments/resources/usage_events.py +597 -0
  42. dodopayments/resources/webhooks/headers.py +5 -5
  43. dodopayments/resources/webhooks/webhooks.py +119 -44
  44. dodopayments/types/__init__.py +48 -0
  45. dodopayments/types/add_meter_to_price.py +29 -0
  46. dodopayments/types/add_meter_to_price_param.py +30 -0
  47. dodopayments/types/checkout_session_create_params.py +6 -0
  48. dodopayments/types/checkout_session_status.py +35 -0
  49. dodopayments/types/customer_limited_details.py +5 -0
  50. dodopayments/types/customers/__init__.py +2 -0
  51. dodopayments/types/customers/customer_wallet.py +20 -0
  52. dodopayments/types/customers/wallet_list_response.py +15 -0
  53. dodopayments/types/customers/wallets/__init__.py +7 -0
  54. dodopayments/types/customers/wallets/customer_wallet_transaction.py +38 -0
  55. dodopayments/types/customers/wallets/ledger_entry_create_params.py +25 -0
  56. dodopayments/types/customers/wallets/ledger_entry_list_params.py +18 -0
  57. dodopayments/types/discount_create_params.py +3 -2
  58. dodopayments/types/discount_update_params.py +3 -2
  59. dodopayments/types/dispute_accepted_webhook_event.py +29 -0
  60. dodopayments/types/dispute_accepted_webhook_event1.py +29 -0
  61. dodopayments/types/dispute_cancelled_webhook_event.py +29 -0
  62. dodopayments/types/dispute_cancelled_webhook_event1.py +29 -0
  63. dodopayments/types/dispute_challenged_webhook_event.py +29 -0
  64. dodopayments/types/dispute_challenged_webhook_event1.py +29 -0
  65. dodopayments/types/dispute_expired_webhook_event.py +29 -0
  66. dodopayments/types/dispute_expired_webhook_event1.py +29 -0
  67. dodopayments/types/dispute_lost_webhook_event.py +29 -0
  68. dodopayments/types/dispute_lost_webhook_event1.py +29 -0
  69. dodopayments/types/dispute_opened_webhook_event.py +29 -0
  70. dodopayments/types/dispute_opened_webhook_event1.py +29 -0
  71. dodopayments/types/dispute_won_webhook_event.py +29 -0
  72. dodopayments/types/dispute_won_webhook_event1.py +29 -0
  73. dodopayments/types/event.py +26 -0
  74. dodopayments/types/event_input_param.py +38 -0
  75. dodopayments/types/license_activate_response.py +40 -0
  76. dodopayments/types/license_key_created_webhook_event.py +29 -0
  77. dodopayments/types/license_key_created_webhook_event1.py +29 -0
  78. dodopayments/types/meter.py +40 -0
  79. dodopayments/types/meter_aggregation.py +16 -0
  80. dodopayments/types/meter_aggregation_param.py +16 -0
  81. dodopayments/types/meter_create_params.py +31 -0
  82. dodopayments/types/meter_filter.py +131 -0
  83. dodopayments/types/meter_filter_param.py +143 -0
  84. dodopayments/types/meter_list_params.py +18 -0
  85. dodopayments/types/new_customer_param.py +7 -1
  86. dodopayments/types/payment.py +37 -2
  87. dodopayments/types/payment_cancelled_webhook_event.py +29 -0
  88. dodopayments/types/payment_cancelled_webhook_event1.py +29 -0
  89. dodopayments/types/payment_create_params.py +3 -0
  90. dodopayments/types/payment_failed_webhook_event.py +29 -0
  91. dodopayments/types/payment_failed_webhook_event1.py +29 -0
  92. dodopayments/types/payment_method_types.py +1 -0
  93. dodopayments/types/payment_processing_webhook_event.py +29 -0
  94. dodopayments/types/payment_processing_webhook_event1.py +29 -0
  95. dodopayments/types/payment_succeeded_webhook_event.py +29 -0
  96. dodopayments/types/payment_succeeded_webhook_event1.py +29 -0
  97. dodopayments/types/payout_list_params.py +11 -1
  98. dodopayments/types/price.py +52 -5
  99. dodopayments/types/price_param.py +52 -5
  100. dodopayments/types/product_create_params.py +3 -2
  101. dodopayments/types/product_update_params.py +4 -3
  102. dodopayments/types/refund.py +8 -1
  103. dodopayments/types/refund_create_params.py +4 -1
  104. dodopayments/types/refund_failed_webhook_event.py +29 -0
  105. dodopayments/types/refund_failed_webhook_event1.py +29 -0
  106. dodopayments/types/refund_list_response.py +39 -0
  107. dodopayments/types/refund_succeeded_webhook_event.py +29 -0
  108. dodopayments/types/refund_succeeded_webhook_event1.py +29 -0
  109. dodopayments/types/subscription.py +23 -1
  110. dodopayments/types/subscription_active_webhook_event.py +29 -0
  111. dodopayments/types/subscription_active_webhook_event1.py +29 -0
  112. dodopayments/types/subscription_cancelled_webhook_event.py +29 -0
  113. dodopayments/types/subscription_cancelled_webhook_event1.py +29 -0
  114. dodopayments/types/subscription_charge_params.py +12 -1
  115. dodopayments/types/subscription_create_params.py +3 -0
  116. dodopayments/types/subscription_expired_webhook_event.py +29 -0
  117. dodopayments/types/subscription_expired_webhook_event1.py +29 -0
  118. dodopayments/types/subscription_failed_webhook_event.py +29 -0
  119. dodopayments/types/subscription_failed_webhook_event1.py +29 -0
  120. dodopayments/types/subscription_list_response.py +3 -0
  121. dodopayments/types/subscription_on_hold_webhook_event.py +29 -0
  122. dodopayments/types/subscription_on_hold_webhook_event1.py +29 -0
  123. dodopayments/types/subscription_plan_changed_webhook_event.py +29 -0
  124. dodopayments/types/subscription_plan_changed_webhook_event1.py +29 -0
  125. dodopayments/types/subscription_renewed_webhook_event.py +29 -0
  126. dodopayments/types/subscription_renewed_webhook_event1.py +29 -0
  127. dodopayments/types/subscription_retrieve_usage_history_params.py +28 -0
  128. dodopayments/types/subscription_retrieve_usage_history_response.py +46 -0
  129. dodopayments/types/subscription_update_params.py +2 -0
  130. dodopayments/types/unsafe_unwrap_webhook_event.py +52 -0
  131. dodopayments/types/unwrap_webhook_event.py +52 -0
  132. dodopayments/types/usage_event_ingest_params.py +15 -0
  133. dodopayments/types/usage_event_ingest_response.py +9 -0
  134. dodopayments/types/usage_event_list_params.py +42 -0
  135. {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/METADATA +6 -4
  136. dodopayments-1.56.5.dist-info/RECORD +239 -0
  137. dodopayments-1.51.1.dist-info/RECORD +0 -163
  138. {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/WHEEL +0 -0
  139. {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/licenses/LICENSE +0 -0
@@ -21,8 +21,7 @@ from typing_extensions import TypeGuard
21
21
 
22
22
  import sniffio
23
23
 
24
- from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
25
- from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
24
+ from .._types import Omit, NotGiven, FileTypes, HeadersLike
26
25
 
27
26
  _T = TypeVar("_T")
28
27
  _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
@@ -64,7 +63,7 @@ def _extract_items(
64
63
  try:
65
64
  key = path[index]
66
65
  except IndexError:
67
- if isinstance(obj, NotGiven):
66
+ if not is_given(obj):
68
67
  # no value was provided - we can safely ignore
69
68
  return []
70
69
 
@@ -127,14 +126,14 @@ def _extract_items(
127
126
  return []
128
127
 
129
128
 
130
- def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]:
131
- return not isinstance(obj, NotGiven)
129
+ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
130
+ return not isinstance(obj, NotGiven) and not isinstance(obj, Omit)
132
131
 
133
132
 
134
133
  # Type safe methods for narrowing types with TypeVars.
135
134
  # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
136
135
  # however this cause Pyright to rightfully report errors. As we know we don't
137
- # care about the contained types we can safely use `object` in it's place.
136
+ # care about the contained types we can safely use `object` in its place.
138
137
  #
139
138
  # There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
140
139
  # `is_*` is for when you're dealing with an unknown input
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.51.1" # x-release-please-version
4
+ __version__ = "1.56.5" # x-release-please-version
@@ -24,6 +24,14 @@ from .brands import (
24
24
  BrandsResourceWithStreamingResponse,
25
25
  AsyncBrandsResourceWithStreamingResponse,
26
26
  )
27
+ from .meters import (
28
+ MetersResource,
29
+ AsyncMetersResource,
30
+ MetersResourceWithRawResponse,
31
+ AsyncMetersResourceWithRawResponse,
32
+ MetersResourceWithStreamingResponse,
33
+ AsyncMetersResourceWithStreamingResponse,
34
+ )
27
35
  from .payouts import (
28
36
  PayoutsResource,
29
37
  AsyncPayoutsResource,
@@ -112,6 +120,14 @@ from .license_keys import (
112
120
  LicenseKeysResourceWithStreamingResponse,
113
121
  AsyncLicenseKeysResourceWithStreamingResponse,
114
122
  )
123
+ from .usage_events import (
124
+ UsageEventsResource,
125
+ AsyncUsageEventsResource,
126
+ UsageEventsResourceWithRawResponse,
127
+ AsyncUsageEventsResourceWithRawResponse,
128
+ UsageEventsResourceWithStreamingResponse,
129
+ AsyncUsageEventsResourceWithStreamingResponse,
130
+ )
115
131
  from .subscriptions import (
116
132
  SubscriptionsResource,
117
133
  AsyncSubscriptionsResource,
@@ -240,4 +256,16 @@ __all__ = [
240
256
  "AsyncWebhooksResourceWithRawResponse",
241
257
  "WebhooksResourceWithStreamingResponse",
242
258
  "AsyncWebhooksResourceWithStreamingResponse",
259
+ "UsageEventsResource",
260
+ "AsyncUsageEventsResource",
261
+ "UsageEventsResourceWithRawResponse",
262
+ "AsyncUsageEventsResourceWithRawResponse",
263
+ "UsageEventsResourceWithStreamingResponse",
264
+ "AsyncUsageEventsResourceWithStreamingResponse",
265
+ "MetersResource",
266
+ "AsyncMetersResource",
267
+ "MetersResourceWithRawResponse",
268
+ "AsyncMetersResourceWithRawResponse",
269
+ "MetersResourceWithStreamingResponse",
270
+ "AsyncMetersResourceWithStreamingResponse",
243
271
  ]
@@ -7,7 +7,7 @@ from typing import Optional
7
7
  import httpx
8
8
 
9
9
  from ..types import Currency, TaxCategory, addon_list_params, addon_create_params, addon_update_params
10
- from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
11
  from .._utils import maybe_transform, async_maybe_transform
12
12
  from .._compat import cached_property
13
13
  from .._resource import SyncAPIResource, AsyncAPIResource
@@ -54,13 +54,13 @@ class AddonsResource(SyncAPIResource):
54
54
  name: str,
55
55
  price: int,
56
56
  tax_category: TaxCategory,
57
- description: Optional[str] | NotGiven = NOT_GIVEN,
57
+ description: Optional[str] | Omit = omit,
58
58
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
59
59
  # The extra values given here take precedence over values defined on the client or passed to this method.
60
60
  extra_headers: Headers | None = None,
61
61
  extra_query: Query | None = None,
62
62
  extra_body: Body | None = None,
63
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
63
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
64
64
  ) -> AddonResponse:
65
65
  """
66
66
  Args:
@@ -109,7 +109,7 @@ class AddonsResource(SyncAPIResource):
109
109
  extra_headers: Headers | None = None,
110
110
  extra_query: Query | None = None,
111
111
  extra_body: Body | None = None,
112
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
112
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
113
113
  ) -> AddonResponse:
114
114
  """
115
115
  Args:
@@ -135,18 +135,18 @@ class AddonsResource(SyncAPIResource):
135
135
  self,
136
136
  id: str,
137
137
  *,
138
- currency: Optional[Currency] | NotGiven = NOT_GIVEN,
139
- description: Optional[str] | NotGiven = NOT_GIVEN,
140
- image_id: Optional[str] | NotGiven = NOT_GIVEN,
141
- name: Optional[str] | NotGiven = NOT_GIVEN,
142
- price: Optional[int] | NotGiven = NOT_GIVEN,
143
- tax_category: Optional[TaxCategory] | NotGiven = NOT_GIVEN,
138
+ currency: Optional[Currency] | Omit = omit,
139
+ description: Optional[str] | Omit = omit,
140
+ image_id: Optional[str] | Omit = omit,
141
+ name: Optional[str] | Omit = omit,
142
+ price: Optional[int] | Omit = omit,
143
+ tax_category: Optional[TaxCategory] | Omit = omit,
144
144
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
145
145
  # The extra values given here take precedence over values defined on the client or passed to this method.
146
146
  extra_headers: Headers | None = None,
147
147
  extra_query: Query | None = None,
148
148
  extra_body: Body | None = None,
149
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
149
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
150
150
  ) -> AddonResponse:
151
151
  """
152
152
  Args:
@@ -194,14 +194,14 @@ class AddonsResource(SyncAPIResource):
194
194
  def list(
195
195
  self,
196
196
  *,
197
- page_number: int | NotGiven = NOT_GIVEN,
198
- page_size: int | NotGiven = NOT_GIVEN,
197
+ page_number: int | Omit = omit,
198
+ page_size: int | Omit = omit,
199
199
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
200
200
  # The extra values given here take precedence over values defined on the client or passed to this method.
201
201
  extra_headers: Headers | None = None,
202
202
  extra_query: Query | None = None,
203
203
  extra_body: Body | None = None,
204
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
204
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
205
205
  ) -> SyncDefaultPageNumberPagination[AddonResponse]:
206
206
  """
207
207
  Args:
@@ -245,7 +245,7 @@ class AddonsResource(SyncAPIResource):
245
245
  extra_headers: Headers | None = None,
246
246
  extra_query: Query | None = None,
247
247
  extra_body: Body | None = None,
248
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
248
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
249
249
  ) -> AddonUpdateImagesResponse:
250
250
  """
251
251
  Args:
@@ -295,13 +295,13 @@ class AsyncAddonsResource(AsyncAPIResource):
295
295
  name: str,
296
296
  price: int,
297
297
  tax_category: TaxCategory,
298
- description: Optional[str] | NotGiven = NOT_GIVEN,
298
+ description: Optional[str] | Omit = omit,
299
299
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
300
300
  # The extra values given here take precedence over values defined on the client or passed to this method.
301
301
  extra_headers: Headers | None = None,
302
302
  extra_query: Query | None = None,
303
303
  extra_body: Body | None = None,
304
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
304
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
305
305
  ) -> AddonResponse:
306
306
  """
307
307
  Args:
@@ -350,7 +350,7 @@ class AsyncAddonsResource(AsyncAPIResource):
350
350
  extra_headers: Headers | None = None,
351
351
  extra_query: Query | None = None,
352
352
  extra_body: Body | None = None,
353
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
353
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
354
354
  ) -> AddonResponse:
355
355
  """
356
356
  Args:
@@ -376,18 +376,18 @@ class AsyncAddonsResource(AsyncAPIResource):
376
376
  self,
377
377
  id: str,
378
378
  *,
379
- currency: Optional[Currency] | NotGiven = NOT_GIVEN,
380
- description: Optional[str] | NotGiven = NOT_GIVEN,
381
- image_id: Optional[str] | NotGiven = NOT_GIVEN,
382
- name: Optional[str] | NotGiven = NOT_GIVEN,
383
- price: Optional[int] | NotGiven = NOT_GIVEN,
384
- tax_category: Optional[TaxCategory] | NotGiven = NOT_GIVEN,
379
+ currency: Optional[Currency] | Omit = omit,
380
+ description: Optional[str] | Omit = omit,
381
+ image_id: Optional[str] | Omit = omit,
382
+ name: Optional[str] | Omit = omit,
383
+ price: Optional[int] | Omit = omit,
384
+ tax_category: Optional[TaxCategory] | Omit = omit,
385
385
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
386
386
  # The extra values given here take precedence over values defined on the client or passed to this method.
387
387
  extra_headers: Headers | None = None,
388
388
  extra_query: Query | None = None,
389
389
  extra_body: Body | None = None,
390
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
390
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
391
391
  ) -> AddonResponse:
392
392
  """
393
393
  Args:
@@ -435,14 +435,14 @@ class AsyncAddonsResource(AsyncAPIResource):
435
435
  def list(
436
436
  self,
437
437
  *,
438
- page_number: int | NotGiven = NOT_GIVEN,
439
- page_size: int | NotGiven = NOT_GIVEN,
438
+ page_number: int | Omit = omit,
439
+ page_size: int | Omit = omit,
440
440
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
441
441
  # The extra values given here take precedence over values defined on the client or passed to this method.
442
442
  extra_headers: Headers | None = None,
443
443
  extra_query: Query | None = None,
444
444
  extra_body: Body | None = None,
445
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
445
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
446
446
  ) -> AsyncPaginator[AddonResponse, AsyncDefaultPageNumberPagination[AddonResponse]]:
447
447
  """
448
448
  Args:
@@ -486,7 +486,7 @@ class AsyncAddonsResource(AsyncAPIResource):
486
486
  extra_headers: Headers | None = None,
487
487
  extra_query: Query | None = None,
488
488
  extra_body: Body | None = None,
489
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
489
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
490
490
  ) -> AddonUpdateImagesResponse:
491
491
  """
492
492
  Args:
@@ -7,7 +7,7 @@ from typing import Optional
7
7
  import httpx
8
8
 
9
9
  from ..types import brand_create_params, brand_update_params
10
- from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
11
  from .._utils import maybe_transform, async_maybe_transform
12
12
  from .._compat import cached_property
13
13
  from .._resource import SyncAPIResource, AsyncAPIResource
@@ -48,17 +48,17 @@ class BrandsResource(SyncAPIResource):
48
48
  def create(
49
49
  self,
50
50
  *,
51
- description: Optional[str] | NotGiven = NOT_GIVEN,
52
- name: Optional[str] | NotGiven = NOT_GIVEN,
53
- statement_descriptor: Optional[str] | NotGiven = NOT_GIVEN,
54
- support_email: Optional[str] | NotGiven = NOT_GIVEN,
55
- url: Optional[str] | NotGiven = NOT_GIVEN,
51
+ description: Optional[str] | Omit = omit,
52
+ name: Optional[str] | Omit = omit,
53
+ statement_descriptor: Optional[str] | Omit = omit,
54
+ support_email: Optional[str] | Omit = omit,
55
+ url: Optional[str] | Omit = omit,
56
56
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
57
57
  # The extra values given here take precedence over values defined on the client or passed to this method.
58
58
  extra_headers: Headers | None = None,
59
59
  extra_query: Query | None = None,
60
60
  extra_body: Body | None = None,
61
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
61
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
62
62
  ) -> Brand:
63
63
  """
64
64
  Args:
@@ -97,7 +97,7 @@ class BrandsResource(SyncAPIResource):
97
97
  extra_headers: Headers | None = None,
98
98
  extra_query: Query | None = None,
99
99
  extra_body: Body | None = None,
100
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
100
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
101
101
  ) -> Brand:
102
102
  """
103
103
  Thin handler just calls `get_brand` and wraps in `Json(...)`
@@ -125,16 +125,16 @@ class BrandsResource(SyncAPIResource):
125
125
  self,
126
126
  id: str,
127
127
  *,
128
- image_id: Optional[str] | NotGiven = NOT_GIVEN,
129
- name: Optional[str] | NotGiven = NOT_GIVEN,
130
- statement_descriptor: Optional[str] | NotGiven = NOT_GIVEN,
131
- support_email: Optional[str] | NotGiven = NOT_GIVEN,
128
+ image_id: Optional[str] | Omit = omit,
129
+ name: Optional[str] | Omit = omit,
130
+ statement_descriptor: Optional[str] | Omit = omit,
131
+ support_email: Optional[str] | Omit = omit,
132
132
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
133
133
  # The extra values given here take precedence over values defined on the client or passed to this method.
134
134
  extra_headers: Headers | None = None,
135
135
  extra_query: Query | None = None,
136
136
  extra_body: Body | None = None,
137
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
137
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
138
138
  ) -> Brand:
139
139
  """
140
140
  Args:
@@ -175,7 +175,7 @@ class BrandsResource(SyncAPIResource):
175
175
  extra_headers: Headers | None = None,
176
176
  extra_query: Query | None = None,
177
177
  extra_body: Body | None = None,
178
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
178
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
179
179
  ) -> BrandListResponse:
180
180
  return self._get(
181
181
  "/brands",
@@ -194,7 +194,7 @@ class BrandsResource(SyncAPIResource):
194
194
  extra_headers: Headers | None = None,
195
195
  extra_query: Query | None = None,
196
196
  extra_body: Body | None = None,
197
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
197
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
198
198
  ) -> BrandUpdateImagesResponse:
199
199
  """
200
200
  Args:
@@ -240,17 +240,17 @@ class AsyncBrandsResource(AsyncAPIResource):
240
240
  async def create(
241
241
  self,
242
242
  *,
243
- description: Optional[str] | NotGiven = NOT_GIVEN,
244
- name: Optional[str] | NotGiven = NOT_GIVEN,
245
- statement_descriptor: Optional[str] | NotGiven = NOT_GIVEN,
246
- support_email: Optional[str] | NotGiven = NOT_GIVEN,
247
- url: Optional[str] | NotGiven = NOT_GIVEN,
243
+ description: Optional[str] | Omit = omit,
244
+ name: Optional[str] | Omit = omit,
245
+ statement_descriptor: Optional[str] | Omit = omit,
246
+ support_email: Optional[str] | Omit = omit,
247
+ url: Optional[str] | Omit = omit,
248
248
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
249
249
  # The extra values given here take precedence over values defined on the client or passed to this method.
250
250
  extra_headers: Headers | None = None,
251
251
  extra_query: Query | None = None,
252
252
  extra_body: Body | None = None,
253
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
253
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
254
254
  ) -> Brand:
255
255
  """
256
256
  Args:
@@ -289,7 +289,7 @@ class AsyncBrandsResource(AsyncAPIResource):
289
289
  extra_headers: Headers | None = None,
290
290
  extra_query: Query | None = None,
291
291
  extra_body: Body | None = None,
292
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
292
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
293
293
  ) -> Brand:
294
294
  """
295
295
  Thin handler just calls `get_brand` and wraps in `Json(...)`
@@ -317,16 +317,16 @@ class AsyncBrandsResource(AsyncAPIResource):
317
317
  self,
318
318
  id: str,
319
319
  *,
320
- image_id: Optional[str] | NotGiven = NOT_GIVEN,
321
- name: Optional[str] | NotGiven = NOT_GIVEN,
322
- statement_descriptor: Optional[str] | NotGiven = NOT_GIVEN,
323
- support_email: Optional[str] | NotGiven = NOT_GIVEN,
320
+ image_id: Optional[str] | Omit = omit,
321
+ name: Optional[str] | Omit = omit,
322
+ statement_descriptor: Optional[str] | Omit = omit,
323
+ support_email: Optional[str] | Omit = omit,
324
324
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
325
325
  # The extra values given here take precedence over values defined on the client or passed to this method.
326
326
  extra_headers: Headers | None = None,
327
327
  extra_query: Query | None = None,
328
328
  extra_body: Body | None = None,
329
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
329
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
330
330
  ) -> Brand:
331
331
  """
332
332
  Args:
@@ -367,7 +367,7 @@ class AsyncBrandsResource(AsyncAPIResource):
367
367
  extra_headers: Headers | None = None,
368
368
  extra_query: Query | None = None,
369
369
  extra_body: Body | None = None,
370
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
370
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
371
371
  ) -> BrandListResponse:
372
372
  return await self._get(
373
373
  "/brands",
@@ -386,7 +386,7 @@ class AsyncBrandsResource(AsyncAPIResource):
386
386
  extra_headers: Headers | None = None,
387
387
  extra_query: Query | None = None,
388
388
  extra_body: Body | None = None,
389
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
389
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
390
390
  ) -> BrandUpdateImagesResponse:
391
391
  """
392
392
  Args:
@@ -7,7 +7,7 @@ from typing import Dict, List, Iterable, Optional
7
7
  import httpx
8
8
 
9
9
  from ..types import Currency, checkout_session_create_params
10
- from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
11
  from .._utils import maybe_transform, async_maybe_transform
12
12
  from .._compat import cached_property
13
13
  from .._resource import SyncAPIResource, AsyncAPIResource
@@ -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"]
@@ -50,24 +51,25 @@ class CheckoutSessionsResource(SyncAPIResource):
50
51
  self,
51
52
  *,
52
53
  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,
54
+ allowed_payment_method_types: Optional[List[PaymentMethodTypes]] | Omit = omit,
55
+ billing_address: Optional[checkout_session_create_params.BillingAddress] | Omit = omit,
56
+ billing_currency: Optional[Currency] | Omit = omit,
57
+ confirm: bool | Omit = omit,
58
+ customer: Optional[CustomerRequestParam] | Omit = omit,
59
+ customization: checkout_session_create_params.Customization | Omit = omit,
60
+ discount_code: Optional[str] | Omit = omit,
61
+ feature_flags: checkout_session_create_params.FeatureFlags | Omit = omit,
62
+ force_3ds: Optional[bool] | Omit = omit,
63
+ metadata: Optional[Dict[str, str]] | Omit = omit,
64
+ return_url: Optional[str] | Omit = omit,
65
+ show_saved_payment_methods: bool | Omit = omit,
66
+ subscription_data: Optional[checkout_session_create_params.SubscriptionData] | Omit = omit,
65
67
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
66
68
  # The extra values given here take precedence over values defined on the client or passed to this method.
67
69
  extra_headers: Headers | None = None,
68
70
  extra_query: Query | None = None,
69
71
  extra_body: Body | None = None,
70
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
72
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
71
73
  ) -> CheckoutSessionResponse:
72
74
  """
73
75
  Args:
@@ -89,6 +91,8 @@ class CheckoutSessionsResource(SyncAPIResource):
89
91
 
90
92
  customization: Customization for the checkout session page
91
93
 
94
+ force_3ds: Override merchant default 3DS behaviour for this session
95
+
92
96
  metadata: Additional metadata associated with the payment. Defaults to empty if not
93
97
  provided.
94
98
 
@@ -117,6 +121,7 @@ class CheckoutSessionsResource(SyncAPIResource):
117
121
  "customization": customization,
118
122
  "discount_code": discount_code,
119
123
  "feature_flags": feature_flags,
124
+ "force_3ds": force_3ds,
120
125
  "metadata": metadata,
121
126
  "return_url": return_url,
122
127
  "show_saved_payment_methods": show_saved_payment_methods,
@@ -130,6 +135,37 @@ class CheckoutSessionsResource(SyncAPIResource):
130
135
  cast_to=CheckoutSessionResponse,
131
136
  )
132
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
+
133
169
 
134
170
  class AsyncCheckoutSessionsResource(AsyncAPIResource):
135
171
  @cached_property
@@ -155,24 +191,25 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
155
191
  self,
156
192
  *,
157
193
  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,
194
+ allowed_payment_method_types: Optional[List[PaymentMethodTypes]] | Omit = omit,
195
+ billing_address: Optional[checkout_session_create_params.BillingAddress] | Omit = omit,
196
+ billing_currency: Optional[Currency] | Omit = omit,
197
+ confirm: bool | Omit = omit,
198
+ customer: Optional[CustomerRequestParam] | Omit = omit,
199
+ customization: checkout_session_create_params.Customization | Omit = omit,
200
+ discount_code: Optional[str] | Omit = omit,
201
+ feature_flags: checkout_session_create_params.FeatureFlags | Omit = omit,
202
+ force_3ds: Optional[bool] | Omit = omit,
203
+ metadata: Optional[Dict[str, str]] | Omit = omit,
204
+ return_url: Optional[str] | Omit = omit,
205
+ show_saved_payment_methods: bool | Omit = omit,
206
+ subscription_data: Optional[checkout_session_create_params.SubscriptionData] | Omit = omit,
170
207
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
171
208
  # The extra values given here take precedence over values defined on the client or passed to this method.
172
209
  extra_headers: Headers | None = None,
173
210
  extra_query: Query | None = None,
174
211
  extra_body: Body | None = None,
175
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
212
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
176
213
  ) -> CheckoutSessionResponse:
177
214
  """
178
215
  Args:
@@ -194,6 +231,8 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
194
231
 
195
232
  customization: Customization for the checkout session page
196
233
 
234
+ force_3ds: Override merchant default 3DS behaviour for this session
235
+
197
236
  metadata: Additional metadata associated with the payment. Defaults to empty if not
198
237
  provided.
199
238
 
@@ -222,6 +261,7 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
222
261
  "customization": customization,
223
262
  "discount_code": discount_code,
224
263
  "feature_flags": feature_flags,
264
+ "force_3ds": force_3ds,
225
265
  "metadata": metadata,
226
266
  "return_url": return_url,
227
267
  "show_saved_payment_methods": show_saved_payment_methods,
@@ -235,6 +275,37 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
235
275
  cast_to=CheckoutSessionResponse,
236
276
  )
237
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
+
238
309
 
239
310
  class CheckoutSessionsResourceWithRawResponse:
240
311
  def __init__(self, checkout_sessions: CheckoutSessionsResource) -> None:
@@ -243,6 +314,9 @@ class CheckoutSessionsResourceWithRawResponse:
243
314
  self.create = to_raw_response_wrapper(
244
315
  checkout_sessions.create,
245
316
  )
317
+ self.retrieve = to_raw_response_wrapper(
318
+ checkout_sessions.retrieve,
319
+ )
246
320
 
247
321
 
248
322
  class AsyncCheckoutSessionsResourceWithRawResponse:
@@ -252,6 +326,9 @@ class AsyncCheckoutSessionsResourceWithRawResponse:
252
326
  self.create = async_to_raw_response_wrapper(
253
327
  checkout_sessions.create,
254
328
  )
329
+ self.retrieve = async_to_raw_response_wrapper(
330
+ checkout_sessions.retrieve,
331
+ )
255
332
 
256
333
 
257
334
  class CheckoutSessionsResourceWithStreamingResponse:
@@ -261,6 +338,9 @@ class CheckoutSessionsResourceWithStreamingResponse:
261
338
  self.create = to_streamed_response_wrapper(
262
339
  checkout_sessions.create,
263
340
  )
341
+ self.retrieve = to_streamed_response_wrapper(
342
+ checkout_sessions.retrieve,
343
+ )
264
344
 
265
345
 
266
346
  class AsyncCheckoutSessionsResourceWithStreamingResponse:
@@ -270,3 +350,6 @@ class AsyncCheckoutSessionsResourceWithStreamingResponse:
270
350
  self.create = async_to_streamed_response_wrapper(
271
351
  checkout_sessions.create,
272
352
  )
353
+ self.retrieve = async_to_streamed_response_wrapper(
354
+ checkout_sessions.retrieve,
355
+ )