Skip to content

Commit 8b613d2

Browse files
authored
Releasing v3.27.0 (#129)
1 parent 3d73ffe commit 8b613d2

23 files changed

Lines changed: 431 additions & 51 deletions

File tree

CHANGELOG.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
1+
### v3.27.0 (2026-07-30)
2+
* * *
3+
### New Resources:
4+
- [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units) has been added.
5+
- [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries) has been added.
6+
7+
8+
### New Actions:
9+
- [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) has been added to [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations).
10+
11+
12+
### New Attributes:
13+
- [`unit_id`](https://apidocs.chargebee.com/docs/api/alerts/alert-object#unit_id) has been added to [`Alert`](https://apidocs.chargebee.com/docs/api/alerts).
14+
- [`subscription_id`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#subscription_id) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks).
15+
- [`modified_at`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#modified_at) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks).
16+
- [`resource_version`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#resource_version) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks).
17+
- [`created_at`](https://apidocs.chargebee.com/docs/api/ledger_account_balances/ledger-account-balance-object#created_at) has been added to [`LedgerAccountBalance`](https://apidocs.chargebee.com/docs/api/ledger_account_balances).
18+
- [`resource_version`](https://apidocs.chargebee.com/docs/api/ledger_account_balances/ledger-account-balance-object#resource_version) has been added to [`LedgerAccountBalance`](https://apidocs.chargebee.com/docs/api/ledger_account_balances).
19+
20+
21+
### New Parameters:
22+
- [`account_type`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks#account_type) has been added as query parameter to [`list_grant_blocks`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks) in [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks).
23+
- [`unit_id`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert#unit_id) has been added as request body parameter to [`create_an_alert`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert) in [`Alert`](https://apidocs.chargebee.com/docs/api/alerts).
24+
- [`include_cancellation_day_in_billing`](https://apidocs.chargebee.com/docs/api/estimates/cancel-subscription-for-items-estimate#include_cancellation_day_in_billing) has been added as request body parameter to [`cancel_subscription_for_items_estimate`](https://apidocs.chargebee.com/docs/api/estimates/cancel-subscription-for-items-estimate) in [`Estimate`](https://apidocs.chargebee.com/docs/api/estimates).
25+
- [`subscription_id`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#subscription_id) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations).
26+
- [`unit_id`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#unit_id) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations).
27+
- [`amount`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#amount) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations).
28+
- [`expires_at`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#expires_at) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations).
29+
- [`metadata`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#metadata) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations).
30+
- [`include_cancellation_day_in_billing`](https://apidocs.chargebee.com/docs/api/subscriptions/cancel-subscription-for-items#include_cancellation_day_in_billing) has been added as request body parameter to [`cancel_subscription_for_items`](https://apidocs.chargebee.com/docs/api/subscriptions/cancel-subscription-for-items) in [`Subscription`](https://apidocs.chargebee.com/docs/api/subscriptions).
31+
32+
33+
### New Events:
34+
- [`grant_blocks_created`](https://apidocs.chargebee.com/docs/api/events/webhook/grant_blocks_created) has been added.
35+
- [`ledger_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/ledger_updated) has been added.
36+
- [`ledger_account_balance_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/ledger_account_balance_updated) has been added.
37+
- [`grant_blocks_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/grant_blocks_updated) has been added.
38+
39+
40+
### New Enums:
41+
- `ledger_account_balance_updated`, `grant_blocks_created`, `grant_blocks_updated`, and `ledger_updated` have been added as new values enum `EventType`.
42+
- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values enum `PaymentMethod`.
43+
- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values enum `PaymentMethodType`.
44+
- `dana`, `touch_n_go`, `tamara`, `qpay`, `credit_balance_dropped`, `credit`, `debit`, `hold`, and `unhold` have been added as new values enum `Type`.
45+
- `active` and `archived` have been added as new values to enum attribute [`status`](https://apidocs.chargebee.com/docs/api/credit_units/credit-unit-object#status) in [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units).
46+
- `grant_renewal` and `subscription_renewed` have been added as new values to enum attribute [`grant_source`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#grant_source) in [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks).
47+
- `provisioned` and `overdraft` have been added as new values to enum attribute [`account_type`](https://apidocs.chargebee.com/docs/api/ledger_entries/ledger-entry-object#account_type) in [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries).
48+
- `credit_unit` has been added as a new value to enum attribute [`unit_type`](https://apidocs.chargebee.com/docs/api/ledger_entries/ledger-entry-object#unit_type) in [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries).
49+
- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum attribute [`payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents).
50+
- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum attribute [`active_payment_attempt.payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#active_payment_attempt_payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents).
51+
- `archived` and `active` have been added as new values to enum query parameter `status.in` in [`list_credit_units`](https://apidocs.chargebee.com/docs/api/credit_units/list-credit-units) of [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units).
52+
- `archived` and `active` have been added as new values to enum query parameter `status.is` in [`list_credit_units`](https://apidocs.chargebee.com/docs/api/credit_units/list-credit-units) of [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units).
53+
- `provisioned` and `overdraft` have been added as new values to enum query parameter `account_type.is` in [`list_grant_blocks`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks) of [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks).
54+
- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum request body parameter `payment_method_type` in [`update_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/update-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents).
55+
- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum request body parameter `payment_method_type` in [`create_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/create-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents).
56+
57+
58+
159
### v3.26.0 (2026-07-21)
260
* * *
361
### New Resources:

README.md

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ The package needs to be configured with your site's API key, which is available
3939
### Configuring chargebee client
4040
```python
4141
from chargebee import Chargebee
42+
4243
cb_client = Chargebee(api_key="", site="")
4344
```
4445

4546
### Configuring Timeouts
4647

4748
```python
4849
from chargebee import Chargebee
50+
4951
cb_client = Chargebee(api_key="api_key", site="site")
5052
cb_client.update_read_timeout_secs(3000)
5153
cb_client.update_connect_timeout_secs(5000)
@@ -55,6 +57,7 @@ cb_client.update_connect_timeout_secs(5000)
5557

5658
```python
5759
from chargebee import Chargebee
60+
5861
cb_client = Chargebee(api_key="api_key", site="site")
5962
cb_client.update_export_retry_delay_ms(3000)
6063
cb_client.update_time_travel_retry_delay_ms(5000)
@@ -99,9 +102,7 @@ When configured to use the async client, all model methods return a coroutine, w
99102
```python
100103
async def get_customers():
101104
response = await cb_client.Customer.list(
102-
cb_client.Customer.ListParams(
103-
first_name=Filters.StringFilter(IS="John")
104-
)
105+
cb_client.Customer.ListParams(first_name=Filters.StringFilter(IS="John"))
105106
)
106107
return response
107108
```
@@ -110,6 +111,7 @@ Note: The async methods will have to be wrapped in an event loop during invocati
110111

111112
```python
112113
import asyncio
114+
113115
response = asyncio.run(get_customers())
114116
```
115117

@@ -121,9 +123,7 @@ For pagination, `offset` is the parameter that is being used. The value used for
121123
from chargebee import Filters
122124

123125
response = cb_client.Customer.list(
124-
cb_client.Customer.ListParams(
125-
first_name=Filters.StringFilter(IS="John")
126-
)
126+
cb_client.Customer.ListParams(first_name=Filters.StringFilter(IS="John"))
127127
)
128128
offset = response.next_offset
129129
print(offset)
@@ -193,15 +193,15 @@ response = cb_client.Customer.create(
193193
),
194194
),
195195
None,
196-
{
197-
"chargebee-idempotency-key": "<<UUID>>"
198-
}, # Replace <<UUID>> with a unique string
196+
{"chargebee-idempotency-key": "<<UUID>>"}, # Replace <<UUID>> with a unique string
199197
)
200198
customer = response.customer
201199
card = response.card
202200
responseHeaders = response.headers # Retrieves response headers
203201
print(responseHeaders)
204-
idempotencyReplayedValue = response.is_idempotency_replayed # Retrieves Idempotency replayed header value
202+
idempotencyReplayedValue = (
203+
response.is_idempotency_replayed
204+
) # Retrieves Idempotency replayed header value
205205
print(idempotencyReplayedValue)
206206
```
207207

@@ -244,17 +244,11 @@ You can enable and configure the retry logic by passing a `retryConfig` object w
244244
from chargebee import Chargebee
245245
from chargebee.retry_config import RetryConfig
246246

247-
retry_config = RetryConfig(
248-
enabled=True,
249-
max_retries=5,
250-
delay_ms=1000,
251-
retry_on=[500]
252-
)
247+
retry_config = RetryConfig(enabled=True, max_retries=5, delay_ms=1000, retry_on=[500])
253248
cb_client = Chargebee(api_key="api_key", site="site")
254249
cb_client.update_retry_config(retry_config)
255250

256251
# ... your Chargebee API operations ...
257-
258252
```
259253

260254
#### Example: Rate Limit retry logic
@@ -265,17 +259,11 @@ You can enable and configure the retry logic for rate-limit by passing a `retryC
265259
from chargebee import Chargebee
266260
from chargebee.retry_config import RetryConfig
267261

268-
retry_config = RetryConfig(
269-
enabled=True,
270-
max_retries=5,
271-
delay_ms=1000,
272-
retry_on=[429]
273-
)
262+
retry_config = RetryConfig(enabled=True, max_retries=5, delay_ms=1000, retry_on=[429])
274263
cb_client = Chargebee(api_key="api_key", site="site")
275264
cb_client.update_retry_config(retry_config)
276265

277266
# ... your Chargebee API operations ...
278-
279267
```
280268

281269
### Telemetry (OpenTelemetry)
@@ -314,7 +302,12 @@ trace.set_tracer_provider(provider)
314302
```
315303

316304
```python
317-
from chargebee import Chargebee, RequestTelemetryContext, RequestTelemetryResult, TelemetryAdapter
305+
from chargebee import (
306+
Chargebee,
307+
RequestTelemetryContext,
308+
RequestTelemetryResult,
309+
TelemetryAdapter,
310+
)
318311
from opentelemetry import trace
319312
from opentelemetry.trace import SpanKind, Status, StatusCode
320313

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.26.0
1+
3.27.0

chargebee/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
self.CpqQuoteSignature = chargebee.CpqQuoteSignature(self.env)
6565
self.CreditNote = chargebee.CreditNote(self.env)
6666
self.CreditNoteEstimate = chargebee.CreditNoteEstimate(self.env)
67+
self.CreditUnit = chargebee.CreditUnit(self.env)
6768
self.Currency = chargebee.Currency(self.env)
6869
self.Customer = chargebee.Customer(self.env)
6970
self.CustomerEntitlement = chargebee.CustomerEntitlement(self.env)
@@ -95,6 +96,7 @@ def __init__(
9596
self.ItemFamily = chargebee.ItemFamily(self.env)
9697
self.ItemPrice = chargebee.ItemPrice(self.env)
9798
self.LedgerAccountBalance = chargebee.LedgerAccountBalance(self.env)
99+
self.LedgerEntry = chargebee.LedgerEntry(self.env)
98100
self.LedgerOperation = chargebee.LedgerOperation(self.env)
99101
self.Metadata = chargebee.Metadata(self.env)
100102
self.Meter = chargebee.Meter(self.env)

chargebee/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@
144144

145145
from chargebee.models.credit_note_estimate.operations import CreditNoteEstimate
146146

147+
from chargebee.models.credit_unit.operations import CreditUnit
148+
147149
from chargebee.models.currency.operations import Currency
148150

149151
from chargebee.models.customer.operations import Customer
@@ -206,6 +208,8 @@
206208

207209
from chargebee.models.ledger_account_balance.operations import LedgerAccountBalance
208210

211+
from chargebee.models.ledger_entry.operations import LedgerEntry
212+
209213
from chargebee.models.ledger_operation.operations import LedgerOperation
210214

211215
from chargebee.models.metadata.operations import Metadata

chargebee/models/alert/operations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class CreateParams(TypedDict):
5858
description: NotRequired[str]
5959
metered_feature_id: NotRequired[str]
6060
currency_code: NotRequired[str]
61+
unit_id: NotRequired[str]
6162
subscription_id: NotRequired[str]
6263
threshold: NotRequired["Alert.CreateThresholdParams"]
6364
meta: NotRequired[str]

chargebee/models/alert/responses.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ class AlertResponse(Model):
2828
description: str = None
2929
metered_feature_id: str = None
3030
currency_code: str = None
31+
unit_id: str = None
3132
subscription_id: str = None
3233
status: str = None
3334
meta: str = None
3435
created_at: int = None
3536
updated_at: int = None
36-
threshold: List[ThresholdResponse] = None
37+
threshold: ThresholdResponse = None
3738
filter_conditions: List[FilterConditionResponse] = None
3839

3940

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .operations import CreditUnit
2+
from .responses import CreditUnitResponse
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
from .responses import *
2+
from chargebee import request, environment
3+
from typing import TypedDict, Required, NotRequired, Dict, List, Any, cast
4+
from enum import Enum
5+
from chargebee.filters import Filters
6+
7+
8+
@dataclass
9+
class CreditUnit:
10+
env: environment.Environment
11+
12+
class Status(Enum):
13+
ACTIVE = "active"
14+
ARCHIVED = "archived"
15+
16+
def __str__(self):
17+
return self.value
18+
19+
class ListParams(TypedDict):
20+
limit: NotRequired[int]
21+
offset: NotRequired[str]
22+
status: NotRequired[Filters.EnumFilter]
23+
id: NotRequired[Filters.StringFilter]
24+
25+
class CreateParams(TypedDict):
26+
id: Required[str]
27+
name: Required[str]
28+
is_unlimited: Required[bool]
29+
overdraft_amount: NotRequired[str]
30+
external_name: NotRequired[str]
31+
32+
class UpdateParams(TypedDict):
33+
name: NotRequired[str]
34+
external_name: NotRequired[str]
35+
36+
def list(self, params: ListParams = None, headers=None) -> ListResponse:
37+
jsonKeys = {}
38+
options = {}
39+
return request.send_list_request(
40+
"get",
41+
request.uri_path("credit_units"),
42+
self.env,
43+
cast(Dict[Any, Any], params),
44+
headers,
45+
ListResponse,
46+
None,
47+
False,
48+
jsonKeys,
49+
options,
50+
resource="creditUnit",
51+
operation="list",
52+
)
53+
54+
def create(self, params: CreateParams, headers=None) -> CreateResponse:
55+
jsonKeys = {}
56+
options = {
57+
"isIdempotent": True,
58+
}
59+
return request.send(
60+
"post",
61+
request.uri_path("credit_units"),
62+
self.env,
63+
cast(Dict[Any, Any], params),
64+
headers,
65+
CreateResponse,
66+
None,
67+
False,
68+
jsonKeys,
69+
options,
70+
resource="creditUnit",
71+
operation="create",
72+
)
73+
74+
def update(self, id, params: UpdateParams = None, headers=None) -> UpdateResponse:
75+
jsonKeys = {}
76+
options = {
77+
"isIdempotent": True,
78+
}
79+
return request.send(
80+
"post",
81+
request.uri_path("credit_units", id),
82+
self.env,
83+
cast(Dict[Any, Any], params),
84+
headers,
85+
UpdateResponse,
86+
None,
87+
False,
88+
jsonKeys,
89+
options,
90+
resource="creditUnit",
91+
operation="update",
92+
)
93+
94+
def archive(self, id, headers=None) -> ArchiveResponse:
95+
jsonKeys = {}
96+
options = {
97+
"isIdempotent": True,
98+
}
99+
return request.send(
100+
"post",
101+
request.uri_path("credit_units", id, "archive_command"),
102+
self.env,
103+
None,
104+
headers,
105+
ArchiveResponse,
106+
None,
107+
False,
108+
jsonKeys,
109+
options,
110+
resource="creditUnit",
111+
operation="archive",
112+
)
113+
114+
def reactivate(self, id, headers=None) -> ReactivateResponse:
115+
jsonKeys = {}
116+
options = {
117+
"isIdempotent": True,
118+
}
119+
return request.send(
120+
"post",
121+
request.uri_path("credit_units", id, "reactivate_command"),
122+
self.env,
123+
None,
124+
headers,
125+
ReactivateResponse,
126+
None,
127+
False,
128+
jsonKeys,
129+
options,
130+
resource="creditUnit",
131+
operation="reactivate",
132+
)

0 commit comments

Comments
 (0)