Skip to content

Commit 0c89bcd

Browse files
feat: Added support for retained_fee in adjustment totals (#138)
1 parent 975d397 commit 0c89bcd

23 files changed

+62
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx
1212

1313
- Non-catalog discounts on Transactions, see [changelog](https://developer.paddle.com/changelog/2025/custom-discounts?utm_source=dx&utm_medium=paddle-php-sdk)
1414
- 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-php-sdk).
15+
- Support `retained_fee` field on totals objects to show the fees retained by Paddle for the adjustment.
1516
- `ApiError` will now have `retryAfter` property set for [too_many_requests](https://developer.paddle.com/errors/shared/too_many_requests) errors
1617

1718
## [1.11.0] - 2025-09-15

src/Entities/Shared/AdjustmentTotals.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ private function __construct(
1818
public string $tax,
1919
public string $total,
2020
public string $fee,
21+
public string $retainedFee,
2122
public string $earnings,
2223
public CurrencyCode $currencyCode,
2324
) {
@@ -30,6 +31,7 @@ public static function from(array $data): self
3031
tax: $data['tax'],
3132
total: $data['total'],
3233
fee: $data['fee'],
34+
retainedFee: $data['retained_fee'],
3335
earnings: $data['earnings'],
3436
currencyCode: CurrencyCode::from($data['currency_code']),
3537
);

src/Entities/Shared/PayoutTotalsAdjustment.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private function __construct(
1919
public string $total,
2020
public string $fee,
2121
public ChargebackFee|null $chargebackFee,
22+
public string $retainedFee,
2223
public string $earnings,
2324
public CurrencyCodePayouts $currencyCode,
2425
) {
@@ -32,6 +33,7 @@ public static function from(array $data): self
3233
total: $data['total'],
3334
fee: $data['fee'],
3435
chargebackFee: isset($data['chargeback_fee']) ? ChargebackFee::from($data['chargeback_fee']) : null,
36+
retainedFee: $data['retained_fee'],
3537
earnings: $data['earnings'],
3638
currencyCode: CurrencyCodePayouts::from($data['currency_code']),
3739
);

src/Entities/Shared/TransactionPayoutTotalsAdjusted.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private function __construct(
1919
public string $total,
2020
public string $fee,
2121
public ChargebackFee $chargebackFee,
22+
public string $retainedFee,
2223
public string $earnings,
2324
public CurrencyCodePayouts $currencyCode,
2425
public string $exchangeRate,
@@ -33,6 +34,7 @@ public static function from(array $data): self
3334
$data['total'],
3435
$data['fee'],
3536
ChargebackFee::from($data['chargeback_fee']),
37+
$data['retained_fee'],
3638
$data['earnings'],
3739
CurrencyCodePayouts::from($data['currency_code']),
3840
$data['exchange_rate'],

src/Entities/Shared/TransactionTotalsAdjusted.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private function __construct(
1919
public string $total,
2020
public string $grandTotal,
2121
public string|null $fee,
22+
public string $retainedFee,
2223
public string|null $earnings,
2324
public CurrencyCode $currencyCode,
2425
) {
@@ -32,6 +33,7 @@ public static function from(array $data): self
3233
$data['total'],
3334
$data['grand_total'],
3435
$data['fee'] ?? null,
36+
$data['retained_fee'],
3537
$data['earnings'] ?? null,
3638
CurrencyCode::from($data['currency_code']),
3739
);

src/Notifications/Entities/Shared/AdjustmentTotals.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ private function __construct(
1818
public string $tax,
1919
public string $total,
2020
public string $fee,
21+
public string|null $retainedFee,
2122
public string $earnings,
2223
public CurrencyCode $currencyCode,
2324
) {
@@ -30,6 +31,7 @@ public static function from(array $data): self
3031
tax: $data['tax'],
3132
total: $data['total'],
3233
fee: $data['fee'],
34+
retainedFee: $data['retained_fee'] ?? null,
3335
earnings: $data['earnings'],
3436
currencyCode: CurrencyCode::from($data['currency_code']),
3537
);

src/Notifications/Entities/Shared/PayoutTotalsAdjustment.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private function __construct(
1919
public string $total,
2020
public string $fee,
2121
public ChargebackFee|null $chargebackFee,
22+
public string|null $retainedFee,
2223
public string $earnings,
2324
public CurrencyCodePayouts $currencyCode,
2425
) {
@@ -32,6 +33,7 @@ public static function from(array $data): self
3233
total: $data['total'],
3334
fee: $data['fee'],
3435
chargebackFee: isset($data['chargeback_fee']) ? ChargebackFee::from($data['chargeback_fee']) : null,
36+
retainedFee: $data['retained_fee'] ?? null,
3537
earnings: $data['earnings'],
3638
currencyCode: CurrencyCodePayouts::from($data['currency_code']),
3739
);

src/Notifications/Entities/Shared/TransactionPayoutTotalsAdjusted.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private function __construct(
1919
public string $total,
2020
public string $fee,
2121
public ChargebackFee $chargebackFee,
22+
public string|null $retainedFee,
2223
public string $earnings,
2324
public CurrencyCodePayouts $currencyCode,
2425
public string|null $exchangeRate,
@@ -33,6 +34,7 @@ public static function from(array $data): self
3334
$data['total'],
3435
$data['fee'],
3536
ChargebackFee::from($data['chargeback_fee']),
37+
$data['retained_fee'] ?? null,
3638
$data['earnings'],
3739
CurrencyCodePayouts::from($data['currency_code']),
3840
$data['exchange_rate'] ?? null,

src/Notifications/Entities/Shared/TransactionTotalsAdjusted.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private function __construct(
1919
public string $total,
2020
public string $grandTotal,
2121
public string|null $fee,
22+
public string|null $retainedFee,
2223
public string|null $earnings,
2324
public CurrencyCode $currencyCode,
2425
) {
@@ -32,6 +33,7 @@ public static function from(array $data): self
3233
$data['total'],
3334
$data['grand_total'],
3435
$data['fee'] ?? null,
36+
$data['retained_fee'] ?? null,
3537
$data['earnings'] ?? null,
3638
CurrencyCode::from($data['currency_code']),
3739
);

tests/Functional/Resources/Adjustments/_fixtures/response/full_entity.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"tax": "8",
4141
"total": "100",
4242
"fee": "5",
43+
"retained_fee": "0",
4344
"earnings": "87",
4445
"currency_code": "USD"
4546
},
@@ -48,6 +49,7 @@
4849
"tax": "163",
4950
"total": "2049",
5051
"fee": "20",
52+
"retained_fee": "0",
5153
"earnings": "2029",
5254
"currency_code": "USD"
5355
},

0 commit comments

Comments
 (0)