dodopayments 1.19.0__py3-none-any.whl → 1.20.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. dodopayments/_client.py +33 -24
  2. dodopayments/_version.py +1 -1
  3. dodopayments/resources/__init__.py +14 -0
  4. dodopayments/resources/addons.py +589 -0
  5. dodopayments/resources/payments.py +4 -301
  6. dodopayments/resources/products/products.py +11 -6
  7. dodopayments/resources/subscriptions.py +20 -307
  8. dodopayments/types/__init__.py +9 -0
  9. dodopayments/types/addon_cart_response_item.py +11 -0
  10. dodopayments/types/addon_create_params.py +30 -0
  11. dodopayments/types/addon_list_params.py +16 -0
  12. dodopayments/types/addon_response.py +44 -0
  13. dodopayments/types/addon_update_images_response.py +11 -0
  14. dodopayments/types/addon_update_params.py +33 -0
  15. dodopayments/types/currency.py +153 -0
  16. dodopayments/types/payment.py +3 -295
  17. dodopayments/types/payment_create_params.py +2 -149
  18. dodopayments/types/payment_list_response.py +2 -148
  19. dodopayments/types/payout_list_response.py +2 -147
  20. dodopayments/types/price.py +3 -294
  21. dodopayments/types/price_param.py +3 -298
  22. dodopayments/types/product.py +2 -2
  23. dodopayments/types/product_create_params.py +3 -2
  24. dodopayments/types/product_list_response.py +4 -151
  25. dodopayments/types/product_update_params.py +3 -2
  26. dodopayments/types/refund.py +2 -150
  27. dodopayments/types/subscription.py +7 -149
  28. dodopayments/types/subscription_create_params.py +13 -151
  29. dodopayments/types/subscription_create_response.py +5 -1
  30. dodopayments/types/subscription_list_response.py +77 -0
  31. dodopayments/types/tax_category.py +7 -0
  32. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/METADATA +6 -6
  33. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/RECORD +35 -25
  34. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/WHEEL +0 -0
  35. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/licenses/LICENSE +0 -0
@@ -2,9 +2,9 @@
2
2
 
3
3
  from typing import Optional
4
4
  from datetime import datetime
5
- from typing_extensions import Literal
6
5
 
7
6
  from .._models import BaseModel
7
+ from .currency import Currency
8
8
  from .refund_status import RefundStatus
9
9
 
10
10
  __all__ = ["Refund"]
@@ -28,155 +28,7 @@ class Refund(BaseModel):
28
28
  amount: Optional[int] = None
29
29
  """The refunded amount."""
30
30
 
31
- currency: Optional[
32
- Literal[
33
- "AED",
34
- "ALL",
35
- "AMD",
36
- "ANG",
37
- "AOA",
38
- "ARS",
39
- "AUD",
40
- "AWG",
41
- "AZN",
42
- "BAM",
43
- "BBD",
44
- "BDT",
45
- "BGN",
46
- "BHD",
47
- "BIF",
48
- "BMD",
49
- "BND",
50
- "BOB",
51
- "BRL",
52
- "BSD",
53
- "BWP",
54
- "BYN",
55
- "BZD",
56
- "CAD",
57
- "CHF",
58
- "CLP",
59
- "CNY",
60
- "COP",
61
- "CRC",
62
- "CUP",
63
- "CVE",
64
- "CZK",
65
- "DJF",
66
- "DKK",
67
- "DOP",
68
- "DZD",
69
- "EGP",
70
- "ETB",
71
- "EUR",
72
- "FJD",
73
- "FKP",
74
- "GBP",
75
- "GEL",
76
- "GHS",
77
- "GIP",
78
- "GMD",
79
- "GNF",
80
- "GTQ",
81
- "GYD",
82
- "HKD",
83
- "HNL",
84
- "HRK",
85
- "HTG",
86
- "HUF",
87
- "IDR",
88
- "ILS",
89
- "INR",
90
- "IQD",
91
- "JMD",
92
- "JOD",
93
- "JPY",
94
- "KES",
95
- "KGS",
96
- "KHR",
97
- "KMF",
98
- "KRW",
99
- "KWD",
100
- "KYD",
101
- "KZT",
102
- "LAK",
103
- "LBP",
104
- "LKR",
105
- "LRD",
106
- "LSL",
107
- "LYD",
108
- "MAD",
109
- "MDL",
110
- "MGA",
111
- "MKD",
112
- "MMK",
113
- "MNT",
114
- "MOP",
115
- "MRU",
116
- "MUR",
117
- "MVR",
118
- "MWK",
119
- "MXN",
120
- "MYR",
121
- "MZN",
122
- "NAD",
123
- "NGN",
124
- "NIO",
125
- "NOK",
126
- "NPR",
127
- "NZD",
128
- "OMR",
129
- "PAB",
130
- "PEN",
131
- "PGK",
132
- "PHP",
133
- "PKR",
134
- "PLN",
135
- "PYG",
136
- "QAR",
137
- "RON",
138
- "RSD",
139
- "RUB",
140
- "RWF",
141
- "SAR",
142
- "SBD",
143
- "SCR",
144
- "SEK",
145
- "SGD",
146
- "SHP",
147
- "SLE",
148
- "SLL",
149
- "SOS",
150
- "SRD",
151
- "SSP",
152
- "STN",
153
- "SVC",
154
- "SZL",
155
- "THB",
156
- "TND",
157
- "TOP",
158
- "TRY",
159
- "TTD",
160
- "TWD",
161
- "TZS",
162
- "UAH",
163
- "UGX",
164
- "USD",
165
- "UYU",
166
- "UZS",
167
- "VES",
168
- "VND",
169
- "VUV",
170
- "WST",
171
- "XAF",
172
- "XCD",
173
- "XOF",
174
- "XPF",
175
- "YER",
176
- "ZAR",
177
- "ZMW",
178
- ]
179
- ] = None
31
+ currency: Optional[Currency] = None
180
32
 
181
33
  reason: Optional[str] = None
182
34
  """The reason provided for the refund, if any. Optional."""
@@ -1,171 +1,29 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- from typing import Dict, Optional
3
+ from typing import Dict, List, Optional
4
4
  from datetime import datetime
5
- from typing_extensions import Literal
6
5
 
7
6
  from .._models import BaseModel
7
+ from .currency import Currency
8
8
  from .time_interval import TimeInterval
9
9
  from .billing_address import BillingAddress
10
10
  from .subscription_status import SubscriptionStatus
11
+ from .addon_cart_response_item import AddonCartResponseItem
11
12
  from .customer_limited_details import CustomerLimitedDetails
12
13
 
13
14
  __all__ = ["Subscription"]
14
15
 
15
16
 
16
17
  class Subscription(BaseModel):
18
+ addons: List[AddonCartResponseItem]
19
+ """Addons associated with this subscription"""
20
+
17
21
  billing: BillingAddress
18
22
 
19
23
  created_at: datetime
20
24
  """Timestamp when the subscription was created"""
21
25
 
22
- currency: Literal[
23
- "AED",
24
- "ALL",
25
- "AMD",
26
- "ANG",
27
- "AOA",
28
- "ARS",
29
- "AUD",
30
- "AWG",
31
- "AZN",
32
- "BAM",
33
- "BBD",
34
- "BDT",
35
- "BGN",
36
- "BHD",
37
- "BIF",
38
- "BMD",
39
- "BND",
40
- "BOB",
41
- "BRL",
42
- "BSD",
43
- "BWP",
44
- "BYN",
45
- "BZD",
46
- "CAD",
47
- "CHF",
48
- "CLP",
49
- "CNY",
50
- "COP",
51
- "CRC",
52
- "CUP",
53
- "CVE",
54
- "CZK",
55
- "DJF",
56
- "DKK",
57
- "DOP",
58
- "DZD",
59
- "EGP",
60
- "ETB",
61
- "EUR",
62
- "FJD",
63
- "FKP",
64
- "GBP",
65
- "GEL",
66
- "GHS",
67
- "GIP",
68
- "GMD",
69
- "GNF",
70
- "GTQ",
71
- "GYD",
72
- "HKD",
73
- "HNL",
74
- "HRK",
75
- "HTG",
76
- "HUF",
77
- "IDR",
78
- "ILS",
79
- "INR",
80
- "IQD",
81
- "JMD",
82
- "JOD",
83
- "JPY",
84
- "KES",
85
- "KGS",
86
- "KHR",
87
- "KMF",
88
- "KRW",
89
- "KWD",
90
- "KYD",
91
- "KZT",
92
- "LAK",
93
- "LBP",
94
- "LKR",
95
- "LRD",
96
- "LSL",
97
- "LYD",
98
- "MAD",
99
- "MDL",
100
- "MGA",
101
- "MKD",
102
- "MMK",
103
- "MNT",
104
- "MOP",
105
- "MRU",
106
- "MUR",
107
- "MVR",
108
- "MWK",
109
- "MXN",
110
- "MYR",
111
- "MZN",
112
- "NAD",
113
- "NGN",
114
- "NIO",
115
- "NOK",
116
- "NPR",
117
- "NZD",
118
- "OMR",
119
- "PAB",
120
- "PEN",
121
- "PGK",
122
- "PHP",
123
- "PKR",
124
- "PLN",
125
- "PYG",
126
- "QAR",
127
- "RON",
128
- "RSD",
129
- "RUB",
130
- "RWF",
131
- "SAR",
132
- "SBD",
133
- "SCR",
134
- "SEK",
135
- "SGD",
136
- "SHP",
137
- "SLE",
138
- "SLL",
139
- "SOS",
140
- "SRD",
141
- "SSP",
142
- "STN",
143
- "SVC",
144
- "SZL",
145
- "THB",
146
- "TND",
147
- "TOP",
148
- "TRY",
149
- "TTD",
150
- "TWD",
151
- "TZS",
152
- "UAH",
153
- "UGX",
154
- "USD",
155
- "UYU",
156
- "UZS",
157
- "VES",
158
- "VND",
159
- "VUV",
160
- "WST",
161
- "XAF",
162
- "XCD",
163
- "XOF",
164
- "XPF",
165
- "YER",
166
- "ZAR",
167
- "ZMW",
168
- ]
26
+ currency: Currency
169
27
 
170
28
  customer: CustomerLimitedDetails
171
29
 
@@ -2,13 +2,14 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
+ from .currency import Currency
8
9
  from .billing_address_param import BillingAddressParam
9
10
  from .customer_request_param import CustomerRequestParam
10
11
 
11
- __all__ = ["SubscriptionCreateParams", "OnDemand"]
12
+ __all__ = ["SubscriptionCreateParams", "Addon", "OnDemand"]
12
13
 
13
14
 
14
15
  class SubscriptionCreateParams(TypedDict, total=False):
@@ -22,6 +23,9 @@ class SubscriptionCreateParams(TypedDict, total=False):
22
23
  quantity: Required[int]
23
24
  """Number of units to subscribe for. Must be at least 1."""
24
25
 
26
+ addons: Optional[Iterable[Addon]]
27
+ """Attach addons to this subscription"""
28
+
25
29
  allowed_payment_method_types: Optional[
26
30
  List[
27
31
  Literal[
@@ -54,155 +58,7 @@ class SubscriptionCreateParams(TypedDict, total=False):
54
58
  settings).
55
59
  """
56
60
 
57
- billing_currency: Optional[
58
- Literal[
59
- "AED",
60
- "ALL",
61
- "AMD",
62
- "ANG",
63
- "AOA",
64
- "ARS",
65
- "AUD",
66
- "AWG",
67
- "AZN",
68
- "BAM",
69
- "BBD",
70
- "BDT",
71
- "BGN",
72
- "BHD",
73
- "BIF",
74
- "BMD",
75
- "BND",
76
- "BOB",
77
- "BRL",
78
- "BSD",
79
- "BWP",
80
- "BYN",
81
- "BZD",
82
- "CAD",
83
- "CHF",
84
- "CLP",
85
- "CNY",
86
- "COP",
87
- "CRC",
88
- "CUP",
89
- "CVE",
90
- "CZK",
91
- "DJF",
92
- "DKK",
93
- "DOP",
94
- "DZD",
95
- "EGP",
96
- "ETB",
97
- "EUR",
98
- "FJD",
99
- "FKP",
100
- "GBP",
101
- "GEL",
102
- "GHS",
103
- "GIP",
104
- "GMD",
105
- "GNF",
106
- "GTQ",
107
- "GYD",
108
- "HKD",
109
- "HNL",
110
- "HRK",
111
- "HTG",
112
- "HUF",
113
- "IDR",
114
- "ILS",
115
- "INR",
116
- "IQD",
117
- "JMD",
118
- "JOD",
119
- "JPY",
120
- "KES",
121
- "KGS",
122
- "KHR",
123
- "KMF",
124
- "KRW",
125
- "KWD",
126
- "KYD",
127
- "KZT",
128
- "LAK",
129
- "LBP",
130
- "LKR",
131
- "LRD",
132
- "LSL",
133
- "LYD",
134
- "MAD",
135
- "MDL",
136
- "MGA",
137
- "MKD",
138
- "MMK",
139
- "MNT",
140
- "MOP",
141
- "MRU",
142
- "MUR",
143
- "MVR",
144
- "MWK",
145
- "MXN",
146
- "MYR",
147
- "MZN",
148
- "NAD",
149
- "NGN",
150
- "NIO",
151
- "NOK",
152
- "NPR",
153
- "NZD",
154
- "OMR",
155
- "PAB",
156
- "PEN",
157
- "PGK",
158
- "PHP",
159
- "PKR",
160
- "PLN",
161
- "PYG",
162
- "QAR",
163
- "RON",
164
- "RSD",
165
- "RUB",
166
- "RWF",
167
- "SAR",
168
- "SBD",
169
- "SCR",
170
- "SEK",
171
- "SGD",
172
- "SHP",
173
- "SLE",
174
- "SLL",
175
- "SOS",
176
- "SRD",
177
- "SSP",
178
- "STN",
179
- "SVC",
180
- "SZL",
181
- "THB",
182
- "TND",
183
- "TOP",
184
- "TRY",
185
- "TTD",
186
- "TWD",
187
- "TZS",
188
- "UAH",
189
- "UGX",
190
- "USD",
191
- "UYU",
192
- "UZS",
193
- "VES",
194
- "VND",
195
- "VUV",
196
- "WST",
197
- "XAF",
198
- "XCD",
199
- "XOF",
200
- "XPF",
201
- "YER",
202
- "ZAR",
203
- "ZMW",
204
- ]
205
- ]
61
+ billing_currency: Optional[Currency]
206
62
 
207
63
  discount_code: Optional[str]
208
64
  """Discount Code to apply to the subscription"""
@@ -233,6 +89,12 @@ class SubscriptionCreateParams(TypedDict, total=False):
233
89
  """
234
90
 
235
91
 
92
+ class Addon(TypedDict, total=False):
93
+ addon_id: Required[str]
94
+
95
+ quantity: Required[int]
96
+
97
+
236
98
  class OnDemand(TypedDict, total=False):
237
99
  mandate_only: Required[bool]
238
100
  """
@@ -1,14 +1,18 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- from typing import Dict, Optional
3
+ from typing import Dict, List, Optional
4
4
 
5
5
  from .._models import BaseModel
6
+ from .addon_cart_response_item import AddonCartResponseItem
6
7
  from .customer_limited_details import CustomerLimitedDetails
7
8
 
8
9
  __all__ = ["SubscriptionCreateResponse"]
9
10
 
10
11
 
11
12
  class SubscriptionCreateResponse(BaseModel):
13
+ addons: List[AddonCartResponseItem]
14
+ """Addons associated with this subscription"""
15
+
12
16
  customer: CustomerLimitedDetails
13
17
 
14
18
  metadata: Dict[str, str]
@@ -0,0 +1,77 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Dict, Optional
4
+ from datetime import datetime
5
+
6
+ from .._models import BaseModel
7
+ from .currency import Currency
8
+ from .time_interval import TimeInterval
9
+ from .billing_address import BillingAddress
10
+ from .subscription_status import SubscriptionStatus
11
+ from .customer_limited_details import CustomerLimitedDetails
12
+
13
+ __all__ = ["SubscriptionListResponse"]
14
+
15
+
16
+ class SubscriptionListResponse(BaseModel):
17
+ billing: BillingAddress
18
+
19
+ created_at: datetime
20
+ """Timestamp when the subscription was created"""
21
+
22
+ currency: Currency
23
+
24
+ customer: CustomerLimitedDetails
25
+
26
+ metadata: Dict[str, str]
27
+
28
+ next_billing_date: datetime
29
+ """Timestamp of the next scheduled billing.
30
+
31
+ Indicates the end of current billing period
32
+ """
33
+
34
+ on_demand: bool
35
+ """Wether the subscription is on-demand or not"""
36
+
37
+ payment_frequency_count: int
38
+ """Number of payment frequency intervals"""
39
+
40
+ payment_frequency_interval: TimeInterval
41
+
42
+ previous_billing_date: datetime
43
+ """Timestamp of the last payment. Indicates the start of current billing period"""
44
+
45
+ product_id: str
46
+ """Identifier of the product associated with this subscription"""
47
+
48
+ quantity: int
49
+ """Number of units/items included in the subscription"""
50
+
51
+ recurring_pre_tax_amount: int
52
+ """
53
+ Amount charged before tax for each recurring payment in smallest currency unit
54
+ (e.g. cents)
55
+ """
56
+
57
+ status: SubscriptionStatus
58
+
59
+ subscription_id: str
60
+ """Unique identifier for the subscription"""
61
+
62
+ subscription_period_count: int
63
+ """Number of subscription period intervals"""
64
+
65
+ subscription_period_interval: TimeInterval
66
+
67
+ tax_inclusive: bool
68
+ """Indicates if the recurring_pre_tax_amount is tax inclusive"""
69
+
70
+ trial_period_days: int
71
+ """Number of days in the trial period (0 if no trial)"""
72
+
73
+ cancelled_at: Optional[datetime] = None
74
+ """Cancelled timestamp if the subscription is cancelled"""
75
+
76
+ discount_id: Optional[str] = None
77
+ """The discount id if discount is applied"""
@@ -0,0 +1,7 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal, TypeAlias
4
+
5
+ __all__ = ["TaxCategory"]
6
+
7
+ TaxCategory: TypeAlias = Literal["digital_products", "saas", "e_book", "edtech"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dodopayments
3
- Version: 1.19.0
3
+ Version: 1.20.0
4
4
  Summary: The official Python library for the Dodo Payments API
5
5
  Project-URL: Homepage, https://github.com/dodopayments/dodopayments-python
6
6
  Project-URL: Repository, https://github.com/dodopayments/dodopayments-python
@@ -59,7 +59,7 @@ import os
59
59
  from dodopayments import DodoPayments
60
60
 
61
61
  client = DodoPayments(
62
- bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
62
+ api_key=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
63
63
  # defaults to "live_mode".
64
64
  environment="test_mode",
65
65
  )
@@ -83,10 +83,10 @@ payment = client.payments.create(
83
83
  print(payment.payment_id)
84
84
  ```
85
85
 
86
- While you can provide a `bearer_token` keyword argument,
86
+ While you can provide an `api_key` keyword argument,
87
87
  we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
88
- to add `DODO_PAYMENTS_API_KEY="My Bearer Token"` to your `.env` file
89
- so that your Bearer Token is not stored in source control.
88
+ to add `DODO_PAYMENTS_API_KEY="My API Key"` to your `.env` file
89
+ so that your API Key is not stored in source control.
90
90
 
91
91
  ## Async usage
92
92
 
@@ -98,7 +98,7 @@ import asyncio
98
98
  from dodopayments import AsyncDodoPayments
99
99
 
100
100
  client = AsyncDodoPayments(
101
- bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
101
+ api_key=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
102
102
  # defaults to "live_mode".
103
103
  environment="test_mode",
104
104
  )