Skip to content
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Stripe

## Unreleased

- Fixed a bug where the invoice amount wasn’t formatted correctly for zero-decimal currencies. ([#96](https://github.com/craftcms/stripe/issues/96))

## 1.6.0 - 2025-06-25

- The “Sync from Stripe” user action now shows a confirmation dialog before syncing customer data from Stripe. ([#87](https://github.com/craftcms/stripe/pull/87))
Expand Down
7 changes: 6 additions & 1 deletion src/services/Invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use craft\errors\MutexException;
use craft\helpers\Json;
use craft\stripe\db\Table;
use craft\stripe\helpers\Price;
use craft\stripe\models\Invoice;
use craft\stripe\Plugin;
use craft\stripe\records\InvoiceData as InvoiceDataRecord;
Expand Down Expand Up @@ -198,10 +199,14 @@ public function getTableData(array $invoices): array
$formatter = Craft::$app->getFormatter();

foreach ($invoices as $invoice) {
$amount = $invoice->data['total'];
if (!in_array(strtolower($invoice->data['currency']), Price::$zeroDecimalCurrencies)) {
$amount = $amount / 100;
}
$tableData[] = [
'id' => $invoice->stripeId,
'title' => $invoice->data['number'] ?? Craft::t('stripe', 'Draft'),
'amount' => $formatter->asCurrency($invoice->data['total'] / 100, $invoice->data['currency']),
'amount' => $formatter->asCurrency($amount, $invoice->data['currency']),
'stripeStatus' => $invoice->data['status'],
'frequency' => '',
'customerEmail' => $invoice->data['customer_email'],
Expand Down
Loading