Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx

### Added

- Non-catalog discounts on Transactions, see [changelog](https://developer.paddle.com/changelog/2025/custom-discounts?utm_source=dx&utm_medium=paddle-python-sdk)
- Support `retained_fee` field on totals objects to show the fees retained by Paddle for the adjustment.
- Added support for new payment methods `blik`, `mb_way`, `pix` and `upi`. See [related changelog](https://developer.paddle.com/changelog/2025/blik-mbway-payment-methods?utm_source=dx&utm_medium=paddle-python-sdk).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
TransactionCreateItemWithPrice,
CreateBillingDetails,
)
from paddle_billing.Resources.Transactions.Operations.Discount.TransactionNonCatalogDiscount import (
TransactionNonCatalogDiscount,
)


@dataclass
Expand All @@ -31,3 +34,4 @@ class CreateTransaction(Operation):
billing_details: CreateBillingDetails | None | Undefined = Undefined()
billing_period: TimePeriod | None | Undefined = Undefined()
checkout: Checkout | None | Undefined = Undefined()
discount: TransactionNonCatalogDiscount | None | Undefined = Undefined()
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import annotations
from dataclasses import dataclass

from paddle_billing.Undefined import Undefined
from paddle_billing.Entities.Shared.CustomData import CustomData
from paddle_billing.Entities.Discounts.DiscountType import DiscountType


@dataclass
class TransactionNonCatalogDiscount:
amount: str
description: str
type: DiscountType
recur: bool | Undefined = Undefined()
maximum_recurring_intervals: int | None | Undefined = Undefined()
custom_data: CustomData | None | Undefined = Undefined()
restrict_to: list[str] | None | Undefined = Undefined()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from paddle_billing.Resources.Transactions.Operations.Discount.TransactionNonCatalogDiscount import (
TransactionNonCatalogDiscount,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
TransactionItemPreviewWithPriceId,
TransactionItemPreviewWithNonCatalogPrice,
)
from paddle_billing.Resources.Transactions.Operations.Discount.TransactionNonCatalogDiscount import (
TransactionNonCatalogDiscount,
)


@dataclass
Expand All @@ -16,3 +19,4 @@ class PreviewTransaction(Operation):
currency_code: CurrencyCode | None | Undefined = Undefined()
discount_id: str | None | Undefined = Undefined()
ignore_trials: bool | Undefined = Undefined()
discount: TransactionNonCatalogDiscount | None | Undefined = Undefined()
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
TransactionItemPreviewWithPriceId,
TransactionItemPreviewWithNonCatalogPrice,
)
from paddle_billing.Resources.Transactions.Operations.Discount.TransactionNonCatalogDiscount import (
TransactionNonCatalogDiscount,
)


@dataclass
Expand All @@ -17,3 +20,4 @@ class PreviewTransactionByAddress(Operation):
currency_code: CurrencyCode | None | Undefined = Undefined()
discount_id: str | None | Undefined = Undefined()
ignore_trials: bool | Undefined = Undefined()
discount: TransactionNonCatalogDiscount | None | Undefined = Undefined()
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
TransactionItemPreviewWithPriceId,
TransactionItemPreviewWithNonCatalogPrice,
)
from paddle_billing.Resources.Transactions.Operations.Discount.TransactionNonCatalogDiscount import (
TransactionNonCatalogDiscount,
)


@dataclass
Expand All @@ -18,3 +21,4 @@ class PreviewTransactionByCustomer(Operation):
currency_code: CurrencyCode | None | Undefined = Undefined()
discount_id: str | None | Undefined = Undefined()
ignore_trials: bool | Undefined = Undefined()
discount: TransactionNonCatalogDiscount | None | Undefined = Undefined()
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
TransactionItemPreviewWithPriceId,
TransactionItemPreviewWithNonCatalogPrice,
)
from paddle_billing.Resources.Transactions.Operations.Discount.TransactionNonCatalogDiscount import (
TransactionNonCatalogDiscount,
)


@dataclass
Expand All @@ -17,3 +20,4 @@ class PreviewTransactionByIP(Operation):
currency_code: CurrencyCode | None | Undefined = Undefined()
discount_id: str | None | Undefined = Undefined()
ignore_trials: bool | Undefined = Undefined()
discount: TransactionNonCatalogDiscount | None | Undefined = Undefined()
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
TransactionUpdateItemWithPrice,
UpdateBillingDetails,
)
from paddle_billing.Resources.Transactions.Operations.Discount.TransactionNonCatalogDiscount import (
TransactionNonCatalogDiscount,
)


@dataclass
Expand All @@ -31,3 +34,4 @@ class UpdateTransaction(Operation):
billing_details: UpdateBillingDetails | None | Undefined = Undefined()
billing_period: TimePeriod | None | Undefined = Undefined()
checkout: Checkout | None | Undefined = Undefined()
discount: TransactionNonCatalogDiscount | None | Undefined = Undefined()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"items": [
{
"quantity": 1,
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv"
}
],
"discount": {
"amount": "500",
"description": "Black Friday",
"type": "flat",
"recur": true,
"maximum_recurring_intervals": 3,
"custom_data": {
"source": "bf2025"
},
"restrict_to": [
"pro_01gsz4t5hdjse780zja8vvr7jg",
"pro_01gsz4s0w61y0pp88528f1wvvb"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"items": [
{
"quantity": 1,
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv"
}
],
"discount": {
"amount": "10",
"description": "Promo",
"type": "percentage"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"address": {
"postal_code": "12345",
"country_code": "US"
},
"items": [
{
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"quantity": 1,
"include_in_totals": true
}
],
"discount": {
"amount": "500",
"description": "Black Friday",
"type": "flat",
"recur": true,
"maximum_recurring_intervals": 3,
"custom_data": {
"source": "bf2025"
},
"restrict_to": [
"pro_01gsz4t5hdjse780zja8vvr7jg",
"pro_01gsz4s0w61y0pp88528f1wvvb"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"address": {
"postal_code": "12345",
"country_code": "US"
},
"items": [
{
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"quantity": 1,
"include_in_totals": true
}
],
"discount": {
"amount": "5",
"description": "Black Friday",
"type": "percentage"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"address_id": "add_01hv8h6jj90jjz0d71m6hj4r9z",
"customer_id": "ctm_01h844q4mznqpgqgm6evgw1w63",
"business_id": "biz_01hv8j0z17hv4ew8teebwjmfcb",
"currency_code": "USD",
"items": [
{
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"quantity": 1,
"include_in_totals": true
}
],
"discount": {
"amount": "500",
"description": "Black Friday",
"type": "flat",
"recur": true,
"maximum_recurring_intervals": 3,
"custom_data": {
"source": "bf2025"
},
"restrict_to": [
"pro_01gsz4t5hdjse780zja8vvr7jg",
"pro_01gsz4s0w61y0pp88528f1wvvb"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"address_id": "add_01hv8h6jj90jjz0d71m6hj4r9z",
"customer_id": "ctm_01h844q4mznqpgqgm6evgw1w63",
"items": [
{
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"quantity": 1,
"include_in_totals": true
}
],
"discount": {
"amount": "5",
"description": "Black Friday",
"type": "percentage"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"customer_ip_address": "203.0.113.0",
"customer_id": "ctm_01h844q4mznqpgqgm6evgw1w63",
"currency_code": "USD",
"items": [
{
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"quantity": 1,
"include_in_totals": true
}
],
"discount": {
"amount": "500",
"description": "Black Friday",
"type": "flat",
"recur": true,
"maximum_recurring_intervals": 3,
"custom_data": {
"source": "bf2025"
},
"restrict_to": [
"pro_01gsz4t5hdjse780zja8vvr7jg",
"pro_01gsz4s0w61y0pp88528f1wvvb"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"customer_ip_address": "203.0.113.0",
"items": [
{
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"quantity": 1,
"include_in_totals": true
}
],
"discount": {
"amount": "5",
"description": "Black Friday",
"type": "percentage"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"items": [
{
"quantity": 1,
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"include_in_totals": true
}
],
"discount": {
"amount": "500",
"description": "Black Friday",
"type": "flat",
"recur": true,
"maximum_recurring_intervals": 3,
"custom_data": {
"source": "bf2025"
},
"restrict_to": [
"pro_01gsz4t5hdjse780zja8vvr7jg",
"pro_01gsz4s0w61y0pp88528f1wvvb"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"items": [
{
"quantity": 1,
"price_id": "pri_01he5kxqey1k8ankgef29cj4bv",
"include_in_totals": true
}
],
"discount": {
"amount": "5",
"description": "Black Friday",
"type": "percentage"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"discount": {
"amount": "500",
"description": "Black Friday",
"type": "flat",
"recur": true,
"maximum_recurring_intervals": 3,
"custom_data": {
"source": "bf2025"
},
"restrict_to": [
"pro_01gsz4t5hdjse780zja8vvr7jg",
"pro_01gsz4s0w61y0pp88528f1wvvb"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"discount": {
"amount": "10",
"description": "Promo",
"type": "percentage"
}
}
Loading