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
@@ -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 .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentSucceededWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentSucceededWebhookEvent(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["payment.succeeded"]
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 .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentSucceededWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentSucceededWebhookEvent(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["payment.succeeded"]
29
+ """The event type"""
@@ -2,12 +2,22 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing_extensions import TypedDict
5
+ from typing import Union
6
+ from datetime import datetime
7
+ from typing_extensions import Annotated, TypedDict
8
+
9
+ from .._utils import PropertyInfo
6
10
 
7
11
  __all__ = ["PayoutListParams"]
8
12
 
9
13
 
10
14
  class PayoutListParams(TypedDict, total=False):
15
+ created_at_gte: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
16
+ """Get payouts created after this time (inclusive)"""
17
+
18
+ created_at_lte: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
19
+ """Get payouts created before this time (inclusive)"""
20
+
11
21
  page_number: int
12
22
  """Page number default is 0"""
13
23
 
@@ -1,20 +1,21 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- from typing import Union, Optional
3
+ from typing import List, Union, Optional
4
4
  from typing_extensions import Literal, TypeAlias
5
5
 
6
6
  from .._models import BaseModel
7
7
  from .currency import Currency
8
8
  from .time_interval import TimeInterval
9
+ from .add_meter_to_price import AddMeterToPrice
9
10
 
10
- __all__ = ["Price", "OneTimePrice", "RecurringPrice"]
11
+ __all__ = ["Price", "OneTimePrice", "RecurringPrice", "UsageBasedPrice"]
11
12
 
12
13
 
13
14
  class OneTimePrice(BaseModel):
14
15
  currency: Currency
15
16
  """The currency in which the payment is made."""
16
17
 
17
- discount: float
18
+ discount: int
18
19
  """Discount applied to the price, represented as a percentage (0 to 100)."""
19
20
 
20
21
  price: int
@@ -55,7 +56,7 @@ class RecurringPrice(BaseModel):
55
56
  currency: Currency
56
57
  """The currency in which the payment is made."""
57
58
 
58
- discount: float
59
+ discount: int
59
60
  """Discount applied to the price, represented as a percentage (0 to 100)."""
60
61
 
61
62
  payment_frequency_count: int
@@ -98,4 +99,50 @@ class RecurringPrice(BaseModel):
98
99
  """Number of days for the trial period. A value of `0` indicates no trial period."""
99
100
 
100
101
 
101
- Price: TypeAlias = Union[OneTimePrice, RecurringPrice]
102
+ class UsageBasedPrice(BaseModel):
103
+ currency: Currency
104
+ """The currency in which the payment is made."""
105
+
106
+ discount: int
107
+ """Discount applied to the price, represented as a percentage (0 to 100)."""
108
+
109
+ fixed_price: int
110
+ """The fixed payment amount.
111
+
112
+ Represented in the lowest denomination of the currency (e.g., cents for USD).
113
+ For example, to charge $1.00, pass `100`.
114
+ """
115
+
116
+ payment_frequency_count: int
117
+ """
118
+ Number of units for the payment frequency. For example, a value of `1` with a
119
+ `payment_frequency_interval` of `month` represents monthly payments.
120
+ """
121
+
122
+ payment_frequency_interval: TimeInterval
123
+ """The time interval for the payment frequency (e.g., day, month, year)."""
124
+
125
+ purchasing_power_parity: bool
126
+ """
127
+ Indicates if purchasing power parity adjustments are applied to the price.
128
+ Purchasing power parity feature is not available as of now
129
+ """
130
+
131
+ subscription_period_count: int
132
+ """
133
+ Number of units for the subscription period. For example, a value of `12` with a
134
+ `subscription_period_interval` of `month` represents a one-year subscription.
135
+ """
136
+
137
+ subscription_period_interval: TimeInterval
138
+ """The time interval for the subscription period (e.g., day, month, year)."""
139
+
140
+ type: Literal["usage_based_price"]
141
+
142
+ meters: Optional[List[AddMeterToPrice]] = None
143
+
144
+ tax_inclusive: Optional[bool] = None
145
+ """Indicates if the price is tax inclusive"""
146
+
147
+
148
+ Price: TypeAlias = Union[OneTimePrice, RecurringPrice, UsageBasedPrice]
@@ -2,20 +2,21 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Union, Optional
5
+ from typing import Union, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
7
 
8
8
  from .currency import Currency
9
9
  from .time_interval import TimeInterval
10
+ from .add_meter_to_price_param import AddMeterToPriceParam
10
11
 
11
- __all__ = ["PriceParam", "OneTimePrice", "RecurringPrice"]
12
+ __all__ = ["PriceParam", "OneTimePrice", "RecurringPrice", "UsageBasedPrice"]
12
13
 
13
14
 
14
15
  class OneTimePrice(TypedDict, total=False):
15
16
  currency: Required[Currency]
16
17
  """The currency in which the payment is made."""
17
18
 
18
- discount: Required[float]
19
+ discount: Required[int]
19
20
  """Discount applied to the price, represented as a percentage (0 to 100)."""
20
21
 
21
22
  price: Required[int]
@@ -56,7 +57,7 @@ class RecurringPrice(TypedDict, total=False):
56
57
  currency: Required[Currency]
57
58
  """The currency in which the payment is made."""
58
59
 
59
- discount: Required[float]
60
+ discount: Required[int]
60
61
  """Discount applied to the price, represented as a percentage (0 to 100)."""
61
62
 
62
63
  payment_frequency_count: Required[int]
@@ -99,4 +100,50 @@ class RecurringPrice(TypedDict, total=False):
99
100
  """Number of days for the trial period. A value of `0` indicates no trial period."""
100
101
 
101
102
 
102
- PriceParam: TypeAlias = Union[OneTimePrice, RecurringPrice]
103
+ class UsageBasedPrice(TypedDict, total=False):
104
+ currency: Required[Currency]
105
+ """The currency in which the payment is made."""
106
+
107
+ discount: Required[int]
108
+ """Discount applied to the price, represented as a percentage (0 to 100)."""
109
+
110
+ fixed_price: Required[int]
111
+ """The fixed payment amount.
112
+
113
+ Represented in the lowest denomination of the currency (e.g., cents for USD).
114
+ For example, to charge $1.00, pass `100`.
115
+ """
116
+
117
+ payment_frequency_count: Required[int]
118
+ """
119
+ Number of units for the payment frequency. For example, a value of `1` with a
120
+ `payment_frequency_interval` of `month` represents monthly payments.
121
+ """
122
+
123
+ payment_frequency_interval: Required[TimeInterval]
124
+ """The time interval for the payment frequency (e.g., day, month, year)."""
125
+
126
+ purchasing_power_parity: Required[bool]
127
+ """
128
+ Indicates if purchasing power parity adjustments are applied to the price.
129
+ Purchasing power parity feature is not available as of now
130
+ """
131
+
132
+ subscription_period_count: Required[int]
133
+ """
134
+ Number of units for the subscription period. For example, a value of `12` with a
135
+ `subscription_period_interval` of `month` represents a one-year subscription.
136
+ """
137
+
138
+ subscription_period_interval: Required[TimeInterval]
139
+ """The time interval for the subscription period (e.g., day, month, year)."""
140
+
141
+ type: Required[Literal["usage_based_price"]]
142
+
143
+ meters: Optional[Iterable[AddMeterToPriceParam]]
144
+
145
+ tax_inclusive: Optional[bool]
146
+ """Indicates if the price is tax inclusive"""
147
+
148
+
149
+ PriceParam: TypeAlias = Union[OneTimePrice, RecurringPrice, UsageBasedPrice]
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Optional
5
+ from typing import Dict, Optional
6
6
  from typing_extensions import Required, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .price_param import PriceParam
9
10
  from .tax_category import TaxCategory
10
11
  from .license_key_duration_param import LicenseKeyDurationParam
@@ -19,7 +20,7 @@ class ProductCreateParams(TypedDict, total=False):
19
20
  tax_category: Required[TaxCategory]
20
21
  """Tax category applied to this product"""
21
22
 
22
- addons: Optional[List[str]]
23
+ addons: Optional[SequenceNotStr[str]]
23
24
  """Addons available for subscription product"""
24
25
 
25
26
  brand_id: Optional[str]
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Optional
5
+ from typing import Dict, Optional
6
6
  from typing_extensions import TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .price_param import PriceParam
9
10
  from .tax_category import TaxCategory
10
11
  from .license_key_duration_param import LicenseKeyDurationParam
@@ -13,7 +14,7 @@ __all__ = ["ProductUpdateParams", "DigitalProductDelivery"]
13
14
 
14
15
 
15
16
  class ProductUpdateParams(TypedDict, total=False):
16
- addons: Optional[List[str]]
17
+ addons: Optional[SequenceNotStr[str]]
17
18
  """Available Addons for subscription products"""
18
19
 
19
20
  brand_id: Optional[str]
@@ -72,7 +73,7 @@ class DigitalProductDelivery(TypedDict, total=False):
72
73
  external_url: Optional[str]
73
74
  """External URL to digital product"""
74
75
 
75
- files: Optional[List[str]]
76
+ files: Optional[SequenceNotStr[str]]
76
77
  """Uploaded files ids of digital product"""
77
78
 
78
79
  instructions: Optional[str]
@@ -1,11 +1,12 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- from typing import Optional
3
+ from typing import Dict, Optional
4
4
  from datetime import datetime
5
5
 
6
6
  from .._models import BaseModel
7
7
  from .currency import Currency
8
8
  from .refund_status import RefundStatus
9
+ from .customer_limited_details import CustomerLimitedDetails
9
10
 
10
11
  __all__ = ["Refund"]
11
12
 
@@ -17,9 +18,15 @@ class Refund(BaseModel):
17
18
  created_at: datetime
18
19
  """The timestamp of when the refund was created in UTC."""
19
20
 
21
+ customer: CustomerLimitedDetails
22
+ """Details about the customer for this refund (from the associated payment)"""
23
+
20
24
  is_partial: bool
21
25
  """If true the refund is a partial refund"""
22
26
 
27
+ metadata: Dict[str, str]
28
+ """Additional metadata stored with the refund."""
29
+
23
30
  payment_id: str
24
31
  """The unique identifier of the payment associated with the refund."""
25
32
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Iterable, Optional
5
+ from typing import Dict, Iterable, Optional
6
6
  from typing_extensions import Required, TypedDict
7
7
 
8
8
  __all__ = ["RefundCreateParams", "Item"]
@@ -15,6 +15,9 @@ class RefundCreateParams(TypedDict, total=False):
15
15
  items: Optional[Iterable[Item]]
16
16
  """Partially Refund an Individual Item"""
17
17
 
18
+ metadata: Dict[str, str]
19
+ """Additional metadata associated with the refund."""
20
+
18
21
  reason: Optional[str]
19
22
  """The reason for the refund, if any. Maximum length is 3000 characters. Optional."""
20
23
 
@@ -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 .refund import Refund
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["RefundFailedWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Refund):
14
+ payload_type: Optional[Literal["Refund"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class RefundFailedWebhookEvent(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["refund.failed"]
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 .refund import Refund
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["RefundFailedWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Refund):
14
+ payload_type: Optional[Literal["Refund"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class RefundFailedWebhookEvent(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["refund.failed"]
29
+ """The event type"""
@@ -0,0 +1,39 @@
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 .currency import Currency
8
+ from .refund_status import RefundStatus
9
+
10
+ __all__ = ["RefundListResponse"]
11
+
12
+
13
+ class RefundListResponse(BaseModel):
14
+ business_id: str
15
+ """The unique identifier of the business issuing the refund."""
16
+
17
+ created_at: datetime
18
+ """The timestamp of when the refund was created in UTC."""
19
+
20
+ is_partial: bool
21
+ """If true the refund is a partial refund"""
22
+
23
+ payment_id: str
24
+ """The unique identifier of the payment associated with the refund."""
25
+
26
+ refund_id: str
27
+ """The unique identifier of the refund."""
28
+
29
+ status: RefundStatus
30
+ """The current status of the refund."""
31
+
32
+ amount: Optional[int] = None
33
+ """The refunded amount."""
34
+
35
+ currency: Optional[Currency] = None
36
+ """The currency of the refund, represented as an ISO 4217 currency code."""
37
+
38
+ reason: Optional[str] = None
39
+ """The reason provided for the refund, if any. Optional."""
@@ -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 .refund import Refund
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["RefundSucceededWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Refund):
14
+ payload_type: Optional[Literal["Refund"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class RefundSucceededWebhookEvent(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["refund.succeeded"]
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 .refund import Refund
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["RefundSucceededWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Refund):
14
+ payload_type: Optional[Literal["Refund"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class RefundSucceededWebhookEvent(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["refund.succeeded"]
29
+ """The event type"""
@@ -11,7 +11,23 @@ from .subscription_status import SubscriptionStatus
11
11
  from .addon_cart_response_item import AddonCartResponseItem
12
12
  from .customer_limited_details import CustomerLimitedDetails
13
13
 
14
- __all__ = ["Subscription"]
14
+ __all__ = ["Subscription", "Meter"]
15
+
16
+
17
+ class Meter(BaseModel):
18
+ currency: Currency
19
+
20
+ free_threshold: int
21
+
22
+ measurement_unit: str
23
+
24
+ meter_id: str
25
+
26
+ name: str
27
+
28
+ price_per_unit: str
29
+
30
+ description: Optional[str] = None
15
31
 
16
32
 
17
33
  class Subscription(BaseModel):
@@ -36,6 +52,9 @@ class Subscription(BaseModel):
36
52
  metadata: Dict[str, str]
37
53
  """Additional custom data associated with the subscription"""
38
54
 
55
+ meters: List[Meter]
56
+ """Meters associated with this subscription (for usage-based billing)"""
57
+
39
58
  next_billing_date: datetime
40
59
  """Timestamp of the next scheduled billing.
41
60
 
@@ -95,3 +114,6 @@ class Subscription(BaseModel):
95
114
 
96
115
  expires_at: Optional[datetime] = None
97
116
  """Timestamp when the subscription will expire"""
117
+
118
+ tax_id: Optional[str] = None
119
+ """Tax identifier provided for this subscription (if applicable)"""
@@ -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 .._models import BaseModel
8
+ from .subscription import Subscription
9
+
10
+ __all__ = ["SubscriptionActiveWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Subscription):
14
+ payload_type: Optional[Literal["Subscription"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class SubscriptionActiveWebhookEvent(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["subscription.active"]
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 .._models import BaseModel
8
+ from .subscription import Subscription
9
+
10
+ __all__ = ["SubscriptionActiveWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Subscription):
14
+ payload_type: Optional[Literal["Subscription"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class SubscriptionActiveWebhookEvent(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["subscription.active"]
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 .._models import BaseModel
8
+ from .subscription import Subscription
9
+
10
+ __all__ = ["SubscriptionCancelledWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Subscription):
14
+ payload_type: Optional[Literal["Subscription"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class SubscriptionCancelledWebhookEvent(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["subscription.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 .._models import BaseModel
8
+ from .subscription import Subscription
9
+
10
+ __all__ = ["SubscriptionCancelledWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Subscription):
14
+ payload_type: Optional[Literal["Subscription"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class SubscriptionCancelledWebhookEvent(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["subscription.cancelled"]
29
+ """The event type"""